Theodore/proofnarrowing #92
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 | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
name: check | |
env: | |
RUSTFLAGS: -D warnings | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
components: clippy, rustfmt | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
with: | |
version: "v0.4.0" | |
- name: Run cargo clippy | |
run: cargo clippy --all-features --all-targets -- -D warnings | |
- name: Run cargo fmt check | |
run: | | |
if ! cargo fmt --check --verbose ; then | |
echo "Formatting errors detected, please run 'cargo fmt' to fix it"; | |
exit 1 | |
fi | |
# Check that every combination of features is working properly. | |
hack: | |
runs-on: ubuntu-latest | |
name: features | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: cargo install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4 | |
- name: cargo hack | |
run: cargo hack --feature-powerset check | |
test: | |
runs-on: ubuntu-latest | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
with: | |
version: "v0.4.0" | |
- name: Run cargo test | |
run: cargo test --all-features | |
coverage: | |
runs-on: ubuntu-latest | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
components: llvm-tools-preview | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: cargo install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: cargo generate-lockfile | |
if: hashFiles('Cargo.lock') == '' | |
run: cargo generate-lockfile | |
- name: cargo llvm-cov | |
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info | |
- name: Upload to codecov.io | |
if: ${{ github.repository == 'Sovereign-Labs/nmt-rs' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: false |