-
Notifications
You must be signed in to change notification settings - Fork 16
243 lines (203 loc) · 8.85 KB
/
Copy pathci.yml
File metadata and controls
243 lines (203 loc) · 8.85 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
# ============================================================================
# CI — cap-evolve specific continuous integration
# ============================================================================
#
# PURPOSE:
# Runs parallel jobs on every push to main and every pull request:
# 1. test-python — installs cap-evolve-core[dev] and capevolve-dashboard[dev], then
# runs pytest on core/tests/ and dashboard/backend/tests/
# 2. build-dashboard — installs dashboard/frontend dependencies, runs npm build + vitest
# 3. toy-example — runs the zero-API toy_calc example and asserts test_reward 1.0
# 4. docs-links — checks relative links/images in Markdown resolve (offline), and
# that every documented `cap-evolve <sub>` exists in the CLI (#203)
# 5. spellcheck — codespell over README + docs
#
# No shared-workflow delegation needed: this is repo-specific CI.
# ============================================================================
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test-python:
name: Test Python (core + dashboard backend)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install cap-evolve-core with dev extras
run: pip install -e "./core[dev]"
- name: Run pytest
run: python -m pytest core/tests -q
- name: Install dashboard backend with dev extras
run: pip install -e "./dashboard/backend[dev]"
- name: Run pytest (dashboard backend)
run: python -m pytest dashboard/backend/tests -q
build-dashboard:
name: Build Dashboard (frontend)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js 22
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
working-directory: dashboard/frontend
run: npm ci
- name: Build
working-directory: dashboard/frontend
run: npm run build
- name: Unit tests (vitest)
working-directory: dashboard/frontend
run: npm test
# dist/ is intentionally COMMITTED (the backend serves the prebuilt SPA), so a PR
# that edits src/ without rebuilding ships the OLD behavior while CI stays green.
# Fail on drift. See #188 for the broader committed-dist/ design problem.
- name: Fail if the committed dist/ bundle is stale
run: |
if ! git diff --exit-code -- dashboard/frontend/dist; then
echo "::error::dashboard/frontend/dist is stale. Run 'cd dashboard/frontend && npm ci && npm run build' and commit the result."
exit 1
fi
# A changed bundle hash renames the file, so it shows up as UNTRACKED, not
# modified — git diff alone would miss it.
untracked="$(git ls-files --others --exclude-standard -- dashboard/frontend/dist)"
if [ -n "$untracked" ]; then
echo "::error::the fresh build produced files missing from the committed dashboard/frontend/dist:"
echo "$untracked"
exit 1
fi
toy-example:
name: Toy example (zero-API)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install cap-evolve-core
run: pip install ./core
- name: Run toy_calc and assert honest improvement
run: |
set -euo pipefail
out="$(bash examples/toy_calc/run.sh)"
echo "$out"
echo "$out" | grep -q '"baseline_val": 0.0' \
&& echo "$out" | grep -q '"test_reward": 1.0' \
|| { echo "::error::toy_calc did not reach baseline_val 0.0 -> test_reward 1.0"; exit 1; }
install-smoke:
name: Install smoke (./install.sh, then run from the install)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install cap-evolve-core
run: pip install ./core
- name: Install via ./install.sh through the --host mapping
env:
# A clean HOME so `--host claude` lands somewhere this job owns.
HOME: ${{ runner.temp }}/fakehome
run: |
set -euo pipefail
# Unset, or detect_dest short-circuits to the checkout and the --host
# mapping plus the copy loop are never exercised (what toy-example does).
unset CAPEVOLVE_SKILLS_DIR
mkdir -p "$HOME"
./install.sh --host claude
# The installed tree must carry the optimizer registry, not just skill dirs.
test -f "$HOME/.claude/skills/optimizers/registry.yaml"
- name: cap-evolve entry point is importable and runnable
run: |
set -euo pipefail
python -c 'import cap_evolve, cap_evolve.cli'
cap-evolve --version
- name: Run toy_calc FROM THE INSTALL, outside the repo tree
env:
HOME: ${{ runner.temp }}/fakehome
run: |
set -euo pipefail
R="$PWD"; D="$(mktemp -d)"
mkdir -p "$D/.capevolve/project/adapters"
cp "$R/examples/toy_calc/adapter.py" "$D/.capevolve/project/adapters/"
cp -R "$R/examples/toy_calc/capability" "$D/seed_capability"
cp "$R/templates/project/capevolve.yaml" "$D/.capevolve/project/capevolve.yaml"
# OUTSIDE the repo: run.py's parent-walk would otherwise find the checkout's
# optimizers/registry.yaml and this assertion would prove nothing.
cd "$D"
export CAPEVOLVE_SKILLS_DIR="$HOME/.claude/skills"
export CAPEVOLVE_TOY_DATA="$R/examples/toy_calc"
export CAPEVOLVE_MOCK_SCRIPT="$R/examples/toy_calc/mock_script.json"
out="$(cap-evolve run --spec "$D/.capevolve/project/capevolve.yaml" \
--project "$D/.capevolve/project" --run-ts ci)"
echo "$out"
# Assert the OUTCOME, not the exit code: an install that cannot run an
# optimizer keeps the seed and reports test_reward 0.0 while exiting 0.
echo "$out" | grep -q '"test_reward": 1.0' \
|| { echo "::error::the installed tree ran but optimized nothing"; exit 1; }
docs-links:
name: Docs link check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check relative Markdown links and images (offline)
uses: lycheeverse/lychee-action@v2
with:
args: >-
--offline --no-progress --include-fragments
--exclude-path examples/tau2_airline/run_full
--exclude-path examples/skillsbench/run_full
"README.md" "docs/**/*.md" "examples/**/*.md" "*.md"
fail: true
# Docs/skills/code must not instruct agents to run a `cap-evolve <sub>` that does
# not exist (issue #203). The valid set is parsed out of core/cap_evolve/cli.py, so
# no install is needed and the check cannot drift from the CLI.
- name: Check documented cap-evolve subcommands exist
run: python3 ci/check_cli_subcommands.py
lint-skills:
name: Skill authoring lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Points the shipped skill-package validator at the repo's OWN skills, so the
# framework is held to the authoring bar it advertises in CONTRIBUTING.md.
#
# BLOCKING, with no violation baseline. It was designed report-only against a
# 14-violation baseline while the skills were rewritten under #322-#339; that
# sweep cleared all 14, so the tree is clean and the next violation is a
# regression to fix rather than debt to record. Advisory findings (description
# style, bundled-script self-check) print but never fail the step.
- name: Lint bundled skills against the authoring rules
run: python skills/_registry/lint_skills.py skills
spellcheck:
name: Spellcheck (docs)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: codespell
uses: codespell-project/actions-codespell@v2
with:
path: README.md docs
skip: docs/sources.bib,docs/assets,docs/superpowers
ignore_words_list: nd,te,ba,alls,ist,fo,ans,crate,ede,hel,optimizer,capevolve,noteb,fpr
# Made with Bob