Test #86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dependencies | |
on: | |
pull_request: | |
paths: | |
- "**/Cargo.toml" | |
- "deny.toml" | |
push: | |
paths: | |
- "**/Cargo.toml" | |
- "deny.toml" | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check-advisories: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-deny | |
run: cargo install cargo-deny | |
- name: Check for security advisories and unmaintained crates | |
run: cargo deny check advisories | |
check-bans: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-deny | |
run: cargo install cargo-deny | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Cargo update (base) | |
run: cargo update | |
- name: Check for banned and duplicated dependencies (base) | |
run: | | |
cargo deny --format json check bans 2>&1 | jq -r -n '[inputs][] | select(.fields.severity != null) | "\(.fields.severity) \(.fields.message)"' | sort > /tmp/deny-bans-base | |
check_command=!! | |
- uses: actions/checkout@v4 | |
- name: Cargo update (PR) | |
run: cargo update | |
- name: Check for banned and duplicated dependencies (PR) | |
run: | | |
set -o pipefail | |
cargo deny --format json check bans 2>&1 | jq -r -n '[inputs][] | select(.fields.severity != null) | "\(.fields.severity) \(.fields.message)"' | sort > /tmp/deny-bans-pr | |
code=$? | |
if [ $code -ne 0 ]; then | |
# show the diff with the entire output. if there's no diff, display the output. | |
diff -U99999 /tmp/deny-bans-pr /tmp/deny-bans-base && cat /tmp/deny-bans-pr | |
fi | |
set +o pipefail | |
exit "$code" | |
check-licenses: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-deny | |
run: cargo install cargo-deny | |
- name: Check for unauthorized licenses | |
run: cargo deny check licenses | |
check-sources: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-deny | |
run: cargo install cargo-deny | |
- name: Checked for unauthorized crate sources | |
run: cargo deny check sources |