Skip to content

Commit c93c260

Browse files
authored
Merge pull request #321 from rust-random/webtest
CI: Add Web Tests for Edge on Windows
2 parents 8e44d13 + c3d9797 commit c93c260

File tree

1 file changed

+50
-34
lines changed

1 file changed

+50
-34
lines changed

.github/workflows/tests.yml

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ jobs:
2121
- uses: dtolnay/rust-toolchain@nightly # Needed for -Z minimal-versions and doc_cfg
2222
- name: Install precompiled cargo-deadlinks
2323
run: |
24-
export URL=$(curl -s https://api.github.com/repos/deadlinks/cargo-deadlinks/releases/latest | jq -r '.assets[] | select(.name | contains("cargo-deadlinks-linux")) | .browser_download_url')
25-
wget -O /tmp/cargo-deadlinks $URL
26-
chmod +x /tmp/cargo-deadlinks
27-
mv /tmp/cargo-deadlinks ~/.cargo/bin
24+
VERSION=0.8.1
25+
URL="https://github.com/deadlinks/cargo-deadlinks/releases/download/${VERSION}/cargo-deadlinks-linux"
26+
wget -O ~/.cargo/bin/cargo-deadlinks $URL
27+
chmod +x ~/.cargo/bin/cargo-deadlinks
28+
cargo deadlinks --version
2829
- uses: Swatinem/rust-cache@v2
2930
- name: Generate Docs
3031
env:
@@ -90,11 +91,11 @@ jobs:
9091
- uses: dtolnay/rust-toolchain@stable
9192
with:
9293
targets: x86_64-apple-ios
93-
- name: Download cargo-dinghy
94+
- name: Install precompiled cargo-dinghy
9495
run: |
9596
VERSION=0.6.2
9697
URL="https://github.com/sonos/dinghy/releases/download/${VERSION}/cargo-dinghy-macos-${VERSION}.tgz"
97-
curl -L $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
98+
wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
9899
cargo dinghy --version
99100
- name: Setup Simulator
100101
run: |
@@ -139,10 +140,10 @@ jobs:
139140
- uses: actions/checkout@v3
140141
- name: Install precompiled cross
141142
run: |
142-
export URL=$(curl -s https://api.github.com/repos/cross-rs/cross/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url')
143-
wget -O /tmp/binaries.tar.gz $URL
144-
tar -C /tmp -xzf /tmp/binaries.tar.gz
145-
mv /tmp/cross ~/.cargo/bin
143+
VERSION=v0.2.4
144+
URL=https://github.com/cross-rs/cross/releases/download/${VERSION}/cross-x86_64-unknown-linux-gnu.tar.gz
145+
wget -O - $URL | tar -xz -C ~/.cargo/bin
146+
cross --version
146147
- uses: Swatinem/rust-cache@v2
147148
- name: Test
148149
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std
@@ -176,41 +177,56 @@ jobs:
176177
- uses: actions/checkout@v3
177178
- name: Install precompiled cross
178179
run: |
179-
export URL=$(curl -s https://api.github.com/repos/cross-rs/cross/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url')
180-
wget -O /tmp/binaries.tar.gz $URL
181-
tar -C /tmp -xzf /tmp/binaries.tar.gz
182-
mv /tmp/cross ~/.cargo/bin
180+
VERSION=v0.2.4
181+
URL=https://github.com/cross-rs/cross/releases/download/${VERSION}/cross-x86_64-unknown-linux-gnu.tar.gz
182+
wget -O - $URL | tar -xz -C ~/.cargo/bin
183+
cross --version
183184
- uses: Swatinem/rust-cache@v2
184185
- name: Build Tests
185186
run: cross test --no-run --target=${{ matrix.target }} --features=std
186187

187188
web-tests:
188189
name: Web Test
189-
runs-on: ubuntu-latest
190+
strategy:
191+
fail-fast: false
192+
matrix:
193+
include:
194+
- os: ubuntu-latest
195+
target: x86_64-unknown-linux-musl
196+
- os: windows-latest
197+
target: x86_64-pc-windows-msvc
198+
# Reenable when Safari tests start working
199+
# - os: macos-12
200+
# target: x86_64-apple-darwin
201+
runs-on: ${{ matrix.os }}
190202
steps:
191203
- uses: actions/checkout@v3
192204
- uses: dtolnay/rust-toolchain@stable
193-
with:
194-
targets: wasm32-unknown-unknown
195-
- name: Install precompiled wasm-bindgen-test-runner
205+
- run: choco install wget
206+
if: matrix.os == 'windows-latest'
207+
- name: Install precompiled wasm-pack
208+
shell: bash
196209
run: |
197-
export VERSION=$(cargo metadata --format-version=1 | jq -r '.packages[] | select ( .name == "wasm-bindgen" ) | .version')
198-
wget -O /tmp/binaries.tar.gz https://github.com/rustwasm/wasm-bindgen/releases/download/$VERSION/wasm-bindgen-$VERSION-x86_64-unknown-linux-musl.tar.gz
199-
tar -C /tmp -xzf /tmp/binaries.tar.gz --strip-components=1
200-
mv /tmp/wasm-bindgen-test-runner ~/.cargo/bin
210+
VERSION=v0.10.3
211+
URL=https://github.com/rustwasm/wasm-pack/releases/download/${VERSION}/wasm-pack-${VERSION}-${{ matrix.target }}.tar.gz
212+
wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
213+
wasm-pack --version
201214
- uses: Swatinem/rust-cache@v2
202215
- name: Test (Node)
203-
run: cargo test --target=wasm32-unknown-unknown --features=js
216+
run: wasm-pack test --node --features=js
204217
- name: Test (Firefox)
205-
env:
206-
GECKODRIVER: /usr/bin/geckodriver
207-
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
218+
run: wasm-pack test --headless --firefox --features=js,test-in-browser
208219
- name: Test (Chrome)
209-
env:
210-
CHROMEDRIVER: /usr/bin/chromedriver
211-
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
220+
run: wasm-pack test --headless --chrome --features=js,test-in-browser
221+
- name: Test (Edge)
222+
if: matrix.os == 'windows-latest'
223+
run: wasm-pack test --headless --chrome --chromedriver $Env:EDGEWEBDRIVER\msedgedriver.exe --features=js,test-in-browser
224+
# Safari tests are broken: https://github.com/rustwasm/wasm-bindgen/issues/3004
225+
# - name: Test (Safari)
226+
# if: matrix.os == 'macos-12'
227+
# run: wasm-pack test --headless --safari --features=js,test-in-browser
212228
- name: Test (custom getrandom)
213-
run: cargo test --target=wasm32-unknown-unknown --features=custom
229+
run: wasm-pack test --node --features=custom
214230

215231
wasm64-tests:
216232
name: wasm64 Build/Link
@@ -237,10 +253,10 @@ jobs:
237253
targets: wasm32-wasi
238254
- name: Install precompiled wasmtime
239255
run: |
240-
export URL=$(curl -s https://api.github.com/repos/bytecodealliance/wasmtime/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-linux.tar.xz")) | .browser_download_url')
241-
wget -O /tmp/binaries.tar.xz $URL
242-
tar -C /tmp -xf /tmp/binaries.tar.xz --strip-components=1
243-
mv /tmp/wasmtime ~/.cargo/bin
256+
VERSION=v2.0.0
257+
URL=https://github.com/bytecodealliance/wasmtime/releases/download/${VERSION}/wasmtime-${VERSION}-x86_64-linux.tar.xz
258+
wget -O - $URL | tar -xJ --strip-components=1 -C ~/.cargo/bin
259+
wasmtime --version
244260
- uses: Swatinem/rust-cache@v2
245261
- run: cargo test --target wasm32-wasi
246262

0 commit comments

Comments
 (0)