-
-
Notifications
You must be signed in to change notification settings - Fork 828
218 lines (184 loc) · 5.87 KB
/
test_web.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
name: Test Web
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Paths filter
runs-on: ubuntu-24.04
outputs:
should_run: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@v4
- uses: AurorNZ/paths-filter@v4
id: filter
with:
filters: |
src:
- '!**/*.md'
build:
needs: changes
if: needs.changes.outputs.should_run == 'true'
name: Test Node.js ${{ matrix.node_version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node_version: ["22", "23"]
os: [ubuntu-24.04, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Cargo output
uses: Swatinem/rust-cache@v2
with:
shared-key: "web"
save-if: ${{ github.ref == 'refs/heads/master' }}
# wasm-bindgen-cli version must match wasm-bindgen crate version.
# Be sure to update in release_nightly.yml, Cargo.toml, web/docker/Dockerfile,
# and web/README.md as well.
- name: Install wasm-bindgen
run: cargo install wasm-bindgen-cli --version 0.2.97
# Keep the version number in sync in all workflows,
# and in the extension builder Dockerfile!
- name: Install wasm-opt
# It runs for a long time, and the build is already slow on Windows,
# where it doesn't have much benefit anyway - most tests are run on Ubuntu.
if: matrix.os != 'windows-latest'
uses: sigoden/install-binary@v1
with:
repo: WebAssembly/binaryen
tag: version_120
name: wasm-opt
- name: Build
env:
RUSTFLAGS: -D warnings
# Verify that all features build.
CARGO_FLAGS: --all-features
working-directory: web
shell: bash -l {0}
run: |
npm ci
npm run build
- name: Check formatting
if: matrix.os == 'ubuntu-24.04'
working-directory: web
run: npm run lint
- name: Run node-based tests
working-directory: web
run: npm test
build-for-browser-tests:
needs: changes
if: needs.changes.outputs.should_run == 'true'
name: Build for browser tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Cargo output
uses: Swatinem/rust-cache@v2
with:
shared-key: "web"
save-if: false
# wasm-bindgen-cli version must match wasm-bindgen crate version.
# Be sure to update in release_nightly.yml, Cargo.toml, web/docker/Dockerfile,
# and web/README.md as well.
- name: Install wasm-bindgen
run: cargo install wasm-bindgen-cli --version 0.2.97
# No real need to install wasm-opt here
- name: Build selfhosted
env:
RUSTFLAGS: -D warnings
# Verify that all features build.
CARGO_FLAGS: --all-features
working-directory: web
shell: bash -l {0}
run: |
npm ci
npm run build --workspace=ruffle-core
npm run build --workspace=ruffle-selfhosted
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: selfhosted-dist
path: web/packages/selfhosted/dist
browser-tests:
needs: build-for-browser-tests
if: needs.changes.outputs.should_run == 'true'
name: Test in ${{ matrix.browser }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
browser: ["chrome", "firefox", "edge"]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: selfhosted-dist
path: web/packages/selfhosted/dist
- name: Run browser-based tests
working-directory: web
shell: bash -l {0}
run: |
npm ci
npm run wdio -- --headless --parallel --${{ matrix.browser }}
# The rest is needed only because otherwise the real jobs couldn't be made required for merging PRs,
# as they would fail the entire workflow run if skipped - this makes GitHub happy instead.
# See:
# - https://github.com/orgs/community/discussions/13690
# - https://github.com/orgs/community/discussions/44490
build-dummy:
needs: changes
if: needs.changes.outputs.should_run == 'false'
name: Test Node.js ${{ matrix.node_version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ["22", "23"]
os: [ubuntu-24.04, windows-latest]
steps:
- name: No-op
run: echo noop
browser-tests-dummy:
needs: changes
if: needs.changes.outputs.should_run == 'false'
name: Test in ${{ matrix.browser }}
runs-on: ubuntu-24.04
strategy:
matrix:
browser: ["chrome", "firefox", "edge"]
steps:
- name: No-op
run: echo noop