-
Notifications
You must be signed in to change notification settings - Fork 119
246 lines (211 loc) · 6.94 KB
/
wasm.yaml
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
name: WebAssembly
on:
push:
branches:
- main
- 'releases/**'
pull_request:
branches:
- main
- 'releases/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
wasmQt6:
name: Wasm Qt6
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.testGen.outputs.tests }}
env:
QTVERSION: 6.2.4
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Install Qt
shell: bash
run: |
python3 -m pip install aqtinstall
# qt6.2.3 for wasm needs the desktop linux installation
python3 -m aqt install-qt -O /opt linux desktop $QTVERSION
python3 -m aqt install-qt -O /opt linux desktop $QTVERSION wasm_32 -m qtcharts qtwebsockets qt5compat
- name: Install python dependencies
shell: bash
run: |
pip install -r requirements.txt
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v7
- name: Compiling
shell: bash
run: |
export PATH=/opt/$QTVERSION/wasm_32/bin:/opt/$QTVERSION/gcc_64/bin:$PATH
mkdir build
/opt/$QTVERSION/wasm_32/bin/qt-cmake -S . -B build -DQT_HOST_PATH=/opt/$QTVERSION/gcc_64 -DQT_HOST_PATH_CMAKE_DIR=/opt/$QTVERSION/gcc_64/lib/cmake
cmake --build build -j4
cp $(pwd)/build/src/mozillavpn.wasm wasm
cp $(pwd)/build/src/mozillavpn.js wasm
cp $(pwd)/build/src/qtloader.js wasm
cp $(pwd)/tests/functional/fxa_endpoints.js wasm
cp $(pwd)/tests/functional/guardian_endpoints.js wasm
cp -r $(pwd)/tools/logviewer wasm
- name: Generate tasklist
id: testGen
shell: bash
run: |
echo -n "::set-output name=tests::"
for test in $(find tests/functional -name 'test*.js' | sort); do
grep "$(basename ${test%.js})" tests/functional/wasm-test-ignore &>/dev/null || printf '{"name": "%s", "path": "%s"}' $(basename ${test%.js} | sed -n 's/test//p') $test
done | jq -s -c
- name: Check tests
shell: bash
env:
TEST_LIST: ${{ steps.testGen.outputs.tests }}
run: |
echo $TEST_LIST | jq
- name: Uploading
uses: actions/upload-artifact@v1
with:
name: WebAssembly Build Qt6
path: wasm
inspector:
runs-on: ubuntu-20.04
steps:
- name: Clone repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Building
shell: bash
run: |
cd tools/inspector
npm install
npm run build
- name: Uploading
uses: actions/upload-artifact@v1
with:
name: Inspector Build
path: tools/inspector/dist
addons:
runs-on: ubuntu-20.04
env:
QTVERSION: 6.2.4
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Install Qt
shell: bash
run: |
python3 -m pip install aqtinstall
python3 -m aqt install-qt -O /opt linux desktop $QTVERSION
- name: Install python dependencies
shell: bash
run: |
pip3 install -r requirements.txt
- name: Generating addons
shell: bash
run: |
export PATH=/opt/$QTVERSION/gcc_64/bin:$PATH
python3 scripts/addon/generate_all.py
- name: Sign manifest
shell: bash
env:
ADDON_PRIVATE_KEY: ${{ secrets.ADDON_PRIVATE_KEY }}
run: |
echo -n "$ADDON_PRIVATE_KEY" > addon_private_key.pem
openssl dgst -sha256 -sign addon_private_key.pem -out addons/generated/addons/manifest.json.sign addons/generated/addons/manifest.json
rm addon_private_key.pem
- name: Uploading
uses: actions/upload-artifact@v1
with:
name: Addons
path: addons/generated/addons
ghPages:
runs-on: ubuntu-20.04
needs: [wasmQt6, inspector, addons]
name: Publish Wasm on Github Pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: WebAssembly Build Qt6
# Destination path
path: _site
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: Addons
path: _site/addons
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: Inspector Build
path: _site/inspector
- name: Uploading site Build
uses: actions/upload-artifact@v1
with:
name: GH-Pages Build
path: _site
- name: GH Pages deploy
uses: Cecilapp/[email protected]
if: github.ref == 'refs/heads/main' # Only publish on main branch.
with:
# A verified email.
email: [email protected]
# Where static files are.
build_dir: _site
functionaltests:
name: Functional tests
needs:
- wasmQt6
runs-on: ubuntu-20.04
timeout-minutes: 45
strategy:
fail-fast: false # Don't cancel other jobs if a test fails
matrix:
test: ${{ fromJson(needs.wasmQt6.outputs.matrix) }}
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Cache build
id: cache-build
uses: actions/cache@v2
with:
path: build/
key: ${{ github.sha }}
- name: Install dependecies
run: |
sudo apt install --no-upgrade firefox xvfb -y
pip3 install -r requirements.txt
npm install
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: WebAssembly Build Qt6
# Destination path
path: wasm
- uses: browser-actions/setup-geckodriver@latest
- name: Running ${{matrix.test.name}} Tests
id: runTests
uses: nick-invision/retry@v2
with:
timeout_minutes: 15
max_attempts: 3
command: |
export PATH=$GECKOWEBDRIVER:$(npm bin):$PATH
export HEADLESS=yes
xvfb-run -a npm run functionalTestWasm -- ${{matrix.test.path}}