toolchains
This commit is contained in:
parent
c92c7590b5
commit
f5fd289639
3 changed files with 219 additions and 47 deletions
166
.github/workflows/CI.yml
vendored
Normal file
166
.github/workflows/CI.yml
vendored
Normal file
|
@ -0,0 +1,166 @@
|
|||
name: CI
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
CARGO_TERM_COLOR: always
|
||||
CLICOLOR: 1
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
permissions:
|
||||
contents: none
|
||||
name: CI
|
||||
needs: [test, msrv, docs, rustfmt, clippy]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Done
|
||||
run: exit 0
|
||||
test:
|
||||
name: Test
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "windows-latest", "macos-14"]
|
||||
rust: ["nightly"]
|
||||
continue-on-error: ${{ matrix.rust != 'nightly' }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Build
|
||||
run: cargo test --workspace --no-run
|
||||
- name: Default features
|
||||
run: cargo test --workspace
|
||||
- name: All features
|
||||
run: cargo test --workspace --all-features
|
||||
- name: No-default features
|
||||
run: cargo test --workspace --no-default-features
|
||||
msrv:
|
||||
name: "Check MSRV"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
toolchain: nightly
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- uses: taiki-e/install-action@cargo-hack
|
||||
- name: Default features
|
||||
run: cargo hack check --locked --rust-version --ignore-private --workspace --all-targets
|
||||
- name: All features
|
||||
run: cargo hack check --locked --rust-version --ignore-private --workspace --all-targets --all-features
|
||||
- name: No-default features
|
||||
run: cargo hack check --locked --rust-version --ignore-private --workspace --all-targets --no-default-features
|
||||
lockfile:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
toolchain: nightly
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: "Is lockfile updated?"
|
||||
run: cargo fetch --locked
|
||||
docs:
|
||||
name: Docs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
toolchain: nightly
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Check documentation
|
||||
env:
|
||||
RUSTDOCFLAGS: -D warnings
|
||||
run: cargo doc --workspace --all-features --no-deps --document-private-items
|
||||
rustfmt:
|
||||
name: rustfmt
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
# Not MSRV because its harder to jump between versions and people are
|
||||
# more likely to have nightly
|
||||
toolchain: nightly
|
||||
components: rustfmt
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Check formatting
|
||||
run: cargo fmt --all -- --check
|
||||
clippy:
|
||||
name: clippy
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
security-events: write # to upload sarif results
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
toolchain: "1.78.0-nightly" # nightly
|
||||
components: clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Install SARIF tools
|
||||
run: cargo install clippy-sarif --version 0.3.4 --locked # Held back due to msrv
|
||||
- name: Install SARIF tools
|
||||
run: cargo install sarif-fmt --version 0.3.4 --locked # Held back due to msrv
|
||||
- name: Check
|
||||
run: >
|
||||
cargo clippy --workspace --all-features --all-targets --message-format=json -- -D warnings --allow deprecated
|
||||
| clippy-sarif
|
||||
| tee clippy-results.sarif
|
||||
| sarif-fmt
|
||||
continue-on-error: true
|
||||
- name: Upload
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: clippy-results.sarif
|
||||
wait-for-processing: true
|
||||
- name: Report status
|
||||
run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated
|
||||
coverage:
|
||||
name: Coverage
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
toolchain: nightly
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Install cargo-tarpaulin
|
||||
run: cargo install cargo-tarpaulin
|
||||
- name: Gather coverage
|
||||
run: cargo tarpaulin --output-dir coverage --out lcov
|
||||
- name: Publish to Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
47
.github/workflows/rust-clippy.yml
vendored
47
.github/workflows/rust-clippy.yml
vendored
|
@ -1,47 +0,0 @@
|
|||
name: rust-clippy analyze
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
- "dev"
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches:
|
||||
- "master"
|
||||
- "dev"
|
||||
|
||||
jobs:
|
||||
rust-clippy-analyze:
|
||||
name: Run rust-clippy analyzing
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
override: true
|
||||
|
||||
- name: Install required cargo
|
||||
run: cargo install clippy-sarif sarif-fmt
|
||||
|
||||
- name: Run rust-clippy
|
||||
run:
|
||||
cargo clippy
|
||||
--all-features
|
||||
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload analysis results to GitHub
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
with:
|
||||
sarif_file: rust-clippy-results.sarif
|
||||
wait-for-processing: true
|
53
.github/workflows/security-audit.yml
vendored
Normal file
53
.github/workflows/security-audit.yml
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
name: Security audit
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "**/Cargo.toml"
|
||||
- "**/Cargo.lock"
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
CARGO_TERM_COLOR: always
|
||||
CLICOLOR: 1
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
security_audit:
|
||||
permissions:
|
||||
issues: write # to create issues (actions-rs/audit-check)
|
||||
checks: write # to create check (actions-rs/audit-check)
|
||||
runs-on: ubuntu-latest
|
||||
# Prevent sudden announcement of a new advisory from failing ci:
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions-rs/audit-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
cargo_deny:
|
||||
permissions:
|
||||
issues: write # to create issues (actions-rs/audit-check)
|
||||
checks: write # to create check (actions-rs/audit-check)
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
checks:
|
||||
- bans licenses sources
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: EmbarkStudios/cargo-deny-action@v1
|
||||
with:
|
||||
command: check ${{ matrix.checks }}
|
||||
rust-version: stable
|
Loading…
Reference in a new issue