Repository navigation
198 lines (182 loc) · 9.17 KB
/
Copy pathci.yml
File metadata and controls
198 lines (182 loc) · 9.17 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: CI
# OwnAudit is pure-Python tooling (the .NET/WPF audit of STS runs on a Windows
# stand, not here), so CI runs the build-free test suites + a smoke of the SARIF
# export and dashboard build. No analyzers, no .NET — fast and deterministic.
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: test suites (bare python3)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- name: fix-arm + report suites
run: |
set -euo pipefail
PYTHONPATH=fix python3 fix/tests/test_ai_fix.py
PYTHONPATH=fix python3 fix/tests/test_own_fix.py
PYTHONPATH=fix python3 fix/tests/test_orchestrate.py
PYTHONPATH=. python3 identity/tests/test_pattern.py
PYTHONPATH=. python3 identity/tests/test_occurrence.py
PYTHONPATH=. python3 identity/tests/test_lineage_contract.py
PYTHONUTF8=1 PYTHONPATH=. python3 identity/tests/test_lineage_decision.py
PYTHONPATH=. python3 aggregate/tests/test_normalize.py
PYTHONPATH=. python3 report/tests/test_sarif.py
PYTHONPATH=. python3 report/tests/test_baseline.py
PYTHONPATH=. python3 report/tests/test_rules_map.py
PYTHONPATH=. python3 report/tests/test_annotate.py
PYTHONPATH=. python3 report/tests/test_exec.py
PYTHONPATH=. python3 viz/tests/test_dashboard_rules.py
PYTHONPATH=. python3 arch/tests/test_arch.py
PYTHONPATH=. python3 oracle/fixtures/test_oracle_arch.py
PYTHONPATH=. python3 oracle/fixtures/test_oracle_runtime.py
PYTHONPATH=. python3 runtime/tests/test_runtime.py
PYTHONPATH=. python3 runtime/tests/test_member_aware.py
PYTHONPATH=. python3 leakmine/tests/test_leakmine.py
- name: re-run under -O (assert-stripping safety)
run: |
set -euo pipefail
PYTHONPATH=fix python3 -O fix/tests/test_ai_fix.py
PYTHONPATH=fix python3 -O fix/tests/test_own_fix.py
PYTHONPATH=fix python3 -O fix/tests/test_orchestrate.py
PYTHONPATH=. python3 -O identity/tests/test_pattern.py
PYTHONPATH=. python3 -O identity/tests/test_occurrence.py
PYTHONPATH=. python3 -O identity/tests/test_lineage_contract.py
PYTHONUTF8=1 PYTHONPATH=. python3 -O identity/tests/test_lineage_decision.py
PYTHONPATH=. python3 -O aggregate/tests/test_normalize.py
PYTHONPATH=. python3 -O report/tests/test_sarif.py
PYTHONPATH=. python3 -O report/tests/test_baseline.py
PYTHONPATH=. python3 -O report/tests/test_rules_map.py
PYTHONPATH=. python3 -O report/tests/test_annotate.py
PYTHONPATH=. python3 -O report/tests/test_exec.py
PYTHONPATH=. python3 -O viz/tests/test_dashboard_rules.py
PYTHONPATH=. python3 -O arch/tests/test_arch.py
PYTHONPATH=. python3 -O oracle/fixtures/test_oracle_arch.py
PYTHONPATH=. python3 -O oracle/fixtures/test_oracle_runtime.py
PYTHONPATH=. python3 -O runtime/tests/test_runtime.py
PYTHONPATH=. python3 -O runtime/tests/test_member_aware.py
PYTHONPATH=. python3 -O leakmine/tests/test_leakmine.py
linetol-policy:
# OwnAudit#59. Run-Audit.ps1 itself cannot run in CI — it wants a worktree, a
# build and a Windows stand — so the clustering-tolerance decision lives in a
# pure function (scripts/LineTolPolicy.ps1) that can. The issue is explicit
# that this must not be accepted by reading the code, hence a real interpreter
# on a real Windows runner.
#
# Both shells on Windows: the script's own examples invoke `pwsh`, but a stand
# that still has only Windows PowerShell 5.1 must not silently get different
# tolerances. Ubuntu covers the pwsh-on-Linux path a contributor is likely to
# use locally.
name: line-tol policy matrix (${{ matrix.os }} / pwsh)
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Resolve-LineTol decision matrix
shell: pwsh
run: ./scripts/tests/Test-LineTolPolicy.ps1
linetol-policy-ps51:
# Split out rather than folded into the matrix above: `shell:` accepts no
# expression, so `${{ matrix.shell }}` is rejected by the workflow schema.
# Launching the interpreter by hand from bash would sidestep that, but GitHub
# sets $ErrorActionPreference and the invocation form per shell, and a fidelity
# test should run under the shell it claims to cover, not near it.
name: line-tol policy matrix (windows-latest / Windows PowerShell 5.1)
runs-on: windows-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Resolve-LineTol decision matrix
shell: powershell
run: ./scripts/tests/Test-LineTolPolicy.ps1
runner-shell-contract:
# OwnAudit#64. The runners are pwsh-only; the contract is that Windows
# PowerShell 5.1 can still READ them and refuse them for a true reason,
# instead of dying on a syntax error inside a word in a comment. Windows only:
# the defect is Windows 5.1 decoding a BOM-less file in the system ANSI
# codepage, and no Linux runner reproduces it.
name: runner shell contract (windows-latest / pwsh)
runs-on: windows-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: ASCII, #Requires, and parse under pwsh
shell: pwsh
run: ./scripts/tests/Test-RunnerShellContract.ps1
runner-shell-contract-ps51:
# The leg that actually covers the defect. Split out for the same reason as
# linetol-policy-ps51: `shell:` accepts no expression, so a matrix cannot
# carry it. Here the suite invokes each runner for real and asserts the
# refusal names the version and leaves no -Out directory behind.
name: runner shell contract (windows-latest / Windows PowerShell 5.1)
runs-on: windows-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: 5.1 reads the runners and refuses them by version
shell: powershell
run: ./scripts/tests/Test-RunnerShellContract.ps1
audit-report:
name: SARIF export + dashboard smoke
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
# GitHub-friendly SARIF (warning+), plus metrics.json / report.md.
# Runs against the committed synthetic fixture, not the stand-only sts_audit
# corpus, so CI stays green (and leaks nothing) once sts_audit is removed.
- name: Export audit artifacts
run: PYTHONPATH=. python3 -m report.cli --min-level warning --findings viz/fixtures/findings.json
# Catches Python/JS-template regressions in the dashboards (no unit tests there).
# Points at viz/fixtures (synthetic golden set) for the same reason as above.
# The arch dashboard renders empty-state here (graph.json/runtime.json are stand-only).
- name: Build dashboards (smoke)
run: |
set -euo pipefail
# raw path: renders straight from findings.json
python3 viz/build_dashboard.py viz/fixtures
# FP-judge triaged path: merge the overlay (also exercises apply_verdicts'
# staleness guard + merge), then re-render — build_dashboard auto-prefers the
# freshly written findings-triaged.json and renders the triage view.
python3 viz/apply_verdicts.py --findings viz/fixtures/findings.json \
--overlay viz/fixtures/fp-verdicts.json --out viz/fixtures/findings-triaged.json
python3 viz/build_dashboard.py viz/fixtures
python3 viz/build_arch_dashboard.py
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ownnet-audit
path: report/out/
if-no-files-found: error
# To surface findings in the Security tab when running against the STS repo
# itself, drop the cap (export the full set) and upload to code scanning:
# permissions: { security-events: write }
# - run: PYTHONPATH=. python3 -m report.cli --max-results 0
# - uses: github/codeql-action/upload-sarif@v3
# with: { sarif_file: report/out/ownnet-audit.sarif }
# (Skipped here: findings.json paths point at the external STS tree, not OwnAudit.)