Skip to content

feat(ci): Add full service set + spiffe-helper #3746

feat(ci): Add full service set + spiffe-helper

feat(ci): Add full service set + spiffe-helper #3746

Workflow file for this run

---
name: Linters
permissions:
contents: read
on:
pull_request:
branches: ["main" ]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'merge_group' && github.run_id || github.event.pull_request.number || github.sha }}
env:
CARGO_TERM_COLOR: always
rust_min: 1.93.0
jobs:
rustfmt:
name: Run rustfmt on the minimum supported toolchain
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install Rust ${{ env.rust_min }}
uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # stable
with:
toolchain: ${{ env.rust_min }}
components: rustfmt
- name: Run rustfmt
run: cargo fmt -- --check
clippy:
name: Run clippy on the minimum supported toolchain
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install protobuf-compiler
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Install Rust ${{ env.rust_min }}
uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # stable
with:
toolchain: ${{ env.rust_min }}
components: rustfmt, clippy
- name: Install cargo-binstall
uses: taiki-e/install-action@50414676f9f5d50a65992c6dd2ed02641263226c # v2.82.10
with:
tool: cargo-binstall
- name: Install required cargo
run: cargo binstall clippy-sarif sarif-fmt --force
- name: Run rust-clippy
run: |
cargo clippy \
--lib --tests \
--message-format=json | ${CARGO_HOME}/bin/clippy-sarif | tee rust-clippy-results.sarif | ${CARGO_HOME}/bin/sarif-fmt
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
if: github.event_name != 'merge_group'
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
typos:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- name: Checkout Actions Repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Check spelling of file.txt
uses: crate-ci/typos@4d9c206a77c041268485162b8e2579ad7a5cb9a3 # v1.50.0
with:
config: typos.toml
opa:
name: Check OPA policy formatting
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup OPA
uses: open-policy-agent/setup-opa@b2b258e089860efaadaaf71bf6e3aecb4a3eeff1 # v2.4.0
with:
version: 1.6.0
- name: Test OPA policies
run: opa fmt policy --check-result
committed:
name: Lint Commits
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- name: Checkout Actions Repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Lint Commits
uses: crate-ci/committed@15229711f8f597474c0b636f327cde5969f9a529 # v1.1.7
if: github.event_name != 'merge_group'
with:
# committed's default range (HEAD~..HEAD^2) assumes a 2-parent PR merge
# commit, which doesn't exist on the merge queue's single-commit ref.
commits: ${{ github.event_name == 'merge_group' && 'HEAD~1..HEAD' || 'HEAD~..HEAD^2' }}