Files
war-in-tunnels/.gitea/workflows/rust.yml
T
GarandPLG 40dd03ed62
Rust checks / check (push) Successful in 5m29s
Remove Nix from CI, use rustup with caching
Install required system packages and set RUST_VERSION=1.99.1. Cache the
Rust
toolchain and Cargo registry, and run Cargo commands directly instead of
via
`nix develop`. Documentation files are updated to reflect the new
workflow.
2026-10-19 14:12:07 +02:00

59 lines
2.1 KiB
YAML

name: Rust checks
on:
push:
pull_request:
jobs:
check:
runs-on: ubuntu-latest
container: node:22-bookworm
env:
RUST_VERSION: 1.99.1
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v4
- name: Install build dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl build-essential pkg-config libasound2-dev zstd
- name: Rust toolchain cache
uses: https://github.com/actions/cache@v4
with:
path: |
/root/.rustup
/root/.cargo/bin
key: rust-toolchain-v1-linux-x64-${{ env.RUST_VERSION }}
- name: Install Rust
run: |
if [ ! -x "$CARGO_HOME/bin/rustup" ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o /tmp/rustup-init.sh
sh /tmp/rustup-init.sh -y --profile minimal --default-toolchain none --no-modify-path
fi
"$CARGO_HOME/bin/rustup" toolchain install "$RUST_VERSION" --profile minimal --component rustfmt --component clippy
"$CARGO_HOME/bin/rustup" default "$RUST_VERSION"
echo "$CARGO_HOME/bin" >> "$GITHUB_PATH"
- name: Cargo cache
uses: https://github.com/actions/cache@v4
with:
path: |
/root/.cargo/registry
/root/.cargo/git
target
key: cargo-v1-linux-x64-${{ env.RUST_VERSION }}-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('Cargo.toml', 'src/**', 'tests/**') }}
restore-keys: |
cargo-v1-linux-x64-${{ env.RUST_VERSION }}-${{ hashFiles('Cargo.lock') }}-
cargo-v1-linux-x64-${{ env.RUST_VERSION }}-
- name: Formatting
run: cargo fmt --all -- --check
- name: Compilation
run: cargo check --all-targets --locked
- name: Tests
run: cargo test --all-targets --locked
- name: Release tests
run: cargo test --all-targets --release --locked
- name: Clippy
run: cargo clippy --all-targets --locked