119 lines
3.2 KiB
YAML
119 lines
3.2 KiB
YAML
name: Rust CI
|
|
|
|
on: push
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
rustfmt_check:
|
|
name: Rustfmt Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
components: rustfmt
|
|
override: true
|
|
- name: rustfmt-check
|
|
run: cargo fmt --all --check
|
|
|
|
clippy_check:
|
|
name: Clippy Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Check workflow permissions
|
|
id: check_permissions
|
|
uses: scherermichael-oss/action-has-permission@1.0.6
|
|
with:
|
|
required-permission: write
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Run clippy action to produce annotations
|
|
uses: actions-rs/clippy-check@v1
|
|
if: ${{ steps.check_permissions.outputs.has-permission }}
|
|
with:
|
|
# GitHub displays the clippy job and its results as separate entries
|
|
name: Clippy (stable) Results
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
args: --all-features --all-targets -- -D warnings
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
components: clippy
|
|
override: true
|
|
- name: Run clippy manually without annotations
|
|
if: ${{ !steps.check_permissions.outputs.has-permission }}
|
|
run: cargo clippy --all-features --all-targets -- -D warnings
|
|
|
|
security_audit:
|
|
name: Security Audit
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/audit-check@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust:
|
|
- stable
|
|
- 1.56.1
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
profile: minimal
|
|
override: true
|
|
- name: cargo test
|
|
run: cargo test --workspace --all-targets --all-features
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust:
|
|
- stable
|
|
- 1.56.1
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
profile: minimal
|
|
override: true
|
|
- name: cargo build
|
|
run: cargo build --workspace --all-targets --all-features
|
|
|
|
coverage:
|
|
name: Code coverage
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
override: true
|
|
components: llvm-tools-preview
|
|
- name: Install cargo-llvm-cov
|
|
uses: taiki-e/install-action@cargo-llvm-cov
|
|
- name: Generate code coverage
|
|
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
files: lcov.info
|
|
fail_ci_if_error: true
|
|
|