name: test
on:
workflow_call:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
required:
runs-on: ubuntu-latest
name: ubuntu / ${{ matrix.toolchain }}
strategy:
matrix:
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Install sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Run sccache stat for check
run: ${SCCACHE_PATH} --show-stats
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo test --locked
run: cargo test --locked --all-features --all-targets --workspace
- name: cargo test --doc
run: cargo test --locked --all-features --doc --workspace
coverage:
runs-on: ubuntu-latest
name: ubuntu / stable / coverage
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Run sccache stat for check
run: ${SCCACHE_PATH} --show-stats
- name: cargo install cargo-tarpaulin
uses: taiki-e/install-action@cargo-tarpaulin
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo tarpaulin
run: cargo tarpaulin --engine llvm --locked --all-features --out lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true