name: CI
on:
pull_request:
push:
branches:
- main
env:
RUSTFLAGS: -Dwarnings
jobs:
test:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [nightly, stable]
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2.9.1
- name: Tests
run: cargo test
env:
RUST_LOG: trace
- name: Tests (futures-io)
run: cargo test --features futures-io
env:
RUST_LOG: trace
- name: Tests (tokio)
run: cargo test --features tokio
env:
RUST_LOG: trace
check_fmt_and_docs:
name: Checking fmt, clippy, and docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-review'
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: fmt
run: cargo fmt --all -- --check
- name: Build Documentation
run: cargo doc --all --no-deps
miri:
name: "Miri"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Miri
run: |
rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup
- name: Rust Cache
uses: Swatinem/rust-cache@v2.9.1
- name: Test with Miri
env:
RUST_BACKTRACE: 1
MIRIFLAGS: "-Zmiri-env-forward=RUST_BACKTRACE -Zmiri-ignore-leaks"
run: cargo +nightly miri test --tests
thread_sanitizer:
name: Thread Sanitizer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- name: Rust Cache
uses: Swatinem/rust-cache@v2.9.1
- name: Tests
run: cargo test -Zbuild-std --target x86_64-unknown-linux-gnu --tests
env:
RUSTFLAGS: "-Dwarnings -Zsanitizer=thread"
RUSTDOCFLAGS: "-Dwarnings -Zsanitizer=thread"
- name: Tests (futures-io)
run: cargo test -Zbuild-std --target x86_64-unknown-linux-gnu --features futures-io --tests
env:
RUSTFLAGS: "-Dwarnings -Zsanitizer=thread"
RUSTDOCFLAGS: "-Dwarnings -Zsanitizer=thread"
- name: Tests (tokio)
run: cargo test -Zbuild-std --target x86_64-unknown-linux-gnu --features tokio --tests
env:
RUSTFLAGS: "-Dwarnings -Zsanitizer=thread"
RUSTDOCFLAGS: "-Dwarnings -Zsanitizer=thread"
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Collect coverage data
run: cargo llvm-cov nextest --codecov --output-path codecov.json
env:
RUST_LOG: trace
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v6.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: codecov.json
slug: jbr/swansong