Repository navigation
241 lines (206 loc) · 8.16 KB
/
Copy pathtest.yml
File metadata and controls
241 lines (206 loc) · 8.16 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
name: Test
on:
workflow_call:
workflow_dispatch:
schedule:
- cron: "17 3 * * *"
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened, edited]
permissions:
contents: read
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
snapshot-provenance:
name: Snapshot provenance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Require provenance evaluation for snapshot runtime changes
if: github.event_name == 'pull_request'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_BODY: ${{ github.event.pull_request.body }}
run: >-
python .github/scripts/check_snapshot_provenance.py
--base "$BASE_SHA" --head "$HEAD_SHA" --require-decision
- name: Enforce append-only provenance outside pull requests
if: github.event_name != 'pull_request'
env:
BEFORE_SHA: ${{ github.event.before }}
HEAD_SHA: ${{ github.sha }}
REF_TYPE: ${{ github.ref_type }}
run: |
if [ "$REF_TYPE" = "tag" ]; then
BASE_SHA=$(git describe --tags --abbrev=0 "${HEAD_SHA}^" 2>/dev/null || git rev-list --max-parents=0 "$HEAD_SHA")
else
BASE_SHA="$BEFORE_SHA"
if ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then
BASE_SHA=$(git rev-list --max-parents=0 "$HEAD_SHA")
fi
fi
python .github/scripts/check_snapshot_provenance.py --base "$BASE_SHA" --head "$HEAD_SHA"
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Ruff lint check
run: ruff check .
- name: Black format check
run: black --check .
- name: basedPyright check
run: python -m basedpyright --pythonpath "$(python -c 'import sys; print(sys.executable)')"
browser:
name: Frame-tree browser regression
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install browser test dependencies
run: |
pip install -e ".[dev]"
python -m playwright install --with-deps chromium
- name: Run required Chromium interaction tests
env:
PT_SNAP_REQUIRE_BROWSER: "1"
# Required mode rejects missing dependencies, skips and incomplete execution.
run: pytest -rs tests/test_fixture_provenance.py tests/test_memory_tree_browser.py
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Verify executable fixture provenance
run: pytest tests/test_fixture_provenance.py
- name: Run non-slow compatibility tests
if: matrix.python-version != '3.13'
run: pytest -m "not slow and not nightly"
- name: Run full PR tests with coverage
if: matrix.python-version == '3.13'
run: pytest -m "not nightly" --cov --cov-report=xml --cov-report=term-missing
- name: Guard critical runtime coverage
if: matrix.python-version == '3.13'
# Separate floors prevent strong modules from masking a weak boundary.
run: python .github/scripts/check_critical_coverage.py
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: matrix.python-version == '3.13' && always()
with:
name: coverage-report
path: coverage.xml
retention-days: 30
- name: Build wheel
if: matrix.python-version == '3.13'
run: |
python -m pip install --upgrade build
python -m build --wheel
- name: Audit wheel contents against source
if: matrix.python-version == '3.13'
run: |
set -euo pipefail
WHEEL=$(python -c 'from pathlib import Path; wheels = sorted(Path("dist").glob("*.whl")); assert len(wheels) == 1, wheels; print(wheels[0])')
python .github/scripts/audit_wheel.py --wheel "$WHEEL"
- name: Clean-wheel Agent acceptance
if: matrix.python-version == '3.13'
run: |
set -euo pipefail
WHEEL=$(python -c 'from pathlib import Path; wheels = sorted(Path("dist").glob("*.whl")); assert len(wheels) == 1, wheels; print(wheels[0])')
python .github/scripts/clean_wheel_agent_acceptance.py \
--wheel "$WHEEL" \
--fixture tests/fixtures/snapshots/snapshot_with_empty_cache.pkl \
--events-per-slice 4096
dataset-acceptance:
name: Installed-wheel dataset acceptance
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.sha }}
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Verify executable fixture provenance
run: pytest tests/test_fixture_provenance.py
- name: Build wheel
run: python -m build --wheel
- name: Audit wheel contents against source
run: |
set -euo pipefail
WHEEL=$(python -c 'from pathlib import Path; wheels = sorted(Path("dist").glob("*.whl")); assert len(wheels) == 1, wheels; print(wheels[0])')
python .github/scripts/audit_wheel.py --wheel "$WHEEL"
- name: Run required installed-wheel dataset acceptance
run: |
set -euo pipefail
WHEEL=$(python -c 'from pathlib import Path; wheels = sorted(Path("dist").glob("*.whl")); assert len(wheels) == 1, wheels; print(wheels[0])')
python .github/scripts/run_dataset_acceptance.py \
--wheel "$WHEEL" --output-dir .tmp/dataset-acceptance
- name: Run required 200-seed paired differential acceptance
run: |
python .github/scripts/run_differential_acceptance.py \
--seed-count 200 --output-dir .tmp/differential-acceptance
- name: Upload dataset acceptance evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: dataset-acceptance-${{ github.sha }}
path: .tmp/dataset-acceptance/
include-hidden-files: true
if-no-files-found: error
retention-days: 30
- name: Upload paired differential evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: differential-acceptance-${{ github.sha }}
path: |
.tmp/differential-acceptance/*.log
.tmp/differential-acceptance/*.xml
.tmp/differential-acceptance/summary.json
.tmp/differential-acceptance/pytest-temp/**/coverage.json
.tmp/differential-acceptance/pytest-temp/**/timeline.json
.tmp/differential-acceptance/pytest-temp/**/differential-failure.json
include-hidden-files: true
if-no-files-found: error
retention-days: 30