-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (105 loc) · 3.75 KB
/
Copy pathquorum-validate.yml
File metadata and controls
124 lines (105 loc) · 3.75 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
# SPDX-License-Identifier: MIT
# Quorum Self-Validation CI Gate
# Runs standard-depth validation on changed files for every PR to main.
# Requires ANTHROPIC_API_KEY_GH_SHAREDIN_QUORUM in repository secrets.
name: Quorum Validation
on:
pull_request:
branches: [main]
workflow_dispatch:
inputs:
depth:
description: 'Validation depth (quick/standard/thorough)'
required: false
default: 'standard'
max_cost:
description: 'Maximum cost in USD'
required: false
default: '5.00'
permissions:
contents: read
pull-requests: write
jobs:
validate:
name: Quorum Self-Validation
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for diff
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Quorum
working-directory: reference-implementation
run: |
pip install -e ".[dev]"
pip install ruff bandit # Optional SAST tools for pre-screen
- name: Detect changed files
id: changes
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE="${{ github.event.pull_request.base.sha }}"
else
BASE="HEAD~1"
fi
# Get changed files that Quorum can validate
# NOTE: Currently limited to Python files — Quorum auto-detects the
# python-code rubric for .py files. Other file types (markdown, YAML,
# etc.) will be added once dedicated rubrics are available.
CHANGED=$(git diff --name-only "$BASE" HEAD -- \
'*.py' \
| grep -v '__pycache__' \
| grep -v '.github/' \
| head -50)
if [ -z "$CHANGED" ]; then
echo "No validatable files changed."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
COUNT=$(echo "$CHANGED" | wc -l | tr -d ' ')
echo "Found $COUNT changed files to validate"
echo "$CHANGED"
# Write to file for quorum to consume
echo "$CHANGED" > /tmp/changed-files.txt
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "count=$COUNT" >> "$GITHUB_OUTPUT"
fi
- name: Run Quorum validation
if: steps.changes.outputs.skip != 'true'
working-directory: reference-implementation
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY_GH_SHAREDIN_QUORUM }}
run: |
DEPTH="${{ github.event.inputs.depth || 'standard' }}"
MAX_COST="${{ github.event.inputs.max_cost || '5.00' }}"
echo "::group::Quorum validation ($DEPTH depth, max \$$MAX_COST)"
EXIT_CODE=0
while IFS= read -r file; do
[ -f "$file" ] || [ -f "../$file" ] || continue
# Resolve path — files may be relative to repo root
if [ -f "../$file" ]; then
TARGET="../$file"
else
TARGET="$file"
fi
echo "── Validating: $file ──"
python -m quorum run \
--target "$TARGET" \
--depth "$DEPTH" \
--max-cost "$MAX_COST" \
--yes \
--audit-report \
2>&1 || EXIT_CODE=1
done < /tmp/changed-files.txt
echo "::endgroup::"
exit $EXIT_CODE
- name: Skip notice
if: steps.changes.outputs.skip == 'true'
run: echo "No validatable files changed — skipping Quorum validation."
- name: Run tests
working-directory: reference-implementation
run: |
python -m pytest --tb=short -q 2>&1 | tail -5