-
-
Notifications
You must be signed in to change notification settings - Fork 135
225 lines (187 loc) · 9.32 KB
/
CI.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: CI
on:
- push
- pull_request
# Allow running manually
- workflow_dispatch
jobs:
# Tests the list of offline files in the Service Worker and compares it to the contents of the www directory
# Also runs end-to-end tests on Windows (taking advantage of the build)
tests-files-windows:
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Test the list of offline files in Service Worker
run: ./scripts/Check-OfflineFilesList.ps1
# This job runs always, including for remote pull requests, and
# has external dependencies or special permission needs, besides a
# local install of Node.js, Firefox, and Chromium or Chrome.
#
# You can run these same tests locally in your own developer
# environment via `npm ci && npm test`.
tests-linux:
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
# Clone the repo and checkout the commit for which the workflow was triggered
- uses: actions/checkout@v4
- name: Test integrity of app parameters
run: |
# Check that values of assetsCache and appVersion are correctly duplicated
chmod +x ./scripts/test_duplicate_values.sh
./scripts/test_duplicate_values.sh
# Check that PWAServer is correctly set in init.js
chmod +x ./scripts/test_pwa_server.sh
./scripts/test_pwa_server.sh
- name: Install dependencies
run: npm ci
- name: Unit tests (Linux)
run: npm run test-unit-browsers
- name: Test a full build of the app
run: npm run build
- name: Test integrity of patch_gitignore.sh
run: |
# Check that the /scripts/patch_gitignore script valid (it will be needed for the gh-pages implementation used for unbundled testing)
echo "DEV: If this patch_gitignore script fails, follow instructions in ADDING_DEPENDENCIES_NODE_MODULES.md to correct it."
chmod +x ./scripts/patch_gitignore.sh
./scripts/patch_gitignore.sh
# Check that .gitignore does NOT contain /dist/
failed=0
if grep -q "^/dist/" .gitignore; then
echo "/dist/ found in .gitignore, so patch failed."
failed=1
fi
# Check that .gitignore DOES contain !/node_modules/
if ! grep -q "^\!/node_modules/" .gitignore; then
echo "!/node_modules/ not found in .gitignore, so patch failed."
failed=1
fi
exit $failed
- name: End-to-end tests on Chrome (Linux)
env:
GITHUB_ACTION: ${{ github.event_name }}
run: npm run test-e2e-chrome
# Disabling Edge tests for now, as they are very flaky on Linux, but pass fine on Windows
# - name: End-to-end tests on Edge (Linux)
# env:
# GITHUB_ACTION: ${{ github.event_name }}
# run: npm run test-e2e-edge
- name: End-to-end tests on Firefox (Linux)
env:
GITHUB_ACTION: ${{ github.event_name }}
run: npm run test-e2e-firefox
- name: BrowserStack environment setup
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
uses: browserstack/github-actions/setup-env@master
with:
username: ${{ secrets.BROWSERSTACK_USERNAME }}
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
- name: BrowserStack local tunnel setup
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
uses: browserstack/github-actions/setup-local@master
with:
local-testing: start
local-identifier: random
- name: Start server locally in background
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: npx http-server --silent -p 8099 &
- name: Run BrowserStack tests on Firefox Legacy 56 / Win10
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: npx mocha tests/e2e/runners/firefox/firefox56.bs.runner.js
- name: Run BrowserStack tests on Firefox 70 / Win10
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: npx mocha tests/e2e/runners/firefox/firefox70.bs.runner.js
- name: Run BrowserStack tests on Chrome 58 / Mojave
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: npx mocha tests/e2e/runners/chrome/chrome58.bs.runner.js
- name: Run BrowserStack tests on Chrome 60 / Mojave
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: npx mocha tests/e2e/runners/chrome/chrome60.bs.runner.js
- name: Run BrowserStack tests on Safari 14 / Big Sur
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: npx mocha tests/e2e/runners/safari/safari14.bs.runner.js
# [DEV] Test on Edge18 are bit flaky, so we are retrying 2 times
- name: Run BrowserStack tests on Edge Legacy 18 / Win10
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: npx mocha tests/e2e/runners/edge/edge18.bs.runner.js --retries 2
- name: Stop BrowserStackLocal
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
uses: browserstack/github-actions/setup-local@master
with:
local-testing: stop
tests-windows:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: windows-latest
timeout-minutes: 30
steps:
# Clone the repo and checkout the commit for which the workflow was triggered
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Build App
run: npm run build-min
- name: Unit tests (Windows)
run: |
$AggregateExitCode = 0
npm run test-unit-edge
$AggregateExitCode += $LastExitCode
npm run test-unit-firefox
$AggregateExitCode += $LastExitCode
if ($AggregateExitCode -ne 0) {
echo " "
Write-Error "Number of failed tests: $AggregateExitCode"
}
exit $AggregateExitCode
- name: End-to-end tests on Edge Chromium (Windows)
env:
GITHUB_ACTION: ${{ github.event_name }}
run: npx start-server-and-test 'http-server --silent' 8080 'npx mocha ./tests/e2e/runners/edge/microsoftEdge.e2e.runner.js --retries 2'
- name: End-to-end tests on Firefox (Windows)
env:
GITHUB_ACTION: ${{ github.event_name }}
run: npx start-server-and-test 'http-server --silent' 8080 'npx mocha ./tests/e2e/runners/firefox/firefox.e2e.runner.js --retries 2'
- name: End-to-end tests in IE11 Mode (Windows)
env:
GITHUB_ACTION: ${{ github.event_name }}
run: npx start-server-and-test 'http-server --silent' 8080 'npx mocha ./tests/e2e/runners/edge/ieMode.e2e.runner.js --retries 2'
# tests-unit-mac:
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
# runs-on: macos-latest
# steps:
# # Clone the repo and checkout the commit for which the workflow was triggered
# - uses: actions/checkout@v4
# - name: Install dependencies
# run: npm ci
# - name: Unit tests (Mackintosh)
# run: |
# npx testcafe remote ./tests/initTestCafe.js --hostname localhost --ports 1337,1338 &
# pid=$!
# open -a Safari http://localhost:1337
# wait $pid