Repository navigation
310 lines (309 loc) · 15.4 KB
/
Copy pathopencode-native-e2e.yml
File metadata and controls
310 lines (309 loc) · 15.4 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
name: OpenCode installed dual native E2E (qualification required)
on:
workflow_dispatch:
inputs:
plan:
description: Original qualification plans or seven immutable release recovery cells
type: choice
options: [all-eleven, portable-eight, release-recovery]
default: all-eleven
required: true
evidence_url:
description: 'HTTPS parent evidence tar sealed after exact clean source checkout/build; no SDK copies or grants'
type: string
required: false
evidence_sha256:
description: 'Reviewed SHA256 of that immutable external evidence tar'
type: string
required: true
recovery_run_id:
description: 'Original completed v1.48.1 release workflow run with successful builds and canaries'
type: string
required: false
candidate_sha:
description: 'Exact immutable release source SHA, required only for release-recovery'
type: string
required: false
recovery_cells:
description: 'Fresh primitive and business evidence scope, only for release-recovery'
type: choice
options: [first-linux-amd64-v2, windows-two, all-seven]
default: first-linux-amd64-v2
required: true
# Only a newer run for the same PR supersedes its checks.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
native:
if: inputs.plan != 'release-recovery'
name: '${{ matrix.target.platform }}/${{ matrix.target.arch }} ${{ matrix.version }}'
runs-on: ${{ matrix.target.runner }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
version: ['1.18.33', '2.0.21']
target: ${{ fromJSON(inputs.plan == 'portable-eight' && '[{"runner":"ubuntu-22.04-arm","platform":"linux","arch":"arm64"},{"runner":"macos-15","platform":"darwin","arch":"arm64"},{"runner":"macos-15-intel","platform":"darwin","arch":"amd64"},{"runner":"windows-latest","platform":"windows","arch":"amd64"}]' || '[{"runner":"ubuntu-22.04","platform":"linux","arch":"amd64"},{"runner":"ubuntu-22.04-arm","platform":"linux","arch":"arm64"},{"runner":"macos-15","platform":"darwin","arch":"arm64"},{"runner":"macos-15-intel","platform":"darwin","arch":"amd64"},{"runner":"windows-latest","platform":"windows","arch":"amd64"}]') }}
include: ${{ fromJSON(inputs.plan == 'portable-eight' && '[]' || '[{"version":"1.18.34","target":{"runner":"ubuntu-22.04","platform":"linux","arch":"amd64"}}]') }}
env:
AN_EVIDENCE_URL: ${{ inputs.evidence_url }}
AN_EVIDENCE_SHA256: ${{ inputs.evidence_sha256 }}
AN_OS: ${{ matrix.target.platform }}
AN_ARCH: ${{ matrix.target.arch }}
AN_VERSION: ${{ matrix.version }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- uses: actions/setup-go@v7
with: {go-version: '1.27', cache: false}
- uses: actions/setup-node@v6
with: {node-version: '24.21.0'}
- uses: actions/setup-python@v7
with: {python-version: '3.12'}
- name: Initialize unqualified report before any fixture check
shell: bash
run: |
mkdir -p .task-tools/artifacts
python -c 'import json,pathlib; pathlib.Path(".task-tools/artifacts/native-report.json").write_text(json.dumps({"status":"unqualified","businessPhasesStarted":False,"firstFailedPrerequisite":"fixture_checks_not_completed"})+"\n")'
- name: Inert fixture parser checks
run: python -B scripts/testdata/opencode-native-e2e/test_fixture.py
- name: Linux build and private bus prerequisites
if: matrix.target.platform == 'linux'
run: sudo apt-get update && sudo apt-get install -y libasound2-dev dbus iproute2
- name: Stage immutable external parent artifacts
id: parent
shell: bash
run: python -B scripts/testdata/opencode-native-e2e/ci_inputs.py --stage-evidence
- name: Verify exact source, clean build and bundle/SDK bytes before any host
shell: bash
env:
AN_MANIFEST: ${{ steps.parent.outputs.manifest }}
AN_MANIFEST_SHA256: ${{ steps.parent.outputs.sha256 }}
run: python -B scripts/testdata/opencode-native-e2e/ci_inputs.py
- name: Preserve managed native and Windows path protocol checks
shell: bash
run: |
set -euo pipefail
go test -count=1 ./internal/opencodeinstall ./internal/desktopinstall -run 'Test.*(Native|Shortcut|Desktop)'
- name: Guard and execute exact reviewed installed fixture
shell: bash
env:
AN_MANIFEST: ${{ steps.parent.outputs.manifest }}
AN_MANIFEST_SHA256: ${{ steps.parent.outputs.sha256 }}
run: |
set -euo pipefail
export AN_SUITE=business
if [ "$AN_OS/$AN_ARCH" = linux/amd64 ]; then export AN_SUITE=full; fi
if [ "$AN_OS" = linux ]; then
sudo --preserve-env=PATH,AN_MANIFEST,AN_MANIFEST_SHA256,AN_OS,AN_ARCH,AN_VERSION,AN_SUITE unshare --net -- bash -c 'ip link set lo up; python -B scripts/testdata/opencode-native-e2e/ci_inputs.py --execute'
else
python -B scripts/testdata/opencode-native-e2e/ci_inputs.py --execute
fi
- uses: actions/upload-artifact@v7
if: always()
with:
name: opencode-native-${{ matrix.target.platform }}-${{ matrix.target.arch }}-${{ matrix.version }}
path: .task-tools/artifacts/native-report.json
if-no-files-found: error
retention-days: 14
recovery-inputs:
if: inputs.plan == 'release-recovery'
runs-on: ubuntu-22.04
permissions:
contents: read
actions: read
outputs:
run_id: ${{ steps.origin.outputs.run_id }}
candidate_sha: ${{ steps.origin.outputs.candidate_sha }}
evidence_sha256: ${{ steps.origin.outputs.evidence_sha256 }}
matrix: ${{ steps.origin.outputs.matrix }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
persist-credentials: false
- name: Verify original release source, builds, canaries and artifact identities
id: origin
env:
GH_TOKEN: ${{ github.token }}
AN_RECOVERY_RUN_ID: ${{ inputs.recovery_run_id }}
AN_RECOVERY_CANDIDATE_SHA: ${{ inputs.candidate_sha }}
AN_EVIDENCE_SHA256: ${{ inputs.evidence_sha256 }}
AN_RECOVERY_CELLS: ${{ inputs.recovery_cells }}
run: python -B scripts/release-opencode-recovery.py --verify-origin
release-recovery:
if: inputs.plan == 'release-recovery'
needs: recovery-inputs
name: 'Recover release ${{ matrix.target.platform }}/${{ matrix.target.arch }} ${{ matrix.version }}'
runs-on: ${{ matrix.target.runner }}
timeout-minutes: 20
permissions:
contents: read
actions: read
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.recovery-inputs.outputs.matrix) }}
defaults:
run:
working-directory: source
shell: bash
env:
AN_RECOVERY_RUN_ID: ${{ needs.recovery-inputs.outputs.run_id }}
AN_RECOVERY_CANDIDATE_SHA: ${{ needs.recovery-inputs.outputs.candidate_sha }}
SOURCE_COMMIT: ${{ needs.recovery-inputs.outputs.candidate_sha }}
AN_EVIDENCE_SHA256: ${{ needs.recovery-inputs.outputs.evidence_sha256 }}
AN_EVIDENCE_ARCHIVE: .task-tools/artifacts/custody/release-opencode-inputs.tar.gz
AN_OS: ${{ matrix.target.platform }}
AN_ARCH: ${{ matrix.target.arch }}
AN_VERSION: ${{ matrix.version }}
steps:
- name: Preserve canonical LF Git bytes before both Windows checkouts
if: runner.os == 'Windows'
working-directory: ${{ github.workspace }}
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v7
with:
ref: ${{ needs.recovery-inputs.outputs.candidate_sha }}
path: source
fetch-depth: 0
persist-credentials: false
- uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
path: recovery-tools
persist-credentials: false
- uses: actions/setup-go@v7
with: {go-version: '1.27.1', cache: false}
- uses: actions/setup-node@v6
with: {node-version: '24.21.0'}
- uses: actions/setup-python@v7
with: {python-version: '3.12'}
- name: Initialize unqualified recovery report
run: |
mkdir -p .task-tools/artifacts
python -c 'import json,pathlib; pathlib.Path(".task-tools/artifacts/native-report.json").write_text(json.dumps({"status":"unqualified","businessPhasesStarted":False,"firstFailedPrerequisite":"recovery_inputs_not_verified"})+"\n")'
- uses: actions/download-artifact@v8
with:
github-token: ${{ github.token }}
run-id: ${{ needs.recovery-inputs.outputs.run_id }}
name: binaries-${{ matrix.target.platform }}-${{ matrix.target.arch }}
path: source/dist
- uses: actions/download-artifact@v8
with:
github-token: ${{ github.token }}
run-id: ${{ needs.recovery-inputs.outputs.run_id }}
name: release-opencode-inputs-${{ needs.recovery-inputs.outputs.candidate_sha }}
path: source/.task-tools/artifacts/custody
- name: Restore executable mode without changing release binary bytes
if: runner.os != 'Windows'
env:
MAIN_BINARY: ${{ matrix.target.binary }}
run: chmod +x "dist/$MAIN_BINARY"
- name: Linux private bus prerequisites
if: matrix.target.platform == 'linux'
run: sudo apt-get update && sudo apt-get install -y libasound2-dev dbus iproute2
- name: Verify and stage original sealed parent archive
id: parent
run: python -B scripts/testdata/opencode-native-e2e/ci_inputs.py --stage-evidence
- name: Verify unchanged source and Go identity, and build original private receiver
env:
AN_MANIFEST: ${{ steps.parent.outputs.manifest }}
AN_MANIFEST_SHA256: ${{ steps.parent.outputs.sha256 }}
run: |
python -B ../recovery-tools/scripts/release-opencode-recovery.py --verify-inputs
python -B scripts/testdata/opencode-native-e2e/ci_inputs.py
- name: Prefetch pinned tooling and Go dependencies before native isolation
run: |
set -euo pipefail
npm ci --prefix opencode-plugin
go mod download
- name: Compile exact-source reader witness offline without any native host
id: primitives
env:
AN_MANIFEST: ${{ steps.parent.outputs.manifest }}
AN_MANIFEST_SHA256: ${{ steps.parent.outputs.sha256 }}
run: python -B ../recovery-tools/scripts/release-opencode-recovery.py --prepare-primitives
- name: Observe fresh primitives and business scenarios with no qualification grants
env:
AN_MANIFEST: ${{ steps.parent.outputs.manifest }}
AN_MANIFEST_SHA256: ${{ steps.parent.outputs.sha256 }}
AN_CLOCK_TEMP_BASE: ${{ steps.primitives.outputs.clock_temp_base }}
AN_GO_MODULE_CACHE: ${{ steps.primitives.outputs.go_module_cache }}
run: |
set -euo pipefail
if [ "$AN_OS" = linux ]; then
export AN_HOST_NETNS="$(readlink /proc/self/ns/net)"
sudo --preserve-env=PATH,AN_MANIFEST,AN_MANIFEST_SHA256,AN_OS,AN_ARCH,AN_VERSION,AN_RECOVERY_RUN_ID,AN_RECOVERY_CANDIDATE_SHA,AN_EVIDENCE_SHA256,AN_HOST_NETNS,AN_CLOCK_TEMP_BASE,AN_GO_MODULE_CACHE,SOURCE_COMMIT,GITHUB_ACTIONS unshare --net -- bash -c '
set -euo pipefail
ip link set lo up
exec setpriv --reuid "$1" --regid "$2" --init-groups -- env HOME="$3" USER="$4" LOGNAME="$4" python -B ../recovery-tools/scripts/release-opencode-recovery.py --execute
' bash "$(id -u)" "$(id -g)" "$HOME" "$(id -un)"
else
python -B ../recovery-tools/scripts/release-opencode-recovery.py --execute
fi
- uses: actions/upload-artifact@v7
if: always()
with:
name: opencode-release-recovery-${{ matrix.target.platform }}-${{ matrix.target.arch }}-${{ matrix.version }}
path: |
source/.task-tools/artifacts/native-report.json
source/.task-tools/artifacts/native/
source/.task-tools/artifacts/primitives/
include-hidden-files: true
if-no-files-found: error
retention-days: 14
- uses: actions/upload-artifact@v7
if: always() && steps.primitives.outputs.clock_temp_base != ''
with:
name: opencode-release-clock-raw-${{ matrix.target.platform }}-${{ matrix.target.arch }}-${{ matrix.version }}
path: ${{ steps.primitives.outputs.clock_temp_base }}/
include-hidden-files: true
if-no-files-found: error
retention-days: 14
- uses: actions/upload-artifact@v7
if: always()
with:
name: opencode-release-recovery-summary-${{ matrix.target.platform }}-${{ matrix.target.arch }}-${{ matrix.version }}
include-hidden-files: true
path: |
source/.task-tools/artifacts/native-report.json
source/.task-tools/artifacts/primitives/clock-report.json
source/.task-tools/artifacts/primitives/reader-report.json
source/.task-tools/artifacts/parent-inputs/manifest.json
source/.task-tools/artifacts/parent-inputs/release-inputs-receipt.json
source/.task-tools/artifacts/primitives/sealed/
source/.task-tools/artifacts/windows-acl-preparation.json
source/.task-tools/artifacts/primitives/TEST-reader-native/reader-private.jsonl
source/.task-tools/artifacts/primitives/TEST-reader-native/result.json
source/.task-tools/artifacts/primitives/TEST-reader-build/build-receipt.json
source/.task-tools/artifacts/primitives/TEST-reader-build/build-metafile.json
source/.task-tools/artifacts/native/**/native-private.jsonl
source/.task-tools/artifacts/native/**/provider-redacted.jsonl
source/.task-tools/artifacts/native/**/desktop-private.jsonl
source/.task-tools/artifacts/native/**/host-private.log
source/.task-tools/artifacts/native/**/updated-host-private.log
source/.task-tools/artifacts/native/**/reinstalled-host-private.log
if-no-files-found: error
retention-days: 14
- uses: actions/upload-artifact@v7
if: always() && steps.primitives.outputs.clock_temp_base != ''
with:
name: opencode-release-clock-summary-${{ matrix.target.platform }}-${{ matrix.target.arch }}-${{ matrix.version }}
include-hidden-files: true
path: |
${{ steps.primitives.outputs.clock_temp_base }}/**/metadata.json
${{ steps.primitives.outputs.clock_temp_base }}/**/samples.private.json
${{ steps.primitives.outputs.clock_temp_base }}/**/module-stream-*.private
${{ steps.primitives.outputs.clock_temp_base }}/**/helper-*.private
${{ steps.primitives.outputs.clock_temp_base }}/**/os-loader-files.private.json
${{ steps.primitives.outputs.clock_temp_base }}/**/loader.private.json
${{ steps.primitives.outputs.clock_temp_base }}/**/helper-lifecycle.private.json
if-no-files-found: error
retention-days: 14