-
Notifications
You must be signed in to change notification settings - Fork 353
303 lines (296 loc) · 9.73 KB
/
desktop-e2e.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
name: Desktop - End-to-end tests
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
push:
inputs:
macos12:
type: boolean
default: true
macos13:
type: boolean
default: true
macos14:
type: boolean
default: true
debian11:
type: boolean
default: true
debian12:
type: boolean
default: true
ubuntu2004:
type: boolean
default: true
ubuntu2204:
type: boolean
default: true
fedora38:
type: boolean
default: true
fedora37:
type: boolean
default: true
fedora36:
type: boolean
default: true
windows10:
type: boolean
default: true
windows11:
type: boolean
default: true
jobs:
prepare-matrices:
name: Prepare Linux matrix
runs-on: ubuntu-latest
steps:
- run: |
# Construct matrix for Linux jobs
linux_matrix=()
[[ true == ${{ github.event.inputs.debian11 }} ]] && linux_matrix+=("debian11")
[[ true == ${{ github.event.inputs.debian12 }} ]] && linux_matrix+=("debian12")
[[ true == ${{ github.event.inputs.ubuntu2004 }} ]] && linux_matrix+=("ubuntu2004")
[[ true == ${{ github.event.inputs.ubuntu2204 }} ]] && linux_matrix+=("ubuntu2204")
[[ true == ${{ github.event.inputs.ubuntu2304 }} ]] && linux_matrix+=("ubuntu2304")
[[ true == ${{ github.event.inputs.fedora38 }} ]] && linux_matrix+=("fedora38")
[[ true == ${{ github.event.inputs.fedora37 }} ]] && linux_matrix+=("fedora37")
[[ true == ${{ github.event.inputs.fedora36 }} ]] && linux_matrix+=("fedora36")
jq -c -n '$ARGS.positional' --args "${linux_matrix[@]}" >> $GITHUB_ENV
outputs:
linux_matrix: ${{ env.linux_matrix }}
prepare-linux:
needs: prepare-matrices
if: fromJson(needs.prepare-matrices.outputs.linux_matrix) != '[]'
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use custom container image if specified
if: ${{ github.event.inputs.override_container_image != '' }}
run: echo "inner_container_image=${{ github.event.inputs.override_container_image }}"
>> $GITHUB_ENV
- name: Use default container image and resolve digest
if: ${{ github.event.inputs.override_container_image == '' }}
run: |
echo "inner_container_image=$(cat ./building/linux-container-image.txt)" >> $GITHUB_ENV
outputs:
container_image: ${{ env.inner_container_image }}
build-linux:
needs: prepare-linux
runs-on: ubuntu-latest
container:
image: ${{ needs.prepare-linux.outputs.container_image }}
continue-on-error: true
steps:
# Fix for HOME path overridden by GH runners when building in containers, see:
# https://github.com/actions/runner/issues/863
- name: Fix HOME path
run: echo "HOME=/root" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout binaries submodule
run: |
git config --global --add safe.directory '*'
git submodule update --init --depth=1 dist-assets/binaries
- name: Build app
env:
USE_MOLD: false
run: ./build.sh
- name: Build test executable
run: ./gui/scripts/build-test-executable.sh
- uses: actions/upload-artifact@v3
if: '!cancelled()'
with:
name: linux-build
path: |
./dist/*.rpm
./dist/*.deb
./dist/app-e2e-*
e2e-test-linux:
name: Linux end-to-end tests
needs: [prepare-matrices, build-linux]
if: '!cancelled()'
runs-on: [self-hosted, desktop-test, Linux] # app-test-linux
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.prepare-matrices.outputs.linux_matrix) }}
steps:
- uses: actions/download-artifact@v3
if: ${{ needs.build-linux.result == 'success' }}
with:
name: linux-build
path: ~/.cache/mullvad-test/packages
- name: Checkout repository
uses: actions/checkout@v4
- name: Run end-to-end tests
shell: bash -ieo pipefail {0}
run: |
git fetch --tags --force
./test/ci-runtests.sh ${{ matrix.os }}
- uses: actions/upload-artifact@v3
if: '!cancelled()'
with:
name: ${{ matrix.os }}_report
path: ./test/.ci-logs/${{ matrix.os }}_report
build-windows:
# TODO: only run tasks if windows matrix isn't empty
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' }}
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodules
run: git submodule update --init --depth=1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
node-version: 18
- name: Install Rust
uses: actions-rs/[email protected]
with:
toolchain: stable
target: i686-pc-windows-msvc
default: true
- name: Install msbuild
uses: microsoft/[email protected]
with:
vs-version: 16
- name: Build app
shell: bash
# TODO: For some reason, 'npm run pack:win' wants to publish the artifacts
continue-on-error: true
run: ./build.sh
- name: Build test executable
shell: bash
run: ./gui/scripts/build-test-executable.sh
- uses: actions/upload-artifact@v3
if: '!cancelled()'
with:
name: windows-build
path: .\dist\*.exe
e2e-test-windows:
needs: build-windows
if: '!cancelled()'
name: Windows end-to-end tests
runs-on: [self-hosted, desktop-test, Linux] # app-test-linux
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
os: [windows10, windows11]
steps:
- uses: actions/download-artifact@v3
if: ${{ needs.build-windows.result == 'success' }}
with:
name: windows-build
path: ~/.cache/mullvad-test/packages
- name: Checkout repository
uses: actions/checkout@v4
- name: Run end-to-end tests
shell: bash -ieo pipefail {0}
run: |
git fetch --tags --force
./test/ci-runtests.sh ${{ matrix.os }}
- uses: actions/upload-artifact@v3
if: '!cancelled()'
with:
name: ${{ matrix.os }}_report
path: ./test/.ci-logs/${{ matrix.os }}_report
build-macos:
# TODO: only run tasks if macos
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' }}
runs-on: [self-hosted, desktop-test, macOS] # app-test-macos-arm
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodules
run: git submodule update --init --depth=1
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.18.5
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
node-version: 18
cache: 'npm'
cache-dependency-path: gui/package-lock.json
- name: Build app
run: ./build.sh
- name: Build test executable
run: ./gui/scripts/build-test-executable.sh
- uses: actions/upload-artifact@v3
if: '!cancelled()'
with:
name: macos-build
path: |
./dist/*.pkg
./dist/app-e2e-*
e2e-test-macos:
needs: build-macos
if: '!cancelled()'
name: macOS end-to-end tests
runs-on: [self-hosted, desktop-test, macOS] # app-test-macos-arm
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
# TODO: filter inputs
os: [macos-14, macos-13, macos-12]
steps:
- uses: actions/download-artifact@v3
if: ${{ needs.build-macos.result == 'success' }}
with:
name: macos-build
path: ~/Library/Caches/mullvad-test/packages
- name: Checkout repository
uses: actions/checkout@v4
- name: Run end-to-end tests
shell: bash -ieo pipefail {0}
run: |
git fetch --tags --force
./test/ci-runtests.sh ${{ matrix.os }}
- uses: actions/upload-artifact@v3
if: '!cancelled()'
with:
name: ${{ matrix.os }}_report
path: ./test/.ci-logs/${{ matrix.os }}_report
compile-test-matrix:
name: Result matrix
needs: [e2e-test-linux, e2e-test-windows, e2e-test-macos]
if: '!cancelled()'
runs-on: [self-hosted, desktop-test, Linux]
timeout-minutes: 240
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
path: ./test/.ci-logs/artifacts
- name: Generate test result matrix
shell: bash -ieo pipefail {0}
run: |
cd test
# "Unpack" the downloaded report artifacts: https://github.com/actions/download-artifact/issues/141
cp ./.ci-logs/artifacts/*_report/*_report ./.ci-logs/
cargo run --bin test-manager format-test-reports ./.ci-logs/*_report \
| tee summary.html >> $GITHUB_STEP_SUMMARY
- uses: actions/upload-artifact@v3
with:
name: summary.html
path: test/summary.html