Repository navigation
205 lines (183 loc) · 8.2 KB
/
Copy pathci.yml
File metadata and controls
205 lines (183 loc) · 8.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
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
lint-workflows:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install workflow script linters
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install --yes shellcheck pyflakes3
- name: Lint workflow syntax
shell: bash
run: |
set -euo pipefail
actionlint_root="$(mktemp -d "$RUNNER_TEMP/actionlint.XXXXXX")"
trap 'rm -rf "$actionlint_root"' EXIT
curl --fail --silent --show-error --location \
https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz \
--output "$actionlint_root/actionlint.tar.gz"
printf '%s %s\n' \
8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 \
"$actionlint_root/actionlint.tar.gz" | sha256sum --check
tar -xzf "$actionlint_root/actionlint.tar.gz" -C "$actionlint_root" actionlint
shellcheck_path="$(command -v shellcheck)"
pyflakes_path="$(command -v pyflakes3)"
"$actionlint_root/actionlint" -shellcheck "$shellcheck_path" -pyflakes "$pyflakes_path"
dependency-audit:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.0
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Audit high-severity dependency advisories
run: bun audit --audit-level=high
check:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up project toolchain
uses: ./.github/actions/setup-project
- name: Run checks
run: bun run check
# Free and offline: the committed cassettes replay recorded model decisions
# against this build's runtime, so a change that refuses a sequence a real model
# already performed fails here rather than at the next paid matrix.
- name: Replay recorded model decisions
run: bun run replay
- name: Rebuild qualified 9.4.0 artifact without providers
timeout-minutes: 5
shell: bash
run: |
set -euo pipefail
version="$(node -p "require('./package.json').version")"
if [[ "$version" != "9.4.0" || ! -f "evals/qualification/archives/${version}.json" ]]; then
echo "No qualified 9.4.0 artifact rebuild declared."
exit 0
fi
archive_ci_root="$(mktemp -d)"
trap 'git worktree remove "$archive_ci_root/source"; rm -rf "$archive_ci_root"' EXIT
git worktree add --quiet --detach "$archive_ci_root/source" "refs/tags/v${version}"
bun run scripts/prepare-qualified-release-940.ts --repository-root "$archive_ci_root/source" --out "$archive_ci_root/opencode-plugin-flow-9.4.0.tgz"
- name: Regrade retained qualification archive without providers
shell: bash
run: |
set -euo pipefail
version="$(node -p "require('./package.json').version")"
if [ ! -f "evals/qualification/archives/${version}.json" ]; then
echo "No retained qualification archive declared."
exit 0
fi
if git rev-parse --verify --quiet "refs/tags/v${version}^{commit}" >/dev/null; then
qualification_ci_root="$(mktemp -d)"
trap 'git -C "$GITHUB_WORKSPACE" worktree remove "$qualification_ci_root/source"; rm -rf "$qualification_ci_root"' EXIT
git worktree add --quiet --detach "$qualification_ci_root/source" "refs/tags/v${version}"
cd "$qualification_ci_root/source"
bun install --frozen-lockfile
fi
bun -e '
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import { parseCanaryRecord } from "./scripts/eval-canary.ts";
import { assertQualificationBundle } from "./scripts/release-metadata.ts";
const evidenceRoot = process.env.GITHUB_WORKSPACE ?? process.cwd();
const { version } = JSON.parse(await readFile(join(evidenceRoot, "package.json"), "utf8"));
const parsed = parseCanaryRecord(JSON.parse(await readFile(join(evidenceRoot, "evals/canary/" + version + ".json"), "utf8")));
if (!parsed.ok) throw new Error(parsed.issues.join("; "));
await assertQualificationBundle({ version, directory: join(evidenceRoot, "evals/qualification/bundles"), expectedCanarySha256: parsed.value.recordSha256, now: new Date(parsed.value.recordedAt) });
console.log("RETAINED: archive regraded at its recorded canary time; no current-release freshness claim.");
'
platform-persistence:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up project toolchain
uses: ./.github/actions/setup-project
- name: Run platform filesystem checks
run: bun test tests/workspace-persistence.test.ts tests/source-identity.test.ts tests/flow-leadership.test.ts tests/test-results.test.ts tests/validation-capture.test.ts
live-smoke:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up project toolchain
uses: ./.github/actions/setup-project
- name: Run live OpenCode smoke
run: bun run smoke:live
patch-qualification:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out full release history
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 26
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.0
- name: Verify offline candidate when declared
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
shell: bash
run: |
set -euo pipefail
version="$(node -p "require('./package.json').version")"
record="evals/qualification/patches/${version}.json"
mode=--patch
if [ -f "evals/qualification/features/${version}.json" ]; then
if [ -f "$record" ]; then
echo "::error::Conflicting offline qualification records."
exit 1
fi
record="evals/qualification/features/${version}.json"
mode=--feature
fi
if [ ! -f "$record" ]; then
echo "No offline qualification declared; full qualification remains required."
exit 0
fi
if [ -n "$BASE_SHA" ]; then
old_version="$(git show "$BASE_SHA:package.json" | node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version")"
if [ "$old_version" = "$version" ] && git diff --quiet "$BASE_SHA" HEAD -- "$record"; then
echo "No new offline release declaration."
exit 0
fi
fi
bun install --frozen-lockfile
bun run build
bun run replay
bun run smoke:live
mkdir -p .release-artifacts/patch-ci
bun pm pack --destination .release-artifacts/patch-ci
bun scripts/release.ts init .release-artifacts/patch-ci/record \
--artifact ".release-artifacts/patch-ci/opencode-plugin-flow-${version}.tgz" \
"$mode" "$record" --commit "$GITHUB_SHA"