Implement no_std
support
#72
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: ["main"] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-test: | |
name: | |
${{ matrix.rust.pre_description }} ${{ matrix.driver.description }} ${{ | |
matrix.rust.post_description }} ${{ matrix.features.description }} | |
runs-on: ${{ matrix.driver.os }} | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
driver: | |
- { | |
os: ubuntu-latest, | |
description: Chrome, | |
default: true, | |
name: CHROMEDRIVER, | |
value: chromedriver, | |
} | |
- { os: ubuntu-latest, description: Firefox, name: GECKODRIVER, value: geckodriver } | |
- { os: macos-latest, description: Safari, name: SAFARIDRIVER, value: safaridriver } | |
rust: | |
- { version: stable, pre_description: Build & Test, msrv: false } | |
- { | |
version: nightly, | |
pre_description: Build & Test, | |
post_description: with Atomics, | |
msrv: false, | |
component: --component rust-src, | |
flags: "-Ctarget-feature=+atomics,+bulk-memory", | |
args: "-Zbuild-std=panic_abort,std", | |
} | |
target: | |
- { target: wasm32-unknown-unknown, native: false, docargs: -Zdoctest-xcompile } | |
features: | |
- { features: "" } | |
- { features: --all-features, description: (all features) } | |
include: | |
- driver: { os: ubuntu-latest, description: Web, default: true } | |
rust: { version: "1.60", pre_description: Build, post_description: MSRV, msrv: true } | |
target: { target: wasm32-unknown-unknown, native: false } | |
features: { features: "" } | |
- driver: { os: ubuntu-latest, description: Native } | |
rust: { version: "1.60", pre_description: Build, post_description: MSRV, msrv: true } | |
target: { target: x86_64-unknown-linux-gnu, native: true } | |
features: { features: "" } | |
- driver: { os: ubuntu-latest, description: Native } | |
rust: { version: stable, pre_description: Build & Test, msrv: false } | |
target: { target: x86_64-unknown-linux-gnu, native: true } | |
features: { features: "" } | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install `wasm-bindgen-cli` | |
uses: taiki-e/cache-cargo-install-action@v2 | |
with: | |
tool: wasm-bindgen-cli | |
git: https://github.com/daxpedda/wasm-bindgen | |
rev: 480a246aef12c59b26c3335a716e6940b369aeb7 | |
- name: Install Rust | |
run: | | |
rustup toolchain install ${{ matrix.rust.version }} --profile minimal ${{ matrix.rust.component }} --target ${{ matrix.target.target }} | |
rustup default ${{ matrix.rust.version }} | |
- name: Fix MSRV dependencies | |
if: matrix.rust.msrv == true | |
run: | | |
cargo update -p bumpalo --precise 3.14.0 | |
cargo update -p serde --precise 1.0.210 | |
cargo update -p syn --precise 2.0.67 | |
- name: Build | |
if: matrix.driver.default == true || matrix.target.native == true | |
env: | |
RUSTFLAGS: ${{ matrix.rust.flags }} | |
run: | |
cargo build ${{ matrix.features.features }} --target ${{ matrix.target.target }} ${{ | |
matrix.rust.args }} | |
- name: Documentation | |
if: matrix.driver.default == true || matrix.target.native == true | |
env: | |
RUSTDOCFLAGS: ${{ matrix.rust.flags }} | |
RUSTFLAGS: ${{ matrix.rust.flags }} | |
run: | |
cargo doc --no-deps ${{ matrix.features.features }} --target ${{ matrix.target.target }} | |
${{ matrix.rust.args }} | |
- name: Set Driver | |
if: matrix.rust.msrv == false && matrix.target.native == false | |
run: echo "${{ matrix.driver.name }}=${{ matrix.driver.value }}" >> $GITHUB_ENV | |
- name: Test | |
if: matrix.rust.msrv == false | |
run: | |
cargo test ${{ matrix.features.features }} --all-targets --no-fail-fast --target ${{ | |
matrix.target.target }} ${{ matrix.rust.args }} | |
- name: Switch to nightly Rust for Wasm documentation tests | |
if: | |
matrix.rust.msrv == false && matrix.target.native == false && matrix.rust.version != | |
'nightly' | |
run: | | |
rustup toolchain install nightly --profile minimal --target ${{ matrix.target.target }} | |
rustup default nightly | |
- name: Documentation Test | |
if: matrix.rust.msrv == false | |
run: | |
cargo test ${{ matrix.features.features }} --doc --no-fail-fast --target ${{ | |
matrix.target.target }} ${{ matrix.rust.args }} ${{ matrix.target.docargs }} | |
minimal-versions: | |
name: | |
Minimal Versions ${{ matrix.target.description }} ${{ matrix.rust.description }} ${{ | |
matrix.features.description }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: minimal-versions | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: | |
- { version: "1.60", description: MSRV } | |
- { version: stable } | |
target: | |
- { target: x86_64-unknown-linux-gnu, description: Native } | |
- { target: wasm32-unknown-unknown, description: Web } | |
features: | |
- { features: "" } | |
- { features: --all-features, description: (all features) } | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
run: | | |
rustup toolchain install ${{ matrix.rust.version }} --profile minimal --target ${{ matrix.target.target }} | |
rustup default ${{ matrix.rust.version }} | |
- name: Install Rust nightly | |
run: rustup toolchain install nightly --profile minimal | |
- name: Build | |
run: | | |
cargo +nightly update -Z minimal-versions | |
cargo build ${{ matrix.features.features }} --target ${{ matrix.target.target }} |