Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: security

on:
# Pull request branches are checked through pull_request, so they do not run twice.
push:
branches: [main]
paths:
- "**/Cargo.toml"
- Cargo.lock
Expand All @@ -15,17 +17,54 @@ on:
- cron: "17 9 * * 1"
workflow_dispatch:

# A newer update to the same pull request stops the older run.
# Every other run (main pushes, scheduled and manual runs) gets its own
# group so it is never stopped.
concurrency:
group: ci-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

jobs:
rustsec:
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
CARGO_AUDIT_VERSION: 0.22.2
steps:
- uses: actions/checkout@v7.0.1
- uses: dtolnay/rust-toolchain@stable
- name: Hash the Rust compiler
id: rustc
run: |
hash=$(rustc -vV | sha256sum | cut -d ' ' -f 1)
echo "hash=$hash" >> "$GITHUB_OUTPUT"
# Cache only the program folder; .cargo/bin holds toolchain shims.
- uses: actions/cache/restore@v6.1.0
id: cargo-audit-cache
with:
path: ~/.cache/cargo-audit-${{ env.CARGO_AUDIT_VERSION }}
key: cargo-audit-${{ env.CARGO_AUDIT_VERSION }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.rustc.outputs.hash }}
- name: Install cargo-audit
run: cargo install cargo-audit --version 0.22.2 --locked
id: install-cargo-audit
run: |
dir="$HOME/.cache/cargo-audit-$CARGO_AUDIT_VERSION"
if [ -x "$dir/bin/cargo-audit" ] &&
[ "$("$dir/bin/cargo-audit" --version)" = "cargo-audit $CARGO_AUDIT_VERSION" ]; then
echo "installed=false" >> "$GITHUB_OUTPUT"
else
rm -rf "$dir"
cargo install cargo-audit --version "$CARGO_AUDIT_VERSION" --locked --root "$dir"
[ "$("$dir/bin/cargo-audit" --version)" = "cargo-audit $CARGO_AUDIT_VERSION" ]
echo "installed=true" >> "$GITHUB_OUTPUT"
fi
echo "$dir/bin" >> "$GITHUB_PATH"
- uses: actions/cache/save@v6.1.0
if: steps.install-cargo-audit.outputs.installed == 'true'
with:
path: ~/.cache/cargo-audit-${{ env.CARGO_AUDIT_VERSION }}
key: ${{ steps.cargo-audit-cache.outputs.cache-primary-key }}
- name: Check RustSec advisories
run: cargo audit
9 changes: 9 additions & 0 deletions .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
name: workspace

on:
# Pull request branches are checked through pull_request, so they do not run twice.
push:
branches: [main]
pull_request:

# A newer update to the same pull request stops the older run.
# Every other run, such as a push to main, gets its own group so it is
# never stopped.
concurrency:
group: ci-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

Expand Down
Loading