CI: a Rust job for cultcache-rs, cultnet-rs and cultmesh-rs (#192)
This commit is contained in:
parent
ccac93abf1
commit
8c66646e09
1 changed files with 70 additions and 0 deletions
70
.github/workflows/rust-crates.yml
vendored
Normal file
70
.github/workflows/rust-crates.yml
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
name: Rust crates
|
||||||
|
|
||||||
|
# The three Rust crates (cultcache-rs, cultnet-rs, cultmesh-rs) are separate
|
||||||
|
# cargo packages with their own lockfiles, chained by path dependencies. This job
|
||||||
|
# runs only when Rust or the vectors the Rust tests read change: the forge has one
|
||||||
|
# runner shared by every repository, so it is not a general push job.
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "packages/cultcache-rs/**"
|
||||||
|
- "packages/cultnet-rs/**"
|
||||||
|
- "packages/cultmesh-rs/**"
|
||||||
|
- "tests/vectors/**"
|
||||||
|
- "contracts/cultnet/**"
|
||||||
|
- "contracts/cultmesh/**"
|
||||||
|
- ".github/workflows/rust-crates.yml"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
rust:
|
||||||
|
name: cargo test, fmt, clippy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# The forge runner resolves actions from data.forgejo.org, which mirrors
|
||||||
|
# actions/checkout but not dtolnay/rust-toolchain, and checkout needs node,
|
||||||
|
# which the official rust image lacks. So the job runs on the runner's default
|
||||||
|
# image (node present) and installs Rust with rustup in a plain step. No cache
|
||||||
|
# is assumed. 1.95 matches the Yggdrasil verify container.
|
||||||
|
timeout-minutes: 30
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: never
|
||||||
|
CARGO_INCREMENTAL: "0"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out CultLib
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Rust 1.95 with clippy and rustfmt
|
||||||
|
run: |
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.95 --component clippy,rustfmt
|
||||||
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||||
|
"$HOME/.cargo/bin/cargo" --version
|
||||||
|
|
||||||
|
# Each crate's `cargo test` builds its path dependencies, so cultmesh-rs
|
||||||
|
# covers all three libraries; every crate is still run for its own tests.
|
||||||
|
- name: cargo test --locked
|
||||||
|
run: |
|
||||||
|
for crate in cultcache-rs cultnet-rs cultmesh-rs; do
|
||||||
|
echo "::group::$crate"
|
||||||
|
cargo test --locked --manifest-path "packages/$crate/Cargo.toml"
|
||||||
|
echo "::endgroup::"
|
||||||
|
done
|
||||||
|
|
||||||
|
# fmt and clippy are reported, not gated: main is not clean for either
|
||||||
|
# (fmt: 746 / 659 / 279 diffs in cultcache-rs / cultnet-rs / cultmesh-rs;
|
||||||
|
# clippy 1.99 --all-targets: 31 / 54 / 16 warnings, no errors). A -D gate would be red on every
|
||||||
|
# pull request, and a count ratchet drifts whenever `stable` adds a lint.
|
||||||
|
# Make these blocking after the crates are formatted and clippy-clean.
|
||||||
|
- name: cargo fmt --check (report only)
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
for crate in cultcache-rs cultnet-rs cultmesh-rs; do
|
||||||
|
cargo fmt --check --manifest-path "packages/$crate/Cargo.toml"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: cargo clippy (report only)
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
for crate in cultcache-rs cultnet-rs cultmesh-rs; do
|
||||||
|
cargo clippy --locked --all-targets --manifest-path "packages/$crate/Cargo.toml"
|
||||||
|
done
|
||||||
Loading…
Reference in a new issue