name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 - uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 - uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 with:
components: clippy
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 - run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- run: cargo clippy --workspace --all-targets --no-default-features -- -D warnings
- run: ./scripts/lint_all.sh
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 - uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 - uses: taiki-e/install-action@e3134ec54b36203e18f2d1e80652058bd078dd91 with:
tool: nextest
- id: test_all_features
continue-on-error: true
run: cargo nextest run --workspace --profile ci-all --all-features --show-progress=none --status-level=fail --final-status-level=fail
- id: test_no_default_features
continue-on-error: true
run: cargo nextest run --workspace --profile ci-no-default --no-default-features --show-progress=none --status-level=fail --final-status-level=fail
- name: Summarize failed tests
if: steps.test_all_features.outcome == 'failure' || steps.test_no_default_features.outcome == 'failure'
run: |
python3 scripts/ci_test_failure_summary.py \
target/nextest/ci-all/junit-all-features.xml \
target/nextest/ci-no-default/junit-no-default-features.xml >> "$GITHUB_STEP_SUMMARY"
- name: Fail job if tests failed
if: steps.test_all_features.outcome == 'failure' || steps.test_no_default_features.outcome == 'failure'
run: exit 1
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 - uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 - run: cargo build --workspace --release
- run: cargo build --workspace --release --no-default-features
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 - uses: taiki-e/install-action@e3134ec54b36203e18f2d1e80652058bd078dd91 with:
tool: cargo-audit
- run: cargo audit