Skip to content

Rust github workflow improvements #868

Rust github workflow improvements

Rust github workflow improvements #868

Workflow file for this run

# taking some ideas from
# https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-rust
name: Rust
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: "Test"
runs-on: ubuntu-latest
env:
# should probably match pco's minimum required rust version
RUST_VERSION: 1.74
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ env.RUST_VERSION }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Set Rust Toolchain Version
run: |
rustup install ${{ env.RUST_VERSION }}
rustup override set ${{ env.RUST_VERSION }}
rustup component add clippy rustfmt
- name: Test
run: cargo test
- name: Clippy
run: cargo clippy --no-deps
- name: Ensure formatted
run: cargo fmt --check