name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CACHE_VERSION: ${{ vars.CACHE_VERSION || '2025-10-21' }}
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ env.CACHE_VERSION }}
- name: Cargo build
run: |
cargo build --all-targets
cargo build --examples
- name: Install shellcheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck jq
- name: Shellcheck
run: |
SCRIPTS=$(git ls-files '*.sh')
if [ -n "$SCRIPTS" ]; then
echo "Running shellcheck on shell scripts"
echo "$SCRIPTS" | xargs shellcheck --severity=warning
else
echo "No shell scripts found"
fi
- name: Markdown linting
run: |
MD_FILES=$(git ls-files '*.md')
if [ -n "$MD_FILES" ]; then
echo "Checking markdown files with markdownlint"
echo "$MD_FILES" | xargs npx markdownlint-cli@0.45.0
else
echo "No markdown files found"
fi
- name: Cargo clippy
run: |
cargo clippy --all-targets -- -D warnings
- name: Install cargo-nextest
run: |
cargo install cargo-nextest --locked
- name: Cargo test
run: |
cargo nextest run --all-features --all-targets
cargo test --all-features --doc
- name: Test safe feature and unsafe code lints
run: |
bash scripts/test-safe-feature.sh
- name: Clean cargo cache
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache