[test] add CI workflow with Rust checks, cache setup, and auditing; update docs and README with CI details
This commit is contained in:
45
.github/workflows/ci.yml
vendored
Normal file
45
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main, master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main, master ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
name: ci
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
components: clippy, rustfmt
|
||||||
|
- name: Show rustc/cargo versions
|
||||||
|
run: |
|
||||||
|
rustc -Vv
|
||||||
|
cargo -Vv
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
- name: Install cargo-audit
|
||||||
|
run: |
|
||||||
|
cargo install cargo-audit --locked || cargo install cargo-audit
|
||||||
|
- name: Format check
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
- name: Clippy (warnings as errors)
|
||||||
|
run: cargo clippy --all-targets -- -D warnings
|
||||||
|
- name: Test
|
||||||
|
run: cargo test --all
|
||||||
|
- name: Audit
|
||||||
|
run: cargo audit
|
@@ -77,7 +77,7 @@ Troubleshooting & docs
|
|||||||
- docs/ci.md – minimal CI checklist and job outline
|
- docs/ci.md – minimal CI checklist and job outline
|
||||||
- CONTRIBUTING.md – PR checklist and workflow
|
- CONTRIBUTING.md – PR checklist and workflow
|
||||||
|
|
||||||
CI status: [CI badge placeholder]
|
CI status: [CI workflow runs](actions/workflows/ci.yml)
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
See the examples/ directory for copy-paste scripts:
|
See the examples/ directory for copy-paste scripts:
|
||||||
|
@@ -28,3 +28,4 @@ Example GitHub Actions job (outline)
|
|||||||
Notes
|
Notes
|
||||||
- For GPU features, set up appropriate runners and add `--features gpu-cuda|gpu-hip|gpu-vulkan` where applicable.
|
- For GPU features, set up appropriate runners and add `--features gpu-cuda|gpu-hip|gpu-vulkan` where applicable.
|
||||||
- For docs-only changes, jobs still build/test to ensure doctests and examples compile when enabled.
|
- For docs-only changes, jobs still build/test to ensure doctests and examples compile when enabled.
|
||||||
|
- Mark the CI job named `ci` as a required status check for the default branch in repository branch protection settings.
|
||||||
|
Reference in New Issue
Block a user