81 lines
2 KiB
YAML
81 lines
2 KiB
YAML
|
|
name: CI
|
||
|
|
|
||
|
|
on:
|
||
|
|
push:
|
||
|
|
branches: [master]
|
||
|
|
pull_request:
|
||
|
|
|
||
|
|
jobs:
|
||
|
|
build:
|
||
|
|
runs-on: rust-ci
|
||
|
|
steps:
|
||
|
|
- uses: actions/checkout@v4
|
||
|
|
|
||
|
|
- name: Cache cargo registry and build artifacts
|
||
|
|
uses: actions/cache@v4
|
||
|
|
with:
|
||
|
|
path: |
|
||
|
|
~/.cargo/registry
|
||
|
|
~/.cargo/git
|
||
|
|
target
|
||
|
|
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
|
||
|
|
restore-keys: |
|
||
|
|
cargo-${{ runner.os }}-
|
||
|
|
|
||
|
|
- name: Cache sccache compilation objects
|
||
|
|
uses: actions/cache@v4
|
||
|
|
with:
|
||
|
|
path: /root/.cache/sccache
|
||
|
|
# Not keyed to Cargo.lock: sccache caches individual compiler
|
||
|
|
# invocations by content hash, so it should accumulate across
|
||
|
|
# dependency bumps rather than reset like the target/ cache above.
|
||
|
|
key: sccache-${{ runner.os }}-${{ github.run_id }}
|
||
|
|
restore-keys: |
|
||
|
|
sccache-${{ runner.os }}-
|
||
|
|
|
||
|
|
- name: Format check
|
||
|
|
run: cargo fmt --check
|
||
|
|
|
||
|
|
- name: Clippy
|
||
|
|
run: cargo clippy --all-targets -- -D warnings
|
||
|
|
|
||
|
|
- name: Check release profile compiles
|
||
|
|
run: cargo check --release
|
||
|
|
|
||
|
|
test:
|
||
|
|
needs: build
|
||
|
|
runs-on: rust-ci
|
||
|
|
steps:
|
||
|
|
- uses: actions/checkout@v4
|
||
|
|
|
||
|
|
- name: Cache cargo registry and build artifacts
|
||
|
|
uses: actions/cache@v4
|
||
|
|
with:
|
||
|
|
path: |
|
||
|
|
~/.cargo/registry
|
||
|
|
~/.cargo/git
|
||
|
|
target
|
||
|
|
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
|
||
|
|
restore-keys: |
|
||
|
|
cargo-${{ runner.os }}-
|
||
|
|
|
||
|
|
- name: Cache sccache compilation objects
|
||
|
|
uses: actions/cache@v4
|
||
|
|
with:
|
||
|
|
path: /root/.cache/sccache
|
||
|
|
key: sccache-${{ runner.os }}-${{ github.run_id }}
|
||
|
|
restore-keys: |
|
||
|
|
sccache-${{ runner.os }}-
|
||
|
|
|
||
|
|
- name: Test
|
||
|
|
run: cargo test
|
||
|
|
|
||
|
|
audit:
|
||
|
|
needs: test
|
||
|
|
runs-on: rust-ci
|
||
|
|
steps:
|
||
|
|
- uses: actions/checkout@v4
|
||
|
|
|
||
|
|
- name: cargo audit
|
||
|
|
run: cargo audit
|