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
31 changes: 31 additions & 0 deletions .github/actions/cargo-tool/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Install a cargo tool
description: Builds a tool from crates.io at a pinned version with its lockfile, caching the binary
inputs:
crate:
description: The crate, whose binary has the same name
required: true
version:
description: The exact version
required: true
runs:
using: composite
steps:
- name: Name the runner image
id: image
shell: bash
run: echo "image=${ImageOS:-$RUNNER_OS}-$RUNNER_ARCH" >> "$GITHUB_OUTPUT"
# The key names the exact version and has no restore-keys, so a hit is always this build. A PR
# run saves only to its own ref, which no other run restores from
- name: Restore the binary
id: cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cargo/bin/${{ inputs.crate }}
key: cargo-tool-${{ inputs.crate }}-${{ inputs.version }}-${{ steps.image.outputs.image }}
- name: Build it
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
CRATE: ${{ inputs.crate }}
VERSION: ${{ inputs.version }}
run: cargo install --locked "$CRATE" --version "$VERSION"
5 changes: 4 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
# the workflows, and the composite actions they call
directories:
- /
- /.github/actions/*
schedule:
interval: monthly
# wait a week after a release before proposing it
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ jobs:
- name: Install Rust from rust-toolchain.toml
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
run: rustup toolchain install
- name: Install cargo-binstall
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
uses: cargo-bins/cargo-binstall@8a2045612414e945291083f820cd50b4d8fc2218 # v1.26.0
- name: Install cargo-semver-checks
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
run: cargo binstall cargo-semver-checks@0.51.0 --no-confirm
uses: $/.github/actions/cargo-tool
with:
crate: cargo-semver-checks
version: 0.51.0
- name: Compare the public API with the base revision
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
uses: obi1kenobi/cargo-semver-checks-action@6b69fcf40e9b5fb17adeb57e4b6ecd020649a239 # v2.9
Expand Down Expand Up @@ -813,6 +813,7 @@ jobs:
cd conformance-results
zip -r ../release/conformance-results.zip .
- name: Create GitHub release
# zizmor: ignore[superfluous-actions] until this step moves to the gh CLI
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
draft: true
Expand Down
43 changes: 34 additions & 9 deletions .github/workflows/security-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,58 @@ on:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '.github/workflows/security-audit.yml'
- '.github/workflows/**'
- '.github/actions/**'
- '.github/dependabot.yml'
- '.cargo/audit.toml'
# Run on PRs to test before merging. The job binstalls cargo-audit and reads
# Cargo.lock, so it's cheap enough to run unfiltered - and an unfiltered
# Run on PRs to test before merging. The job reads Cargo.lock with a cached
# cargo-audit, so it's cheap enough to run unfiltered - and an unfiltered
# trigger is a prerequisite for ever making this a required status check,
# since a path-filtered workflow reports no status at all.
pull_request:
# audit and osv-scanner are required checks, so they must also run in the merge queue
# audit, osv-scanner and zizmor are required checks, so they must also run in the merge queue
merge_group:

permissions:
contents: read

jobs:
audit:
# Static analysis of the workflows themselves: unpinned or known-vulnerable actions, expression
# injection, credential persistence and cache poisoning. Inline ignore comments record the
# accepted findings.
zizmor:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@8a2045612414e945291083f820cd50b4d8fc2218 # v1.26.0
- name: Install zizmor
uses: $/.github/actions/cargo-tool
with:
crate: zizmor
version: 1.31.1

- name: Audit the workflows
env:
# the online audits check each pinned commit and look up advisories against the actions
GH_TOKEN: ${{ github.token }}
run: zizmor --format github .github

- name: Install cargo-audit binary (fast)
run: cargo binstall cargo-audit@0.22.1 --no-confirm
audit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install cargo-audit
uses: $/.github/actions/cargo-tool
with:
crate: cargo-audit
version: 0.22.1

# Run cargo-audit exactly once. The exit status alone can't distinguish
# "vulnerabilities found" from "the tool or advisory DB fetch failed", so
Expand Down
4 changes: 4 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ still pass (raise the pinned `cargo-semver-checks` with it if rustdoc's JSON
format changed). Raise it out of cycle only for a confirmed miscompilation or a
rustc security fix. The `msrv` job checks the declared `rust-version` separately.

CI builds `cargo-audit`, `cargo-semver-checks` and `zizmor` from crates.io at the
versions its workflows name, which Dependabot doesn't update. Raise them to
their latest releases at the same time.

## CHANGELOG conventions

- The upcoming release has one section, headed by its final version (`### X.Y.Z ###`), from the
Expand Down
Loading