-
-
Notifications
You must be signed in to change notification settings - Fork 126
135 lines (108 loc) · 3.87 KB
/
playwright-on-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Chromium and firefox run full tests suite with Playwright
on:
push:
branches: [ main ]
permissions:
contents: read
issues: write
jobs:
testFirefoxUnit:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build phoenix
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright unit tests in Firefox
run: npm run testFirefox
testFirefoxInteg:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build phoenix
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright integration tests in firefox Attempt 1
timeout-minutes: 30
id: attempt1
continue-on-error: true
run: npm run testIntegFirefox
- name: Run Playwright integration tests in firefox Attempt 2
if: steps.attempt1.outcome == 'failure'
id: attempt2
run: npm run testIntegFirefox
testChromiumUnit:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build phoenix
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright unit tests in Chromium
run: npm run testChromium
testChromiumInteg:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build phoenix
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright integration tests in Chromium Attempt 1
timeout-minutes: 30
id: attemptC1
continue-on-error: true
run: npm run testIntegChromium
- name: Run Playwright integration tests in Chromium Attempt 2
if: steps.attemptC1.outcome == 'failure'
id: attemptC2
run: npm run testIntegChromium
raiseIssue:
needs: [ testFirefoxUnit, testFirefoxInteg, testChromiumUnit, testChromiumInteg]
runs-on: ubuntu-latest
if: always() # This ensures that this job runs even if the previous jobs failed
steps:
- name: Check for failures and raise an issue
if: |
always() &&
(needs.testFirefox.result == 'failure' || needs.testChromium.result == 'failure')
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issueTitle = "Test failure on push: commit ${{github.sha}}";
const runURL = `https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}`;
let issueBody = `There was a test failure. Please investigate.\n\n[Check the failed run here](${runURL})\n\n`;
if (needs.testFirefoxUnit.result == 'failure') {
issueBody += " - Firefox unit tests failed.\n";
}
if (needs.testFirefoxInteg.result == 'failure') {
issueBody += " - Firefox integration tests failed.\n";
}
if (needs.testChromiumUnit.result == 'failure') {
issueBody += " - Chromium unit tests failed.\n";
}
if (needs.testChromiumInteg.result == 'failure') {
issueBody += " - Chromium integration tests failed.\n";
}
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: issueTitle,
body: issueBody
});