Skip to content

Commit e69f79c

Browse files
author
Topgrade Tester
committed
ci: add CodeQL and cargo-deny workflows with pinned SHAs
1 parent 9ec8e83 commit e69f79c

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed

.github/workflows/cargo-deny.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: cargo-deny
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main ]
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
check:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 20
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22+
with:
23+
persist-credentials: false
24+
fetch-depth: 1
25+
26+
- name: Install cargo-deny
27+
uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2.60.0
28+
with:
29+
30+
31+
- name: Run cargo deny (advisories)
32+
run: cargo deny check advisories --all-features
33+
34+
- name: Run cargo deny (licenses)
35+
run: cargo deny check licenses --all-features
36+
37+
- name: Run cargo deny (bans)
38+
run: cargo deny check bans --all-features

.github/workflows/codeql.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
schedule:
8+
- cron: '0 3 * * 1'
9+
10+
permissions:
11+
contents: read
12+
security-events: write
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
analyze:
20+
name: Analyze (Rust)
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 30
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
with:
27+
persist-credentials: false
28+
fetch-depth: 1
29+
30+
- name: Initialize CodeQL
31+
uses: github/codeql-action/init@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
32+
with:
33+
languages: rust
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
40+
with:
41+
category: '/language:rust'

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<a href="https://aur.archlinux.org/packages/topgrade"><img alt="AUR" src="https://img.shields.io/aur/version/topgrade.svg"></a>
99
<a href="https://formulae.brew.sh/formula/topgrade"><img alt="Homebrew" src="https://img.shields.io/homebrew/v/topgrade.svg"></a>
1010

11+
<a href="https://github.com/topgrade-rs/topgrade/actions/workflows/codeql.yml"><img alt="CodeQL" src="https://github.com/topgrade-rs/topgrade/actions/workflows/codeql.yml/badge.svg?branch=main"></a>
12+
1113
<img alt="Demo" src="doc/topgrade_demo.gif">
1214
</div>
1315

deny.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[advisories]
2+
vulnerability = "deny"
3+
unmaintained = "warn"
4+
unsound = "deny"
5+
yanked = "warn"
6+
ignore = [
7+
# Add RUSTSEC IDs here with expiry and reason once triaged
8+
]
9+
10+
[licenses]
11+
unlicensed = "deny"
12+
allow = ["MIT", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "ISC", "Zlib"]
13+
exceptions = [
14+
# { name = "some-crate", version = "=1.2.3", allow = ["License-Ref-..."], rationale = "..." }
15+
]
16+
confidence-threshold = 0.8
17+
18+
[bans]
19+
multiple-versions = "warn"
20+
wildcards = "deny"
21+
deny = [
22+
# { name = "old-crate", version = "<1.0.0", note = "Use maintained fork" }
23+
]
24+
25+
[sources]
26+
unknown-registry = "deny"
27+
unknown-git = "warn"

0 commit comments

Comments
 (0)