forked from PrimeIntellect-ai/prime-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
365 lines (326 loc) · 12.2 KB
/
Copy pathci.yml
File metadata and controls
365 lines (326 loc) · 12.2 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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
name: CI
on:
workflow_call:
inputs:
checkout_ref:
description: Exact candidate commit to verify from a trusted Pylon workflow
required: false
type: string
require_trusted:
description: Fail the aggregate when a trusted caller is not recognized
required: false
default: false
type: boolean
push:
branches: [pylon]
pull_request:
branches: [pylon]
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ci-${{ inputs.checkout_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
trust:
name: Contributor trust
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
outputs:
allowed: ${{ steps.internal.outputs.allowed == 'true' || steps.sync.outputs.allowed == 'true' || steps.vouch.outputs.vouched == 'true' }}
steps:
- name: Recognize a trusted Pylon execution
id: internal
if: github.event_name == 'push' || inputs.checkout_ref != ''
env:
CHECKOUT_REF: ${{ inputs.checkout_ref }}
CALLER_EVENT: ${{ github.event_name }}
CALLER_REF: ${{ github.ref }}
CALLER_REPOSITORY: ${{ github.repository }}
run: |
if [[ "$CALLER_REPOSITORY" != "pylon-code/prime-agent" || "$CALLER_REF" != "refs/heads/pylon" ]]; then
exit 0
fi
if [[ "$CALLER_EVENT" == "push" && -z "$CHECKOUT_REF" ]]; then
echo "allowed=true" >> "$GITHUB_OUTPUT"
elif [[ ("$CALLER_EVENT" == "workflow_dispatch" || "$CALLER_EVENT" == "schedule") && "$CHECKOUT_REF" =~ ^[0-9a-f]{40}$ ]]; then
echo "allowed=true" >> "$GITHUB_OUTPUT"
fi
- name: Recognize the internal upstream sync pull request
id: sync
if: github.event_name == 'pull_request'
env:
HAS_SYNC_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'pylon-upstream-sync') }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
run: |
if [ "$HAS_SYNC_LABEL" = true ] && [ "$HEAD_REPOSITORY" = "pylon-code/prime-agent" ] && [[ "$HEAD_REF" == automation/prime-upstream-* ]]; then
echo "allowed=true" >> "$GITHUB_OUTPUT"
fi
- name: Check pull request author
id: vouch
if: github.event_name == 'pull_request' && steps.sync.outputs.allowed != 'true'
uses: mitchellh/vouch/action/check-user@d66fa29a64600490892131ad87597c30c91fcac4 # v1
with:
user: ${{ github.event.pull_request.user.login }}
allow-fail: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-check:
name: Build and check
needs: trust
if: needs.trust.outputs.allowed == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ inputs.checkout_ref || github.ref }}
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: npm
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev fd-find ripgrep
sudo ln -s "$(which fdfind)" /usr/local/bin/fd
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Check
run: npm run check
test:
name: Test (${{ matrix.name }})
needs: trust
if: needs.trust.outputs.allowed == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- name: agent-core
package: packages/agent
command: npm test
install_uv: false
- name: ai
package: packages/ai
command: npm test
install_uv: false
- name: tui
package: packages/tui
command: npm test
install_uv: false
- name: coding-agent 1/3
package: packages/coding-agent
command: npm run test:ci -- --shard=1/3
install_uv: true
- name: coding-agent 2/3
package: packages/coding-agent
command: npm run test:ci -- --shard=2/3
install_uv: true
- name: coding-agent 3/3
package: packages/coding-agent
command: npm run test:ci -- --shard=3/3
install_uv: true
- name: coding-agent process smoke
package: packages/coding-agent
command: npm run test:process
install_uv: true
- name: coding-agent kernel
package: packages/coding-agent
command: npm run test:kernel
install_uv: true
- name: runtime python
package: prime-agent-runtime
command: uv run python -m unittest discover -s test
install_uv: true
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ inputs.checkout_ref || github.ref }}
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: npm
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev fd-find ripgrep
sudo ln -s "$(which fdfind)" /usr/local/bin/fd
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Install uv
if: matrix.install_uv
run: |
python3 -m pip install --user uv
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Test
working-directory: ${{ matrix.package }}
run: ${{ matrix.command }}
owned-session-contract-windows:
name: Caller-owned session contract (Windows named pipe)
needs: trust
if: needs.trust.outputs.allowed == 'true'
runs-on: windows-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ inputs.checkout_ref || github.ref }}
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Test named-pipe owned cleanup
working-directory: packages/coding-agent
run: npx tsx ../../node_modules/vitest/dist/cli.js --run test/daemon-supervisor-process.test.ts -t "proves exact owned cleanup over a Windows named pipe"
pylon-artifact-pack:
name: Pylon artifact pack (${{ matrix.copy }})
needs: trust
if: needs.trust.outputs.allowed == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
copy: [a, b]
env:
PYLON_RELEASE_NODE: 22.23.2
PYLON_RELEASE_NPM: 11.10.1
steps:
- name: Checkout exact source
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ inputs.checkout_ref || github.ref }}
persist-credentials: false
fetch-depth: 1
- name: Setup pinned Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.PYLON_RELEASE_NODE }}
- name: Install pinned build inputs
run: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
npm install --global "npm@${PYLON_RELEASE_NPM}"
test "$(node --version)" = "v${PYLON_RELEASE_NODE}"
test "$(npm --version)" = "${PYLON_RELEASE_NPM}"
npm ci
- name: Test release contract
run: npm run test:pylon-release
- name: Build offline and pack without network
run: |
sudo env \
"PATH=$PATH" \
"HOME=$HOME" \
"GIT_CONFIG_COUNT=1" \
"GIT_CONFIG_KEY_0=safe.directory" \
"GIT_CONFIG_VALUE_0=$GITHUB_WORKSPACE" \
unshare --net -- npm run release:pylon:pack
- name: Verify artifact contract
run: npm run release:pylon:verify
- name: Upload candidate
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pylon-prime-pack-${{ matrix.copy }}
path: .npm/pylon-release/artifacts
include-hidden-files: true
if-no-files-found: error
retention-days: 3
pylon-artifact-reproducibility:
name: Pylon artifact reproducibility
needs: pylon-artifact-pack
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Download first isolated pack
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: pylon-prime-pack-a
path: pack-a
- name: Download second isolated pack
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: pylon-prime-pack-b
path: pack-b
- name: Require byte-identical outputs
run: diff --recursive --brief pack-a pack-b
pylon-artifact-install:
name: Pylon artifact install (${{ matrix.os }})
needs: [trust, pylon-artifact-pack, pylon-artifact-reproducibility]
if: needs.trust.outputs.allowed == 'true'
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15]
env:
PYLON_RELEASE_NODE: 22.23.2
PYLON_RELEASE_NPM: 11.10.1
steps:
- name: Checkout exact source
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ inputs.checkout_ref || github.ref }}
persist-credentials: false
fetch-depth: 1
- name: Setup pinned Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.PYLON_RELEASE_NODE }}
- name: Install pinned npm
run: npm install --global "npm@${{ env.PYLON_RELEASE_NPM }}"
- name: Download reproducible pack
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: pylon-prime-pack-a
path: .npm/pylon-release/artifacts
- name: Verify temporary-prefix runtime
run: npm run release:pylon:smoke
build-check-test:
name: build-check-test
if: always() && (needs.trust.outputs.allowed == 'true' || inputs.require_trusted)
needs:
- trust
- build-check
- test
- owned-session-contract-windows
- pylon-artifact-pack
- pylon-artifact-reproducibility
- pylon-artifact-install
runs-on: ubuntu-latest
steps:
- name: Verify CI results
env:
TRUST_ALLOWED: ${{ needs.trust.outputs.allowed }}
BUILD_CHECK_RESULT: ${{ needs.build-check.result }}
TEST_RESULT: ${{ needs.test.result }}
WINDOWS_OWNED_SESSION_RESULT: ${{ needs.owned-session-contract-windows.result }}
ARTIFACT_PACK_RESULT: ${{ needs.pylon-artifact-pack.result }}
ARTIFACT_REPRODUCIBILITY_RESULT: ${{ needs.pylon-artifact-reproducibility.result }}
ARTIFACT_INSTALL_RESULT: ${{ needs.pylon-artifact-install.result }}
run: |
test "$TRUST_ALLOWED" = true
test "$BUILD_CHECK_RESULT" = success
test "$TEST_RESULT" = success
test "$WINDOWS_OWNED_SESSION_RESULT" = success
test "$ARTIFACT_PACK_RESULT" = success
test "$ARTIFACT_REPRODUCIBILITY_RESULT" = success
test "$ARTIFACT_INSTALL_RESULT" = success