Feature/faster nix postpred #188
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: 'Rust: Build and Test' | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
features: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install dependencies | |
run: cargo install cargo-hack | |
- name: Run cargo check on all features | |
run: cargo hack check --each-feature --all-targets | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: Run rustfmt | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
env: | |
RUSTFLAGS: -C debuginfo=0 | |
run: | | |
cargo clippy --all-features | |
- name: Install audit | |
run: cargo install cargo-audit | |
- name: Run audit | |
run: cargo audit -f Cargo.lock | |
test: | |
runs-on: ${{ matrix.os }} | |
needs: ["lint", "features"] | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Run tests | |
env: | |
RUSTFLAGS: -C debuginfo=0 | |
run: cargo test --all-features | |
coverage: | |
runs-on: ubuntu-latest | |
needs: ["lint", "features"] | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Generate code coverage | |
run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: promised-ai/rv | |
semver-checks: | |
runs-on: ubuntu-latest | |
needs: ["features", "lint" ] | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
with: | |
path: branch | |
- name: Checkout master | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
path: master | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install extra cargo tools | |
run: cargo install cargo-semver-checks --locked | |
- name: Check for semver-incompatibilities | |
run: cargo semver-checks check-release --manifest-path branch/Cargo.toml --baseline-root master/ --verbose | |
release: | |
name: release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: ["features", "lint", "test", "semver-checks", "coverage"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check Branch | |
env: | |
NEW_VERSION: ${{github.ref_name}} | |
run: | | |
git fetch origin master | |
git tag --merged origin/master | grep $NEW_VERSION | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install dependencies | |
run: cargo install cargo-crate | |
- name: Publish Updated Library Crates to Crates.io | |
env: | |
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} | |
run: cargo publish --token "${CRATES_TOKEN}" |