Merge pull request #321 from rust-random/webtest

CI: Add Web Tests for Edge on Windows
This commit is contained in:
Joseph Richey 2022-10-26 01:23:35 -07:00 committed by GitHub
commit c93c2603f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,10 +21,11 @@ jobs:
- uses: dtolnay/rust-toolchain@nightly # Needed for -Z minimal-versions and doc_cfg
- name: Install precompiled cargo-deadlinks
run: |
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')
wget -O /tmp/cargo-deadlinks $URL
chmod +x /tmp/cargo-deadlinks
mv /tmp/cargo-deadlinks ~/.cargo/bin
VERSION=0.8.1
URL="https://github.com/deadlinks/cargo-deadlinks/releases/download/${VERSION}/cargo-deadlinks-linux"
wget -O ~/.cargo/bin/cargo-deadlinks $URL
chmod +x ~/.cargo/bin/cargo-deadlinks
cargo deadlinks --version
- uses: Swatinem/rust-cache@v2
- name: Generate Docs
env:
@ -90,11 +91,11 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-ios
- name: Download cargo-dinghy
- name: Install precompiled cargo-dinghy
run: |
VERSION=0.6.2
URL="https://github.com/sonos/dinghy/releases/download/${VERSION}/cargo-dinghy-macos-${VERSION}.tgz"
curl -L $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
cargo dinghy --version
- name: Setup Simulator
run: |
@ -139,10 +140,10 @@ jobs:
- uses: actions/checkout@v3
- name: Install precompiled cross
run: |
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')
wget -O /tmp/binaries.tar.gz $URL
tar -C /tmp -xzf /tmp/binaries.tar.gz
mv /tmp/cross ~/.cargo/bin
VERSION=v0.2.4
URL=https://github.com/cross-rs/cross/releases/download/${VERSION}/cross-x86_64-unknown-linux-gnu.tar.gz
wget -O - $URL | tar -xz -C ~/.cargo/bin
cross --version
- uses: Swatinem/rust-cache@v2
- name: Test
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std
@ -176,41 +177,56 @@ jobs:
- uses: actions/checkout@v3
- name: Install precompiled cross
run: |
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')
wget -O /tmp/binaries.tar.gz $URL
tar -C /tmp -xzf /tmp/binaries.tar.gz
mv /tmp/cross ~/.cargo/bin
VERSION=v0.2.4
URL=https://github.com/cross-rs/cross/releases/download/${VERSION}/cross-x86_64-unknown-linux-gnu.tar.gz
wget -O - $URL | tar -xz -C ~/.cargo/bin
cross --version
- uses: Swatinem/rust-cache@v2
- name: Build Tests
run: cross test --no-run --target=${{ matrix.target }} --features=std
web-tests:
name: Web Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: windows-latest
target: x86_64-pc-windows-msvc
# Reenable when Safari tests start working
# - os: macos-12
# target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install precompiled wasm-bindgen-test-runner
- run: choco install wget
if: matrix.os == 'windows-latest'
- name: Install precompiled wasm-pack
shell: bash
run: |
export VERSION=$(cargo metadata --format-version=1 | jq -r '.packages[] | select ( .name == "wasm-bindgen" ) | .version')
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
tar -C /tmp -xzf /tmp/binaries.tar.gz --strip-components=1
mv /tmp/wasm-bindgen-test-runner ~/.cargo/bin
VERSION=v0.10.3
URL=https://github.com/rustwasm/wasm-pack/releases/download/${VERSION}/wasm-pack-${VERSION}-${{ matrix.target }}.tar.gz
wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
wasm-pack --version
- uses: Swatinem/rust-cache@v2
- name: Test (Node)
run: cargo test --target=wasm32-unknown-unknown --features=js
run: wasm-pack test --node --features=js
- name: Test (Firefox)
env:
GECKODRIVER: /usr/bin/geckodriver
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
run: wasm-pack test --headless --firefox --features=js,test-in-browser
- name: Test (Chrome)
env:
CHROMEDRIVER: /usr/bin/chromedriver
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
run: wasm-pack test --headless --chrome --features=js,test-in-browser
- name: Test (Edge)
if: matrix.os == 'windows-latest'
run: wasm-pack test --headless --chrome --chromedriver $Env:EDGEWEBDRIVER\msedgedriver.exe --features=js,test-in-browser
# Safari tests are broken: https://github.com/rustwasm/wasm-bindgen/issues/3004
# - name: Test (Safari)
# if: matrix.os == 'macos-12'
# run: wasm-pack test --headless --safari --features=js,test-in-browser
- name: Test (custom getrandom)
run: cargo test --target=wasm32-unknown-unknown --features=custom
run: wasm-pack test --node --features=custom
wasm64-tests:
name: wasm64 Build/Link
@ -237,10 +253,10 @@ jobs:
targets: wasm32-wasi
- name: Install precompiled wasmtime
run: |
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')
wget -O /tmp/binaries.tar.xz $URL
tar -C /tmp -xf /tmp/binaries.tar.xz --strip-components=1
mv /tmp/wasmtime ~/.cargo/bin
VERSION=v2.0.0
URL=https://github.com/bytecodealliance/wasmtime/releases/download/${VERSION}/wasmtime-${VERSION}-x86_64-linux.tar.xz
wget -O - $URL | tar -xJ --strip-components=1 -C ~/.cargo/bin
wasmtime --version
- uses: Swatinem/rust-cache@v2
- run: cargo test --target wasm32-wasi