Repository navigation
110 lines (110 loc) · 4.66 KB
/
Copy pathci.yml
File metadata and controls
110 lines (110 loc) · 4.66 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
name: Local-equivalent verification
on:
pull_request:
branches: [main]
workflow_dispatch:
inputs:
base:
required: true
type: string
head:
required: true
type: string
release_qualification:
description: Run the full suite before publishing a PyPI release
type: boolean
default: false
permissions:
contents: read
concurrency:
group: toad-verification-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
nra-gate:
name: NRA gate
timeout-minutes: 5
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || inputs.head }}
- uses: actions/setup-python@v5
with:
python-version: '3.14'
- uses: ./.github/actions/core-from-main
with:
path: .core-gate
- name: Install Core's declared checker dependencies
run: |
python - <<'PY'
import pathlib, subprocess, tomllib
source = tomllib.loads(pathlib.Path('.core-gate/pyproject.toml').read_text())
subprocess.run(['uv', 'pip', 'install', '--python', '.venv/bin/python',
*source['project']['optional-dependencies']['dev']], check=True)
PY
- name: Compare production source
id: gate
env:
# pull_request.base.sha is not refreshed when the base branch moves, so it can name a
# revision many commits behind and charge the PR for debt main introduced. The PR's own
# change starts at the merge-base with the base branch's current tip.
BASE_TIP: ${{ github.event.pull_request.base.ref && format('origin/{0}', github.event.pull_request.base.ref) || inputs.base }}
PR_HEAD: ${{ github.event.pull_request.head.sha || inputs.head }}
# The verdict lines go to stderr; they are kept for the pull request comment below.
run: |
status=0
PYTHONPATH="$PWD/.core-gate/src" PATH="$PWD/.venv/bin:$PATH" .venv/bin/python .core-gate/tools/nra_client_gate.py --root src/toad --base "$(git merge-base "$BASE_TIP" "$PR_HEAD")" --head "$PR_HEAD" 2>gate-findings.txt || status=$?
cat gate-findings.txt >&2
exit "$status"
- name: Run surface guards
run: .venv/bin/pytest tests/guards
# Core owns the comment: the same action and Core commit as the gate itself.
- name: The gate's findings on the pull request
if: always() && github.event_name == 'pull_request' && contains(fromJSON('["success","failure"]'), steps.gate.outcome)
uses: ./.core-gate/.github/actions/nra-findings
with:
findings: gate-findings.txt
kind: debt-src
outcome: ${{ steps.gate.outcome }}
suite:
if: ${{ inputs.release_qualification }}
runs-on: ubuntu-latest
# A hung test must turn red in minutes, not burn GitHub's 6-hour default.
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || inputs.head }}
- uses: actions/setup-python@v5
with:
python-version: '3.14'
- uses: ./.github/actions/core-from-main
with:
path: .artifacts/core
- run: uv sync --project .artifacts/core/stack
# Core's own preparation, with the stock Pi and node it pins.
- uses: ./.artifacts/core/.github/actions/prepare-native
with:
core: .artifacts/core
python: ${{ github.workspace }}/.artifacts/core/stack/.venv/bin/python
- name: Qualify the native package from the resolved Core
run: |
.venv/bin/python - <<'PYCORE'
import os
from pathlib import Path
from agent_comms.native_package import VerifiedNativePackage
package, = Path('.artifacts/core/stack').glob('.pi-native-*/node_modules/@earendil-works/pi-coding-agent')
VerifiedNativePackage.qualify(package.resolve())
with open(os.environ['GITHUB_ENV'], 'a') as env:
env.write(f'AC_NATIVE_COPIED_PACKAGE={package.resolve()}\n')
PYCORE
- name: Prepare the declared Neovim requirement
run: .venv/bin/python -m toad.neovim_runtime
# xdist reports a collection error as a worker crash; collect alone first so it reads as one.
- run: .venv/bin/pytest --collect-only -q
# A test stuck past 120 s dumps every thread, so the red names where it hung.
- run: .venv/bin/pytest -n auto --basetemp .artifacts/pilots -o faulthandler_timeout=120 -rfE -vv --tb=short --durations=40