Skip to content

Commit 20e7c2b

Browse files
committed
ci: nextest, coverage, cargo-deny licenses, PR-merge comment workflow
- test job: use cargo-nextest for faster runs on ubuntu/macos/windows - coverage job: llvm-cov + Codecov upload (CODECOV_TOKEN optional) - cargo-deny: add [licenses] allow list + exceptions for ring, unicode-ident - pr-merge-comment: on PR merge, comment on issues linked via Closes/Fixes/Resolves - fix actionlint: pass PR body via env, single GITHUB_OUTPUT redirect Made-with: Cursor
1 parent 9676668 commit 20e7c2b

File tree

4 files changed

+104
-6
lines changed

4 files changed

+104
-6
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ jobs:
5151
run: cargo audit
5252

5353
cargo-deny:
54-
name: cargo-deny (advisories)
54+
name: cargo-deny (advisories + licenses)
5555
runs-on: ubuntu-latest
5656
steps:
5757
- uses: actions/checkout@v5
5858
- uses: dtolnay/rust-toolchain@1.88.0
5959
- uses: Swatinem/rust-cache@v2
6060
- name: Install cargo-deny
6161
run: cargo install cargo-deny --locked
62-
- name: Check advisories
63-
run: cargo deny check advisories
62+
- name: Check advisories and licenses
63+
run: cargo deny check advisories licenses
6464

6565
test:
6666
runs-on: ${{ matrix.os }}
@@ -76,8 +76,36 @@ jobs:
7676
run: cd web && npm ci && npm run build
7777
- uses: dtolnay/rust-toolchain@1.88.0
7878
- uses: Swatinem/rust-cache@v2
79+
- name: Install cargo-nextest
80+
run: cargo install cargo-nextest --locked
7981
- name: Test
80-
run: cargo test
82+
run: cargo nextest run
83+
84+
coverage:
85+
name: Coverage (llvm-cov)
86+
runs-on: ubuntu-latest
87+
steps:
88+
- uses: actions/checkout@v5
89+
- uses: actions/setup-node@v5
90+
with:
91+
node-version: '20'
92+
- name: Build frontend
93+
run: cd web && npm ci && npm run build
94+
- uses: dtolnay/rust-toolchain@1.88.0
95+
with:
96+
components: llvm-tools-preview
97+
- uses: Swatinem/rust-cache@v2
98+
- name: Install cargo-llvm-cov
99+
uses: taiki-e/install-action@cargo-llvm-cov
100+
- name: Generate coverage
101+
run: cargo llvm-cov test --no-fail-fast --lcov --output-path lcov.info
102+
- name: Upload to Codecov
103+
uses: codecov/codecov-action@v4
104+
with:
105+
files: lcov.info
106+
fail_ci_if_error: false
107+
env:
108+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
81109

82110
mutation:
83111
runs-on: ubuntu-latest
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# When a PR is merged, comment on linked issues (Closes #N, Fixes #N, etc.).
2+
name: PR merge — comment on linked issues
3+
4+
on:
5+
pull_request:
6+
types: [closed]
7+
8+
jobs:
9+
comment-linked-issues:
10+
name: Comment on linked issues
11+
if: github.event.pull_request.merged == true
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
issues: write
16+
steps:
17+
- name: Extract linked issue numbers
18+
id: issues
19+
env:
20+
PR_BODY: ${{ github.event.pull_request.body }}
21+
PR_NUM: ${{ github.event.pull_request.number }}
22+
run: |
23+
ISSUES=$(echo "$PR_BODY" | grep -ioE '(closes?|fixes?|resolves?)\s+#[0-9]+' | grep -oE '#[0-9]+' | tr -d '#' | sort -nu)
24+
{
25+
if [ -z "$ISSUES" ]; then
26+
echo "ids="
27+
else
28+
echo "ids<<EOF"
29+
echo "$ISSUES"
30+
echo "EOF"
31+
fi
32+
echo "pr_num=$PR_NUM"
33+
} >> "$GITHUB_OUTPUT"
34+
35+
- name: Comment on each linked issue
36+
env:
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
PR_NUM: ${{ steps.issues.outputs.pr_num }}
39+
ISSUE_IDS: ${{ steps.issues.outputs.ids }}
40+
run: |
41+
if [ -z "$ISSUE_IDS" ]; then
42+
echo "No linked issues to comment on."
43+
exit 0
44+
fi
45+
for id in $ISSUE_IDS; do
46+
echo "Commenting on issue #$id..."
47+
gh issue comment "$id" --body "Shipped in PR #${PR_NUM} (merged to main)."
48+
done

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deny.toml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
11
# cargo-deny: https://embarkstudios.github.io/cargo-deny/
2-
# CI runs: cargo deny check advisories (licenses optional; expand allow list to enable).
2+
# CI runs: cargo deny check advisories licenses
33

44
[advisories]
55
version = 2
66
unmaintained = "workspace"
77
yanked = "warn"
8+
9+
[licenses]
10+
version = 2
11+
allow = [
12+
"Apache-2.0",
13+
"BSD-2-Clause",
14+
"BSD-3-Clause",
15+
"CDLA-Permissive-2.0",
16+
"ISC",
17+
"MIT",
18+
"MPL-2.0",
19+
"Unicode-3.0",
20+
"Zlib",
21+
]
22+
# Compound expressions: allow via exceptions for specific crates.
23+
[[licenses.exceptions]]
24+
allow = ["Apache-2.0", "ISC"]
25+
crate = "ring"
26+
27+
[[licenses.exceptions]]
28+
allow = ["MIT", "Apache-2.0", "Unicode-3.0"]
29+
crate = "unicode-ident"

0 commit comments

Comments
 (0)