-
Notifications
You must be signed in to change notification settings - Fork 0
214 lines (182 loc) · 6.39 KB
/
ci.yml
File metadata and controls
214 lines (182 loc) · 6.39 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
name: CI
on:
workflow_dispatch:
push:
branches:
- main
- "autoloop/**"
pull_request:
branches:
- main
permissions:
contents: read
checks: write
jobs:
test:
name: Test & Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Type check
run: bun run typecheck
- name: Lint
run: bun run lint
- name: Test
run: bun test --coverage ./tests/
playground-e2e:
name: Playground E2E (Playwright)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('bun.lock') }}
- name: Install Playwright browsers
run: bunx playwright install --with-deps chromium
- name: Run Playwright playground tests
run: bun run test:e2e
build:
name: Build
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build library
run: bun build ./src/index.ts --outdir ./dist --target browser --minify
- name: Upload dist artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
validate-python-examples:
name: Validate Python Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
run: pip install pandas numpy
- name: Validate Python playground examples
run: python scripts/validate-python-examples.py playground/
benchmark:
# Run the OpenEvolve benchmark for autoloop *-evolve PRs so the autoloop
# agent can read a real fitness number from CI (see .autoloop/strategies/
# openevolve/strategy.md, Step 6.5). The sandbox the agent runs in cannot
# install bun reliably and so cannot measure fitness itself.
name: OpenEvolve benchmark
if: |
(github.event_name == 'pull_request' && startsWith(github.head_ref, 'autoloop/') && contains(github.head_ref, '-evolve'))
|| (github.event_name == 'push' && startsWith(github.ref_name, 'autoloop/') && contains(github.ref_name, '-evolve'))
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
run: pip install pandas numpy
- name: Resolve program directory
id: program
run: |
# Resolve the program directory from the branch name:
# autoloop/<program-name> → .autoloop/programs/<program-name>/
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
PROGRAM="${BRANCH#autoloop/}"
PROGRAM_DIR=".autoloop/programs/${PROGRAM}"
echo "program=${PROGRAM}" >> "$GITHUB_OUTPUT"
echo "program_dir=${PROGRAM_DIR}" >> "$GITHUB_OUTPUT"
if [ -x "${PROGRAM_DIR}/evaluate.sh" ]; then
echo "has_evaluator=true" >> "$GITHUB_OUTPUT"
else
echo "No evaluate.sh for program '${PROGRAM}' — skipping benchmark." >&2
echo "has_evaluator=false" >> "$GITHUB_OUTPUT"
fi
- name: Run OpenEvolve benchmark
id: bench
if: steps.program.outputs.has_evaluator == 'true'
run: |
PROGRAM_DIR="${{ steps.program.outputs.program_dir }}"
# evaluate.sh is contracted to always exit 0 and encode failures in
# the JSON, but we tolerate non-zero exits anyway and fall back to a
# null fitness so the check-run still gets created.
set +e
bash "${PROGRAM_DIR}/evaluate.sh" >/tmp/bench-result.json 2>/tmp/bench-stderr
rc=$?
set -e
if [ ! -s /tmp/bench-result.json ]; then
echo "{\"fitness\": null, \"rejected_reason\": \"evaluator produced no output (exit ${rc})\"}" \
> /tmp/bench-result.json
fi
cat /tmp/bench-result.json
fitness=$(jq -r '.fitness // "null"' /tmp/bench-result.json)
echo "fitness=${fitness}" >> "$GITHUB_OUTPUT"
# Compact JSON for the check-run output below.
echo "result_json=$(jq -c . /tmp/bench-result.json)" >> "$GITHUB_OUTPUT"
- name: Upload benchmark result
if: steps.program.outputs.has_evaluator == 'true'
uses: actions/upload-artifact@v4
with:
name: benchmark-result
path: /tmp/bench-result.json
- name: Attach fitness as check-run
if: steps.program.outputs.has_evaluator == 'true'
uses: actions/github-script@v7
env:
FITNESS: ${{ steps.bench.outputs.fitness }}
RESULT_JSON: ${{ steps.bench.outputs.result_json }}
with:
script: |
const fitness = process.env.FITNESS;
let result;
try {
result = JSON.parse(process.env.RESULT_JSON);
} catch {
result = { raw: process.env.RESULT_JSON };
}
const sha = context.payload.pull_request
? context.payload.pull_request.head.sha
: context.sha;
await github.rest.checks.create({
...context.repo,
name: "OpenEvolve benchmark",
head_sha: sha,
status: "completed",
conclusion: fitness === "null" ? "neutral" : "success",
output: {
title: `fitness=${fitness}`,
summary: "```json\n" + JSON.stringify(result, null, 2) + "\n```",
},
});