-
Notifications
You must be signed in to change notification settings - Fork 3
118 lines (95 loc) · 3.27 KB
/
linters.yml
File metadata and controls
118 lines (95 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
name: Linters
permissions:
contents: read
on:
push:
branches: ["main" ]
pull_request:
branches: ["main" ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
rust_min: 1.90.0
jobs:
rustfmt:
name: Run rustfmt on the minimum supported toolchain
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Rust ${{ env.rust_min }}
uses: dtolnay/rust-toolchain@0f44b27771c32bda9f458f75a1e241b09791b331 # 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@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Rust ${{ env.rust_min }}
uses: dtolnay/rust-toolchain@0f44b27771c32bda9f458f75a1e241b09791b331 # stable
with:
toolchain: ${{ env.rust_min }}
components: rustfmt, clippy
- name: Install cargo-binstall
uses: taiki-e/install-action@9ba3ac3fd006a70c6e186a683577abc1ccf0ff3a # v2.54.0
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@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0
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@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Checkout Actions Repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Check spelling of file.txt
uses: crate-ci/typos@07d900b8fa1097806b8adb6391b0d3e0ac2fdea7 # v1.39.0
with:
config: typos.toml
opa:
name: Check OPA policy formatting
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup OPA
uses: open-policy-agent/setup-opa@v2
with:
version: 1.6.0
- name: Test OPA policies
run: opa fmt policy --check-result