test #1
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: test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
# only read-only for GITHUB_TOKEN | |
permissions: | |
contents: read | |
# cancel old jobs since their results will be discarded anyway | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
required: | |
runs-on: ubuntu-latest | |
name: ubuntu / ${{ matrix.toolchain }} | |
strategy: | |
matrix: | |
# run on stable and beta to ensure that tests won't break on the next version of the rust | |
# toolchain | |
toolchain: [stable, beta] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install ${{ matrix.toolchain }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: cargo test --locked | |
run: cargo test --locked --all-features | |
os-check: | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} / stable | |
strategy: | |
fail-fast: false | |
matrix: | |
# ubuntu-latest is covered in `required` | |
os: [macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: cargo test | |
run: cargo test --locked --all-features --all-targets | |
coverage: | |
runs-on: ubuntu-latest | |
name: ubuntu / stable / coverage | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: llvm-tools-preview | |
- name: cargo install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: cargo llvm-cov | |
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info | |
- name: Record Rust version | |
run: echo "RUSTVER=$(rustc --version)" >> "$GITHUB_ENV" | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
env_vars: OS,RUSTVER |