CI #135
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: CI | |
permissions: | |
contents: read | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 2 * * 0' | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
CARGO_NET_RETRY: 10 | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
RUSTFLAGS: -D warnings | |
RUSTDOCFLAGS: -D warnings | |
RUSTUP_MAX_RETRIES: 10 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- rust: stable | |
- rust: beta | |
- rust: nightly | |
- rust: nightly | |
target: i686-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} | |
- run: rustup target add wasm32-unknown-unknown | |
- name: Install cross-compilation tools | |
uses: taiki-e/setup-cross-toolchain-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
if: matrix.target != '' | |
- name: Install WASM Test Tools | |
uses: taiki-e/install-action@wasm-pack | |
- run: cargo build --all --all-features --all-targets | |
- run: cargo test --all | |
- run: cargo test --all --release | |
- run: cargo test --no-default-features --tests | |
- run: cargo test --no-default-features --tests --release | |
- run: cargo build -p event-listener-strategy --no-default-features | |
- name: Install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
- run: rustup target add thumbv7m-none-eabi | |
- name: Run cargo check (without dev-dependencies to catch missing feature flags) | |
run: cargo hack build --all --no-dev-deps | |
- run: cargo hack build --all --target thumbv7m-none-eabi --no-default-features --no-dev-deps | |
- name: Run cargo check for WASM | |
run: cargo check --all --all-features --all-targets --target wasm32-unknown-unknown | |
- name: Test WASM | |
run: wasm-pack test --headless --chrome | |
msrv: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# When updating this, the reminder to update the minimum supported | |
# Rust version in Cargo.toml. | |
rust: ['1.60'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
- run: cargo hack build --all --rust-version | |
- run: cargo hack build --all --no-default-features --rust-version | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update stable | |
- run: cargo clippy --all --all-features --all-targets | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update stable | |
- run: cargo fmt --all --check | |
miri: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup toolchain install nightly --component miri && rustup default nightly | |
- run: | | |
echo "MIRIFLAGS=-Zmiri-strict-provenance -Zmiri-symbolic-alignment-check -Zmiri-disable-isolation" >>"${GITHUB_ENV}" | |
echo "RUSTFLAGS=${RUSTFLAGS} -Z randomize-layout" >>"${GITHUB_ENV}" | |
- run: cargo miri test --all | |
- run: cargo miri test --no-default-features --tests | |
security_audit: | |
permissions: | |
checks: write | |
contents: read | |
issues: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# rustsec/audit-check used to do this automatically | |
- name: Generate Cargo.lock | |
run: cargo generate-lockfile | |
# https://github.com/rustsec/audit-check/issues/2 | |
- uses: rustsec/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} |