ci #64
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
# Based on https://github.com/actions-rs/meta/blob/master/recipes/msrv.md | |
name: ci | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '17 01 * * 0' | |
jobs: | |
check: | |
name: check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo check | |
- run: cargo check --no-default-features | |
test: | |
name: test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: | |
- 1.66.1 # MSRV (minimum supported Rust version) | |
- stable | |
- beta | |
include: | |
- rust: 1.66.1 | |
msrv: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
# See https://github.com/matklad/once_cell/issues/201 | |
# To test locally, enable the lock file and then run: | |
# $ docker run --rm --user "$(id -u)":"$(id -g)" -v "$PWD":/usr/src/myapp -w /usr/src/myapp rust:1.66.1 cargo test | |
# To update, use `cargo +nightly update -Z minimal-versions` and then `cargo update -p bit-vec -p serde` | |
- name: Use Cargo.lock for MSRV | |
if: ${{ matrix.msrv }} | |
run: cp Cargo.lock.msrv Cargo.lock | |
- run: cargo test | |
example: | |
name: example | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo run --example toy trace '\d*' '1122 33' | |
fmt: | |
name: rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- run: cargo fmt --all -- --check | |
coverage: | |
if: ${{ github.event_name != 'schedule' }} | |
name: coverage | |
runs-on: ubuntu-latest | |
container: | |
image: xd009642/tarpaulin:0.31.2 | |
options: --security-opt seccomp=unconfined | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate code coverage | |
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true |