2020-12-14 21:50:24 +00:00
|
|
|
name: Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: master
|
|
|
|
pull_request:
|
|
|
|
branches: master
|
|
|
|
schedule:
|
|
|
|
- cron: "0 12 * * 1"
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
RUSTFLAGS: "-Dwarnings"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check-doc:
|
2021-01-03 05:58:33 -08:00
|
|
|
name: Docs, deadlinks, minimal dependencies
|
2020-12-14 21:50:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-01-03 05:58:33 -08:00
|
|
|
- uses: actions-rs/toolchain@v1
|
2020-12-14 21:50:24 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
2021-01-19 02:46:38 -08:00
|
|
|
toolchain: nightly # Needed for -Z minimal-versions and doc_cfg
|
2020-12-14 21:50:24 +00:00
|
|
|
override: true
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2021-01-03 21:26:32 -08:00
|
|
|
- name: Install precompiled cargo-deadlinks
|
2021-01-03 05:58:33 -08:00
|
|
|
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
|
2021-01-19 02:46:38 -08:00
|
|
|
- name: Generate Docs
|
|
|
|
env:
|
|
|
|
RUSTDOCFLAGS: --cfg docsrs
|
|
|
|
run: cargo deadlinks -- --features=custom,std
|
2021-01-03 05:58:33 -08:00
|
|
|
- run: |
|
|
|
|
cargo generate-lockfile -Z minimal-versions
|
|
|
|
cargo test --features=custom,std
|
2020-12-14 21:50:24 +00:00
|
|
|
|
|
|
|
main-tests:
|
|
|
|
name: Main tests
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-01-03 15:32:36 -08:00
|
|
|
os: [ubuntu-latest, windows-latest]
|
2022-10-20 19:09:20 -07:00
|
|
|
toolchain: [nightly, beta, stable, 1.36]
|
2021-01-03 15:32:36 -08:00
|
|
|
# Only Test macOS on stable to reduce macOS CI jobs
|
|
|
|
include:
|
|
|
|
- os: macos-latest
|
|
|
|
toolchain: stable
|
2020-12-14 21:50:24 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-01-03 05:58:33 -08:00
|
|
|
- uses: actions-rs/toolchain@v1
|
2020-12-14 21:50:24 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
override: true
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2020-12-14 21:50:24 +00:00
|
|
|
- run: cargo test
|
2021-01-03 05:58:33 -08:00
|
|
|
- run: cargo test --features=std
|
2021-01-03 21:26:32 -08:00
|
|
|
- run: cargo test --features=custom # custom should do nothing here
|
2020-12-14 21:50:24 +00:00
|
|
|
- if: ${{ matrix.toolchain == 'nightly' }}
|
|
|
|
run: cargo build --benches
|
|
|
|
|
|
|
|
linux-tests:
|
|
|
|
name: Additional Linux targets
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target: [
|
|
|
|
x86_64-unknown-linux-musl,
|
|
|
|
i686-unknown-linux-gnu,
|
|
|
|
i686-unknown-linux-musl,
|
|
|
|
]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-01-03 05:58:33 -08:00
|
|
|
- uses: actions-rs/toolchain@v1
|
2020-12-14 21:50:24 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
toolchain: stable
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2021-01-03 05:58:33 -08:00
|
|
|
- name: Install multilib
|
|
|
|
# update is needed to fix the 404 error on install, see:
|
|
|
|
# https://github.com/actions/virtual-environments/issues/675
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install gcc-multilib
|
|
|
|
- run: cargo test --target=${{ matrix.target }} --features=std
|
|
|
|
|
|
|
|
# We can only Build/Link on these targets for now.
|
|
|
|
# TODO: Run the iOS binaries in the simulator
|
|
|
|
# TODO: build/run aarch64-apple-darwin binaries on a x86_64 Mac
|
|
|
|
apple-tests:
|
|
|
|
name: Additional Apple targets
|
|
|
|
runs-on: macos-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target: [
|
|
|
|
aarch64-apple-ios,
|
|
|
|
x86_64-apple-ios,
|
|
|
|
]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
toolchain: stable
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2021-01-03 05:58:33 -08:00
|
|
|
- name: Build Tests
|
|
|
|
run: cargo test --no-run --target=${{ matrix.target }} --features=std
|
2020-12-14 21:50:24 +00:00
|
|
|
|
|
|
|
windows-tests:
|
|
|
|
name: Additional Windows targets
|
|
|
|
runs-on: windows-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
toolchain: [
|
|
|
|
stable-x86_64-gnu,
|
|
|
|
stable-i686-gnu,
|
|
|
|
stable-i686-msvc,
|
|
|
|
]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
override: true
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2021-01-03 05:58:33 -08:00
|
|
|
- run: cargo test --features=std
|
2020-12-14 21:50:24 +00:00
|
|
|
|
|
|
|
cross-tests:
|
2021-01-03 05:58:33 -08:00
|
|
|
name: Cross Test
|
|
|
|
runs-on: ubuntu-latest
|
2020-12-14 21:50:24 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-01-03 05:58:33 -08:00
|
|
|
target: [
|
|
|
|
aarch64-unknown-linux-gnu,
|
|
|
|
aarch64-linux-android,
|
|
|
|
mips-unknown-linux-gnu,
|
2022-10-22 13:23:49 -07:00
|
|
|
wasm32-unknown-emscripten,
|
2021-01-03 05:58:33 -08:00
|
|
|
]
|
2020-12-14 21:50:24 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-01-03 05:58:33 -08:00
|
|
|
- uses: actions-rs/toolchain@v1
|
2020-12-14 21:50:24 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
target: ${{ matrix.target }}
|
2021-01-03 05:58:33 -08:00
|
|
|
toolchain: stable
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2021-01-03 21:26:32 -08:00
|
|
|
- name: Install precompiled cross
|
2021-01-03 05:58:33 -08:00
|
|
|
run: |
|
2022-01-29 18:48:38 +03:00
|
|
|
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')
|
2021-01-03 05:58:33 -08:00
|
|
|
wget -O /tmp/binaries.tar.gz $URL
|
|
|
|
tar -C /tmp -xzf /tmp/binaries.tar.gz
|
|
|
|
mv /tmp/cross ~/.cargo/bin
|
2020-12-14 21:50:24 +00:00
|
|
|
- name: Test
|
2021-01-03 05:58:33 -08:00
|
|
|
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std
|
2020-12-14 21:50:24 +00:00
|
|
|
|
2021-01-03 05:58:33 -08:00
|
|
|
cross-link:
|
|
|
|
name: Cross Build/Link
|
2020-12-14 21:50:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target: [
|
2022-10-22 13:22:38 -07:00
|
|
|
sparcv9-sun-solaris,
|
|
|
|
x86_64-unknown-illumos,
|
|
|
|
x86_64-unknown-freebsd,
|
2021-01-03 05:58:33 -08:00
|
|
|
x86_64-unknown-netbsd,
|
|
|
|
]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
toolchain: stable
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2021-01-03 21:26:32 -08:00
|
|
|
- name: Install precompiled cross
|
2021-01-03 05:58:33 -08:00
|
|
|
run: |
|
2022-01-29 18:48:38 +03:00
|
|
|
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')
|
2021-01-03 05:58:33 -08:00
|
|
|
wget -O /tmp/binaries.tar.gz $URL
|
|
|
|
tar -C /tmp -xzf /tmp/binaries.tar.gz
|
|
|
|
mv /tmp/cross ~/.cargo/bin
|
|
|
|
- name: Build Tests
|
|
|
|
run: cross test --no-run --target=${{ matrix.target }} --features=std
|
|
|
|
|
|
|
|
web-tests:
|
|
|
|
name: Web tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
target: wasm32-unknown-unknown
|
|
|
|
toolchain: stable
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2021-01-03 21:26:32 -08:00
|
|
|
- name: Install precompiled wasm-bindgen-test-runner
|
2021-01-03 05:58:33 -08:00
|
|
|
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
|
|
|
|
- name: Test (Node)
|
|
|
|
run: cargo test --target=wasm32-unknown-unknown --features=js
|
|
|
|
- name: Test (Firefox)
|
|
|
|
env:
|
|
|
|
GECKODRIVER: /usr/bin/geckodriver
|
|
|
|
run: cargo test --target=wasm32-unknown-unknown --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
|
2021-01-05 02:00:21 -08:00
|
|
|
- name: Test (custom getrandom)
|
|
|
|
run: cargo test --target=wasm32-unknown-unknown --features=custom
|
2021-01-03 05:58:33 -08:00
|
|
|
|
|
|
|
wasi-tests:
|
|
|
|
name: WASI test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
target: wasm32-wasi
|
|
|
|
toolchain: stable
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2021-01-03 21:26:32 -08:00
|
|
|
- name: Install precompiled wasmtime
|
2021-01-03 05:58:33 -08:00
|
|
|
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
|
|
|
|
- run: cargo test --target wasm32-wasi
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build only
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target: [
|
2020-12-14 21:50:24 +00:00
|
|
|
x86_64-fuchsia,
|
|
|
|
x86_64-unknown-redox,
|
|
|
|
x86_64-fortanix-unknown-sgx,
|
|
|
|
]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-01-03 05:58:33 -08:00
|
|
|
- uses: actions-rs/toolchain@v1
|
2020-12-14 21:50:24 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
target: ${{ matrix.target }}
|
2022-10-22 13:22:38 -07:00
|
|
|
toolchain: stable
|
2020-12-14 21:50:24 +00:00
|
|
|
override: true
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2020-12-14 21:50:24 +00:00
|
|
|
- name: Build
|
2021-01-03 05:58:33 -08:00
|
|
|
run: cargo build --target=${{ matrix.target }} --features=std
|
2020-12-14 21:50:24 +00:00
|
|
|
|
2021-01-03 05:58:33 -08:00
|
|
|
build-std:
|
|
|
|
name: Build-only (build-std)
|
2020-12-14 21:50:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2021-01-03 05:58:33 -08:00
|
|
|
toolchain: nightly # Required to build libcore
|
2020-12-14 21:50:24 +00:00
|
|
|
components: rust-src
|
|
|
|
override: true
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2021-12-07 22:48:30 +08:00
|
|
|
- name: Hermit (x86-64 only)
|
|
|
|
run: cargo build -Z build-std=core --target=x86_64-unknown-hermit
|
2021-01-03 05:58:33 -08:00
|
|
|
- name: UEFI (RDRAND)
|
2021-01-02 19:31:22 -08:00
|
|
|
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-uefi
|
2021-01-03 05:58:33 -08:00
|
|
|
- name: L4Re (RDRAND)
|
2021-01-02 19:31:22 -08:00
|
|
|
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-l4re-uclibc
|
2020-12-14 21:50:24 +00:00
|
|
|
- name: VxWorks
|
2021-01-03 05:58:33 -08:00
|
|
|
run: cargo build -Z build-std=core --target=x86_64-wrs-vxworks
|
2021-11-30 09:21:36 +09:00
|
|
|
- name: SOLID
|
|
|
|
run: cargo build -Z build-std=core --target=aarch64-kmc-solid_asp3
|
2022-03-25 09:26:05 -07:00
|
|
|
- name: Nintendo 3DS
|
|
|
|
run: cargo build -Z build-std=core --target=armv6k-nintendo-3ds
|
2022-10-22 13:22:38 -07:00
|
|
|
- name: RISC-V ESP-IDF
|
|
|
|
run: cargo build -Z build-std=core --target=riscv32imc-esp-espidf
|
|
|
|
- name: OpenBSD
|
|
|
|
run: cargo build -Z build-std=std --target=x86_64-unknown-openbsd --features=std
|
|
|
|
- name: Dragonfly BSD
|
|
|
|
run: cargo build -Z build-std=std --target=x86_64-unknown-dragonfly --features=std
|
|
|
|
- name: Haiku OS
|
|
|
|
run: cargo build -Z build-std=std --target=x86_64-unknown-haiku --features=std
|
2020-12-14 21:50:24 +00:00
|
|
|
|
|
|
|
clippy-fmt:
|
|
|
|
name: Clippy + rustfmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2021-01-02 19:50:16 -08:00
|
|
|
# https://github.com/rust-lang/rust-clippy/pull/6379 added MSRV
|
|
|
|
# support, so we need to use nightly until this is on stable.
|
|
|
|
toolchain: nightly
|
2020-12-14 21:50:24 +00:00
|
|
|
components: rustfmt, clippy
|
2021-01-02 19:50:16 -08:00
|
|
|
override: true
|
2021-01-14 02:48:46 -08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2020-12-14 21:50:24 +00:00
|
|
|
- name: clippy
|
2021-01-03 05:58:33 -08:00
|
|
|
run: cargo clippy --all --features=custom,std
|
2020-12-14 21:50:24 +00:00
|
|
|
- name: fmt
|
|
|
|
run: cargo fmt --all -- --check
|