refactor(ci): only run Linux x Stable shard

This commit is contained in:
Harsh Shandilya 2022-11-15 23:21:31 +05:30 committed by GitHub
parent eec1cbd7b0
commit 0c413aada3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 79 additions and 1 deletions

View File

@ -7,7 +7,85 @@ on:
branches:
- main
env:
RUSTFLAGS: '-Dwarnings'
# disable incremental compilation.
#
# incremental compilation is useful as part of an edit-build-test-edit cycle,
# as it lets the compiler avoid recompiling code that hasn't changed. however,
# on CI, we're not making small edits; we're almost always building the entire
# project from scratch. thus, incremental compilation on CI actually
# introduces *additional* overhead to support making future builds
# faster...but no future builds will ever occur in any given CI environment.
#
# see https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
# for details.
CARGO_INCREMENTAL: 0
# allow more retries for network requests in cargo (downloading crates) and
# rustup (installing toolchains). this should help to reduce flaky CI failures
# from transient network timeouts or other issues.
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
# don't emit giant backtraces in the CI logs.
RUST_BACKTRACE: short
name: Check Rust code
jobs:
check:
uses: msfjarvis/shared-workflows/.github/workflows/test-rust-project.yml@main
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
- uses: rui314/setup-mold@b2554ccb6486461b7022f149ac59c96757fd8dee # v1
with:
make-default: true
- name: Install Rust
uses: dtolnay/rust-toolchain@1ce4a7352a1efe5dede2e52c75512b34256e4f44 # tag=v1
with:
toolchain: stable
- name: Install cargo-nextest
uses: baptiste0928/cargo-install@bf6758885262d0e6f61089a9d8c8790d3ac3368f # tag=v1
with:
crate: cargo-nextest
- name: Install cargo-deny
uses: baptiste0928/cargo-install@bf6758885262d0e6f61089a9d8c8790d3ac3368f # tag=v1
with:
crate: cargo-deny
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2
with:
key: cargo-cache-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}-${{ matrix.os }}-${{ matrix.rust }}
- name: Check formatting
shell: bash
run: cargo fmt -- --check
- name: Clippy
shell: bash
run: cargo clippy -- -Wclippy::pedantic
- name: Run tests
shell: bash
run: cargo nextest run --all-features
cargo-deny:
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
- uses: EmbarkStudios/cargo-deny-action@7257a18a9c2fe3f92b85d41ae473520dff953c97 # tag=v1
with:
command: check ${{ matrix.checks }}