CI #624
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 | |
on: | |
pull_request: | |
push: | |
schedule: | |
- cron: '29 1 * * *' # *-*-* 01:29:00 UTC | |
permissions: | |
contents: read | |
env: | |
RUST_BACKTRACE: full | |
RUSTFLAGS: -Dwarnings | |
jobs: | |
test: | |
timeout-minutes: 45 | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: [nightly, beta, stable] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
name: Test ${{ matrix.rust }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: rust-analyzer | |
- name: Install cargo-hack | |
# Always use stable rustc to compile cargo-hack, which has MSRV 1.65. | |
# https://github.com/taiki-e/cargo-hack/commit/5baa4262710414ebde4845494f1db22643acc0ba | |
run: cargo +stable install cargo-hack | |
# `cargo build` doesn't pull in [dev-dependencies]. | |
- name: Build | |
run: cargo hack build --each-feature | |
- name: Doc test | |
run: cargo hack test --each-feature --doc | |
- name: Test | |
run: cargo hack test --each-feature --all-targets | |
- name: Test examples | |
run: cargo test --all-features --examples -- --ignored | |
msrv: | |
timeout-minutes: 15 | |
name: MSRV | |
strategy: | |
fail-fast: false | |
matrix: | |
# FIXME: MacOS' `sed` is incompatible with `gnused`. | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
# Sync with Cargo.toml! | |
toolchain: "1.64" | |
components: rust-analyzer | |
- name: Build | |
# Workaround of `-Z avoid-dev-deps` | |
# See: https://github.com/rust-lang/cargo/issues/5133#issuecomment-1307094647 | |
run: | | |
sed -i 's/\[dev-dependencies]/[workaround-avoid-dev-deps]/g' ./Cargo.toml | |
cargo build --all-features | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
timeout-minutes: 45 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@clippy | |
- run: cargo clippy --all-targets --all-features -- -Dclippy::all | |
docs: | |
name: Docs | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install clippy | |
uses: dtolnay/rust-toolchain@clippy | |
- name: Rustdoc | |
env: | |
RUSTDOCFLAGS: --cfg docsrs_ -Dwarnings | |
run: cargo doc --all-features |