Check and Test #7103
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: Check and Test | |
on: | |
push: | |
schedule: | |
- cron: 15 */6 * * * | |
jobs: | |
check: | |
name: Check the code | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: [stable, beta] | |
steps: | |
- name: Install the appropriate Rust toolchain | |
run: | | |
rustup toolchain install ${{ matrix.rust }} | |
rustup default ${{ matrix.rust }} | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Run rustfmt | |
run: | | |
rustup component add rustfmt | |
cargo fmt --all -- --check | |
- name: Run clippy | |
run: | | |
rustup component add clippy | |
cargo clippy --workspace --all-features --all-targets | |
test: | |
name: Test the code | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: [stable, beta, nightly] | |
steps: | |
- name: Install the appropriate Rust toolchain | |
run: | | |
rustup toolchain install ${{ matrix.rust }} | |
rustup default ${{ matrix.rust }} | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Run cargo test | |
run: | | |
cargo test --workspace --all-features --all-targets --no-fail-fast | |
coverage: | |
name: Measure test coverage | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: [stable] | |
steps: | |
- name: Install the appropriate Rust toolchain | |
run: | | |
rustup toolchain install ${{ matrix.rust }} --component llvm-tools-preview | |
rustup default ${{ matrix.rust }} | |
- name: Install cargo-llvm-cov | |
run: cargo install cargo-llvm-cov --version=0.4.9 | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Run cargo-llvm-cov | |
run: > | |
cargo llvm-cov | |
--all-features | |
--all-targets | |
--workspace | |
--lcov | |
--output-path lcov.info | |
- name: Upload coverage | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
run: bash <(curl -s https://codecov.io/bash) -X gcov | |
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 | |
with: | |
name: lcov.info | |
path: ./lcov.info |