ci: standardize CI workflows and git hooks
Some checks failed
Public Repo Readiness / Check Public Repo Readiness (push) Failing after 7s
Some checks failed
Public Repo Readiness / Check Public Repo Readiness (push) Failing after 7s
Add ci.yml (compile/fmt/lint/test/audit/machete), nightly.yml (geiger unsafe audit), deny.toml (license/ban/source policy), and Justfile with pre-commit, prepush, ci, and install-hooks recipes.
This commit is contained in:
67
.github/workflows/ci.yml
vendored
Normal file
67
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, "feature/*", "hotfix/*", "chore/*"]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
compile-check:
|
||||
name: Compile, Format & Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt, clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo check --workspace
|
||||
- run: cargo fmt --all --check
|
||||
- run: cargo clippy --workspace -- -D warnings
|
||||
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
needs: compile-check
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-nextest
|
||||
- run: cargo nextest run --workspace
|
||||
|
||||
audit:
|
||||
name: Audit & Deny
|
||||
runs-on: ubuntu-latest
|
||||
needs: compile-check
|
||||
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/heads/hotfix/')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- uses: EmbarkStudios/cargo-deny-action@v2
|
||||
- uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-audit
|
||||
- run: cargo audit
|
||||
|
||||
machete:
|
||||
name: Unused Dependencies
|
||||
runs-on: ubuntu-latest
|
||||
needs: compile-check
|
||||
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/heads/hotfix/')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-machete
|
||||
- run: cargo machete
|
||||
28
.github/workflows/nightly.yml
vendored
Normal file
28
.github/workflows/nightly.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Nightly
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 2 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
geiger:
|
||||
name: Unsafe Audit (geiger)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo install cargo-geiger --locked
|
||||
- run: cargo geiger --workspace 2>&1 | tee geiger-report.txt
|
||||
- run: |
|
||||
echo "## Geiger Unsafe Audit" >> $GITHUB_STEP_SUMMARY
|
||||
tee -a $GITHUB_STEP_SUMMARY < geiger-report.txt
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: geiger-report
|
||||
path: geiger-report.txt
|
||||
retention-days: 30
|
||||
Reference in New Issue
Block a user