-
Notifications
You must be signed in to change notification settings - Fork 598
85 lines (76 loc) · 2.74 KB
/
Copy pathdiffguard.yml
File metadata and controls
85 lines (76 loc) · 2.74 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
name: diffguard
on:
pull_request:
branches:
- '**'
types: [opened, synchronize, reopened]
concurrency:
group: diffguard-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
diffguard:
name: Quality metrics
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
# Mutation testing is CPU-heavy (one `go test` invocation per mutant,
# parallelized across cores). The 16-core runner matches the one used
# by govulncheck and keeps PR turnaround under ~10 min on typical diffs.
runs-on: ubuntu24.04-16core-64GB-600SSD-bor
steps:
- uses: actions/checkout@v5
with:
# diffguard needs the base branch history for `git diff` and
# `git log --follow`, so fetch the full history (shallow clones
# break merge-base resolution).
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-diffguard-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-diffguard-
- name: Install diffguard
run: go install github.com/0xPolygon/diffguard/cmd/diffguard@latest
- name: Run diffguard
id: diffguard
shell: bash
run: |
# Keep diffguard's exit code when tee writes the step summary.
set -o pipefail
diffguard \
--base origin/${{ github.base_ref }} \
--complexity-threshold 15 \
--complexity-delta-tolerance 5 \
--function-size-threshold 80 \
--function-size-delta-tolerance 15 \
--file-size-threshold 800 \
--file-size-delta-tolerance-pct 10 \
--file-size-delta-tolerance-floor 20 \
--tier1-threshold 80 \
--tier2-threshold 60 \
--mutation-sample-rate 20 \
--test-timeout 5m \
--output text \
--fail-on error \
. | tee "$GITHUB_STEP_SUMMARY"
- name: Upload JSON report
# Run even on failure so the survivor list is available for
# triage. Skip mutation here to keep the second run cheap — the
# text report above already contains the full mutation results.
if: always()
run: |
diffguard \
--base origin/${{ github.base_ref }} \
--skip-mutation \
--output json \
--fail-on none \
. > diffguard-report.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: diffguard-report
path: diffguard-report.json
retention-days: 14