-
Notifications
You must be signed in to change notification settings - Fork 146
265 lines (234 loc) · 7.79 KB
/
tests.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
name: Tests
on:
pull_request:
push:
branches: [master]
jobs:
native_tests:
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
name: Native Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-native-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-doc-tests-
cargo-${{ runner.os }}-
- name: Run tests
run: cargo test --workspace --exclude gloo-net
browser_tests:
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
name: Browser Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Setup trunk
uses: jetli/trunk-action@v0.4.0
with:
version: 'latest'
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-browser-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-browser-tests-
cargo-${{ runner.os }}-
- name: Run tests
run: |
for x in $(ls crates); do
# gloo-net is tested separately
if [[ "$x" == "net" ]]; then
continue
fi
if [[ "$x" == "worker-macros" ]]; then
continue
fi
wasm-pack test --headless --firefox --chrome crates/$x --all-features
wasm-pack test --headless --firefox --chrome crates/$x --no-default-features
done
node_tests:
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
name: Node Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-node-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-node-tests-
cargo-${{ runner.os }}-
- name: Run tests
run: |
for x in $(ls crates); do
# gloo-net is tested separately
if [[ "$x" == "net" ]]; then
continue
fi
wasm-pack test --node crates/$x --all-features
wasm-pack test --node crates/$x --no-default-features
done
test-history-wasi:
name: Test gloo-history WASI
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-wasi
- name: Install wasmtime
run: |
wget https://github.com/bytecodealliance/wasmtime/releases/download/v15.0.1/wasmtime-v15.0.1-x86_64-linux.tar.xz
tar xf wasmtime-v15.0.1-x86_64-linux.tar.xz
mv wasmtime-v15.0.1-x86_64-linux/wasmtime ~/wasmtime
rm -rf wasmtime-v15.0.1-x86_64-linux.tar.xz wasmtime-v15.0.1-x86_64-linux
chmod +x ~/wasmtime
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-node-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-node-tests-
cargo-${{ runner.os }}-
- name: Build and run example history-wasi
run: |
cargo build --package example-history-wasi --target wasm32-wasi
~/wasmtime --trap-unknown-imports target/wasm32-wasi/debug/example-history-wasi.wasm
test-worker:
name: Test gloo-worker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# example: [ markdown, prime ]
example: [markdown]
rust-version: [1.64, stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Setup trunk
uses: jetli/trunk-action@v0.4.0
with:
version: 'latest'
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-browser-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-test-worker-
cargo-${{ runner.os }}-
- name: Build and Run Test Server
run: |
cargo build -p example-${{ matrix.example }} --bin example_${{ matrix.example }}_test_server
nohup target/debug/example_${{ matrix.example }}_test_server examples/${{ matrix.example }}/dist &
- name: Build Test Worker
run: |
trunk build examples/${{ matrix.example }}/index.html
- name: Run tests for gloo worker
run: |
wasm-pack test --headless --chrome --firefox examples/${{ matrix.example }}
test-net:
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
name: Test gloo-net
runs-on: ubuntu-latest
services:
httpbin:
image: kennethreitz/httpbin@sha256:599fe5e5073102dbb0ee3dbb65f049dab44fa9fc251f6835c9990f8fb196a72b
ports:
- 8080:80
echo_server:
image: jmalloc/echo-server@sha256:e43a10c9ecbd025df7ed6dac1e45551ce7bd676142600b0734fe7dcd10a47abe
ports:
- 8081:8080
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-test-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-test-
cargo-${{ runner.os }}-
- name: Run browser tests
env:
HTTPBIN_URL: 'http://localhost:8080'
WS_ECHO_SERVER_URL: 'ws://localhost:8081'
SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse'
run: |
cd crates/net
wasm-pack test --chrome --firefox --headless --all-features
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-unknown-unknown
- name: Run native tests
env:
HTTPBIN_URL: 'http://localhost:8080'
WS_ECHO_SERVER_URL: 'ws://localhost:8081'
SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse'
run: cargo test -p gloo-net --all-features