-
Notifications
You must be signed in to change notification settings - Fork 0
319 lines (273 loc) · 9.59 KB
/
pre-commit.yml
File metadata and controls
319 lines (273 loc) · 9.59 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
name: Pre-commit
on:
push:
branches:
- main
- master
- copilot/**
- copilot/initiate-full-ingestion
- ingestion-clean
- pr**
- "pr/**"
pull_request:
branches:
- "**"
# Limit permissions of GITHUB_TOKEN for security
permissions:
contents: read
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi
- name: Check formatting (black --check, ruff)
env:
PYTHONIOENCODING: utf-8
run: |
black --check src/ tests/ scripts/
ruff check src/ tests/
- name: Run custom validation hooks
env:
PYTHONIOENCODING: utf-8
run: |
python scripts/placeholder_scan.py
python scripts/validate_clf_schema.py
python scripts/validate_cdsce_schema.py
python scripts/validate_schemas.py --no-fail
ace-analyzer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi
- name: Run ACE analyzer
run: python scripts/ace_analyzer.py --years 2014-2025
- name: Verify ACE_REPORT.json generated
run: |
if [ ! -f ACE_REPORT.json ]; then
echo "ERROR: ACE_REPORT.json was not generated"
exit 1
fi
echo "ACE_REPORT.json successfully generated"
- name: Check for high-risk anomalies
run: python scripts/ace_analyzer.py --years 2014-2025 --fail-on-high-risk
continue-on-error: true
id: high_risk_check
- name: Report high-risk anomalies (warning only)
if: steps.high_risk_check.outcome == 'failure'
run: |
echo "::warning::High-risk anomalies (Score 5) detected. Review ACE_REPORT.json for details."
- name: Upload ACE reports
uses: actions/upload-artifact@v4
with:
name: ace-reports
path: |
ACE_REPORT.json
ACE_SUMMARY.md
ANOMALY_MAP.csv
ace_network_graph.json
retention-days: 30
vendor-map:
runs-on: ubuntu-latest
needs: ace-analyzer
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi
- name: Download ACE reports
uses: actions/download-artifact@v4.1.8
with:
name: ace-reports
- name: Run vendor tests
run: python -m pytest tests/vendor/ -v --tb=short
- name: Run vendor map extractor
run: |
python -c "
import sys
sys.path.insert(0, 'scripts')
from vendor_map_extractor import run_vendor_extraction
from pathlib import Path
result = run_vendor_extraction(Path('oraculus/corpus'), '2014-2025', Path('.'))
"
- name: Verify vendor outputs generated
run: |
echo 'Vendor map extraction completed (sample mode)'
echo 'In production, this would generate vendor_index.json'
- name: Upload vendor reports
uses: actions/upload-artifact@v4
with:
name: vendor-reports
path: |
vendor_graph.json
vendor_scores.json
vendor_influence_network.csv
CONTRACT_FLOW_MAP.json
PROCUREMENT_FLAGS.json
if-no-files-found: ignore
retention-days: 30
caim-analyzer:
runs-on: ubuntu-latest
needs: [ace-analyzer, vendor-map]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi
pip install matplotlib
- name: Download ACE reports
uses: actions/download-artifact@v4.1.8
with:
name: ace-reports
- name: Download vendor reports
uses: actions/download-artifact@v4.1.8
with:
name: vendor-reports
continue-on-error: true
- name: Run CAIM tests
run: python -m pytest tests/caim/ -v --tb=short
- name: Run agency extraction
run: |
python -c "
import sys
sys.path.insert(0, 'scripts')
from agency_map_extractor import run_agency_extraction
from pathlib import Path
result = run_agency_extraction(Path('oraculus/corpus'), '2014-2025', Path('.'))
"
- name: Run CAIM graph builder
run: |
python -c "
import sys
import json
sys.path.insert(0, 'scripts')
from agency_map_extractor import run_agency_extraction
from cross_agency_influence import run_cross_agency_influence
from pathlib import Path
# Run agency extraction
agency_data = run_agency_extraction(Path('oraculus/corpus'), '2014-2025')
# Run CAIM graph
run_cross_agency_influence(agency_data, '2014-2025', Path('.'))
"
- name: Run ICM matrix generator
run: |
python -c "
import sys
import json
sys.path.insert(0, 'scripts')
from agency_map_extractor import run_agency_extraction
from interdepartmental_matrix import run_icm_generation
from pathlib import Path
# Run agency extraction
agency_data = run_agency_extraction(Path('oraculus/corpus'), '2014-2025')
# Run ICM
run_icm_generation(agency_data, '2014-2025', Path('.'))
"
- name: Verify CAIM outputs generated
run: |
echo 'CAIM analysis completed'
echo 'Generated artifacts:'
ls -la *.json *.csv 2>/dev/null || echo 'No artifacts found (expected in sample mode)'
- name: Upload CAIM reports
uses: actions/upload-artifact@v4
with:
name: caim-reports
path: |
agency_graph.json
agency_index.json
cross_agency_edges.csv
influence_matrix.csv
icm_matrix.json
agency_correlation_heatmap.png
AGENCY_INFLUENCE_REPORT.md
ICM_EXPLANATION.md
if-no-files-found: ignore
retention-days: 30
pdf-forensics:
runs-on: ubuntu-latest
needs: ace-analyzer
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi
- name: Download ACE reports
uses: actions/download-artifact@v4.1.8
with:
name: ace-reports
- name: Run PDF forensics tests
run: python -m pytest tests/pdf_forensics/ -v --tb=short
- name: Run PDF forensics analyzer
run: |
python -c "
import sys
sys.path.insert(0, 'scripts')
from pdf_forensics.pdf_metadata_miner import run_pdf_forensics
from pathlib import Path
# Run PDF forensics
result = run_pdf_forensics(
corpus_root=Path('oraculus/corpus'),
year_range='2014-2025',
output_dir=Path('analysis/pdf_forensics'),
ace_report_path=Path('ACE_REPORT.json')
)
"
- name: Verify PDF forensics outputs generated
run: |
echo 'PDF Forensics analysis completed'
echo 'Generated artifacts:'
ls -la analysis/pdf_forensics/ 2>/dev/null || echo 'No artifacts found (expected in sample mode)'
- name: Upload PDF forensics reports
uses: actions/upload-artifact@v4
with:
name: pdf-forensics-reports
path: |
analysis/pdf_forensics/forensic_report.json
analysis/pdf_forensics/metadata_inconsistency_map.json
analysis/pdf_forensics/pdf_origin_clusters.json
analysis/pdf_forensics/pdf_forensics_graph.json
analysis/pdf_forensics/DPMM_SUMMARY.md
analysis/pdf_forensics/FORENSIC_ANOMALY_LINKS.json
analysis/pdf_forensics/FORENSIC_VENDOR_OVERLAPS.json
analysis/pdf_forensics/FORENSIC_AGENCY_PATTERNS.json
if-no-files-found: ignore
retention-days: 30