Test #1728
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: master | |
pull_request: | |
branches: master | |
schedule: | |
- cron: "0 12 * * 1" | |
permissions: | |
contents: read | |
env: | |
CARGO_INCREMENTAL: 0 | |
RUSTFLAGS: "-Dwarnings" | |
jobs: | |
tier1: | |
name: Tier 1 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-24.04, windows-2022] | |
toolchain: [nightly, beta, stable, "1.63"] | |
# Only Test macOS on stable to reduce macOS CI jobs | |
include: | |
# aarch64-apple-darwin. | |
- os: macos-14 | |
toolchain: stable | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test | |
# Make sure enabling the std feature doesn't break anything | |
- run: cargo test --features=std | |
- if: ${{ matrix.toolchain == 'nightly' }} | |
run: cargo test --benches | |
linux: | |
name: Linux | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
target: [x86_64-unknown-linux-musl, i686-unknown-linux-musl] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test --target=${{ matrix.target }} --features=std | |
- env: | |
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_getrandom" | |
run: cargo test --target=${{ matrix.target }} --features=std | |
- env: | |
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_rustix" | |
run: cargo test --target=${{ matrix.target }} --features=std | |
- env: | |
RUSTFLAGS: -Dwarnings --cfg getrandom_test_linux_fallback | |
run: cargo test --features=std | |
- env: | |
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand" | |
run: cargo test --features=std | |
ios: | |
name: iOS Simulator | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
targets: aarch64-apple-ios-sim | |
- name: Install precompiled cargo-dinghy | |
run: | | |
VERSION=0.7.2 | |
URL="https://github.com/sonos/dinghy/releases/download/${VERSION}/cargo-dinghy-macos-${VERSION}.tgz" | |
wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin | |
- name: Check cargo-dinghy version. | |
run: cargo dinghy --version | |
- name: Setup Simulator | |
# Use the first installed iOS runtime and the first (i.e. oldest) supported iPhone device. | |
run: | | |
RUNTIME=$(xcrun simctl list runtimes --json | jq '.runtimes | map(select(.name | contains("iOS"))) | .[0]') | |
RUNTIME_ID=$(echo $RUNTIME | jq -r '.identifier') | |
echo "Using runtime:" $RUNTIME_ID | |
DEVICE_ID=$(echo $RUNTIME | jq -r '.supportedDeviceTypes | map(select(.productFamily == "iPhone")) | .[0].identifier') | |
echo "Using device:" $DEVICE_ID | |
SIM_ID=$(xcrun simctl create Test-iPhone $DEVICE_ID $RUNTIME_ID) | |
echo "Created simulator:" $SIM_ID | |
xcrun simctl boot $SIM_ID | |
echo "device=$SIM_ID" >> $GITHUB_ENV | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run tests | |
run: cargo dinghy -p auto-ios-aarch64-sim -d ${{ env.device }} test | |
windows: | |
name: Windows | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
toolchain: [ | |
stable-x86_64-gnu, | |
stable-i686-gnu, | |
stable-i686-msvc, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test --features=std | |
windows7: | |
name: Windows 7 (on Windows 10) | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
# Win7 targets are Tier3, so pin a nightly where libstd builds. | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-05-20 | |
components: rust-src | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test --target=x86_64-win7-windows-msvc -Z build-std --features=std | |
- run: cargo test --target=i686-win7-windows-msvc -Z build-std --features=std | |
sanitizer: | |
name: Sanitizer | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-10-08 | |
components: rust-src | |
- env: | |
RUSTFLAGS: -Dwarnings -Zsanitizer=memory | |
RUSTDOCFLAGS: -Dwarnings -Zsanitizer=memory | |
run: cargo test -Zbuild-std --target=x86_64-unknown-linux-gnu | |
cross: | |
name: Cross | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
target: [ | |
aarch64-unknown-linux-gnu, | |
# TODO: add Android tests back when the cross cuts a new release. | |
# See: https://github.com/cross-rs/cross/issues/1222 | |
# aarch64-linux-android, | |
powerpc-unknown-linux-gnu, | |
wasm32-unknown-emscripten, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install precompiled cross | |
run: | | |
VERSION=v0.2.5 | |
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 | |
- name: Test | |
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std | |
freebsd: | |
name: FreeBSD VM | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Test in FreeBSD | |
uses: vmactions/freebsd-vm@v1 | |
with: | |
envs: 'RUSTFLAGS' | |
usesh: true | |
prepare: | | |
pkg install -y rust | |
run: cargo test | |
openbsd: | |
name: OpenBSD VM | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Test in OpenBSD | |
uses: vmactions/openbsd-vm@v1 | |
with: | |
envs: 'RUSTFLAGS' | |
usesh: true | |
prepare: | | |
pkg_add rust | |
run: cargo test | |
netbsd: | |
name: NetBSD VM | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Test in NetBSD | |
uses: vmactions/netbsd-vm@v1 | |
with: | |
envs: 'RUSTFLAGS' | |
usesh: true | |
prepare: | | |
/usr/sbin/pkg_add rust | |
run: | | |
cargo test | |
RUSTFLAGS="--cfg getrandom_test_netbsd_fallback -D warnings" cargo test | |
# This job currently fails: | |
# https://github.com/rust-random/getrandom/actions/runs/11405005618/job/31735653874?pr=528 | |
# dragonflybsd: | |
# name: DragonflyBSD VM | |
# runs-on: ubuntu-24.04 | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Test in DragonflyBSD | |
# uses: vmactions/dragonflybsd-vm@v1 | |
# with: | |
# envs: 'RUSTFLAGS' | |
# usesh: true | |
# prepare: | | |
# pkg install -y rust | |
# run: cargo test | |
web: | |
name: ${{ matrix.rust.description }} | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: | |
- { | |
description: Web, | |
version: stable, | |
flags: -Dwarnings --cfg getrandom_backend="wasm_js", | |
args: --features=std, | |
} | |
- { | |
description: Web with Atomics, | |
version: nightly, | |
components: rust-src, | |
flags: '-Dwarnings --cfg getrandom_backend="wasm_js" -Ctarget-feature=+atomics,+bulk-memory', | |
args: '--features=std -Zbuild-std=panic_abort,std', | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust.version }} | |
components: ${{ matrix.rust.components }} | |
- name: Install precompiled wasm-pack | |
shell: bash | |
run: | | |
VERSION=v0.13.1 | |
URL=https://github.com/rustwasm/wasm-pack/releases/download/${VERSION}/wasm-pack-${VERSION}-x86_64-unknown-linux-musl.tar.gz | |
wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin | |
wasm-pack --version | |
- uses: Swatinem/rust-cache@v2 | |
- name: Test (Node) | |
env: | |
RUSTFLAGS: ${{ matrix.rust.flags }} | |
run: wasm-pack test --node -- ${{ matrix.rust.args }} | |
- name: Test (Firefox) | |
env: | |
WASM_BINDGEN_USE_BROWSER: 1 | |
RUSTFLAGS: ${{ matrix.rust.flags }} | |
run: wasm-pack test --headless --firefox -- ${{ matrix.rust.args }} | |
- name: Test (Chrome) | |
env: | |
WASM_BINDGEN_USE_BROWSER: 1 | |
RUSTFLAGS: ${{ matrix.rust.flags }} | |
run: wasm-pack test --headless --chrome -- ${{ matrix.rust.args }} | |
- name: Test (dedicated worker) | |
env: | |
WASM_BINDGEN_USE_DEDICATED_WORKER: 1 | |
RUSTFLAGS: ${{ matrix.rust.flags }} | |
run: wasm-pack test --headless --firefox -- ${{ matrix.rust.args }} | |
- name: Test (shared worker) | |
env: | |
WASM_BINDGEN_USE_SHARED_WORKER: 1 | |
RUSTFLAGS: ${{ matrix.rust.flags }} | |
run: wasm-pack test --headless --firefox -- ${{ matrix.rust.args }} | |
- name: Test (service worker) | |
env: | |
WASM_BINDGEN_USE_SERVICE_WORKER: 1 | |
RUSTFLAGS: ${{ matrix.rust.flags }} | |
# Firefox doesn't support module service workers and therefor can't import scripts | |
run: wasm-pack test --headless --chrome -- ${{ matrix.rust.args }} | |
wasi: | |
name: WASI | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.82 | |
targets: wasm32-wasip1,wasm32-wasip2 | |
- name: Install Wasmtime | |
run: | | |
VERSION=v24.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 | |
- name: WASI 0.1 Test | |
run: cargo test --target wasm32-wasip1 | |
- name: WASI 0.2 Test | |
run: cargo test --target wasm32-wasip2 |