-
Notifications
You must be signed in to change notification settings - Fork 0
269 lines (226 loc) · 10.2 KB
/
Copy pathci.yml
File metadata and controls
269 lines (226 loc) · 10.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
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
quality:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Check formatting and module graph
shell: bash
run: |
test -z "$(gofmt -l .)"
go mod tidy
git diff --exit-code -- go.mod go.sum
go mod verify
- name: Build Stack tooling
run: go build ./...
- name: Test manifest contract
run: go test -count=1 ./internal/manifest
- name: Race test manifest contract
run: go test -race ./internal/manifest
- name: Vet
run: go vet ./...
- name: Check patch whitespace
run: git diff --check
manifest:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Validate exact component manifest
run: go run ./cmd/manifest-validator components.json
- name: Run negative manifest matrix
run: go test -count=1 ./internal/manifest -run 'Rejects|Resolution'
compose:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Write explicit Compose validation environment
shell: bash
run: ./scripts/write-ci-env.sh compose "$GITHUB_ENV" "$GITHUB_WORKSPACE" "nekiro-stack-compose-${GITHUB_RUN_ID}"
- name: Validate source-free Compose
shell: bash
run: |
docker compose --file compose.yaml config --quiet
docker compose --file compose.yaml --file compose.router-nacos-secure.yaml --profile router-nacos-secure config --quiet
docker compose --file compose.yaml --file compose.evaluation.yaml config --quiet
if grep -nE '^[[:space:]]+build:|image:[[:space:]].*(latest|:(main|master))([[:space:]"@]|$)' compose.yaml compose.evaluation.yaml; then
echo 'Compose contains a source build or floating image.' >&2
exit 1
fi
backend:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Check out Stack
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Write backend acceptance environment
shell: bash
run: ./scripts/write-ci-env.sh backend "$GITHUB_ENV" "$GITHUB_WORKSPACE" "nekiro-stack-backend-${GITHUB_RUN_ID}"
- name: Resolve exact components and build images
id: prepare
shell: bash
env:
PREPARED_ENV: ${{ runner.temp }}/nekiro-stack-backend.env
WORK_ROOT: ${{ runner.temp }}/nekiro-stack-backend
run: |
./scripts/prepare.sh "$GITHUB_WORKSPACE/components.json" "$WORK_ROOT" "$PREPARED_ENV"
source "$PREPARED_ENV"
for name in NEKIRO_CONTROL_PLANE_IMAGE NEKIRO_A2A_ROUTER_IMAGE NEKIRO_RUNTIME_A_IMAGE NEKIRO_RUNTIME_B_IMAGE NEKIRO_NACOS_SECURE_PROXY_IMAGE NEKIRO_STACK_CORE_DIR NEKIRO_STACK_CONSOLE_DIR NEKIRO_STACK_SDK_GO_DIR NEKIRO_STACK_SAMPLES_DIR NEKIRO_STACK_TRANSPORT_GO_DIR; do
printf '%s=%s\n' "$name" "${!name}" >>"$GITHUB_ENV"
done
printf 'NEKIRO_STACK_PREPARED_ENV=%s\n' "$PREPARED_ENV" >>"$GITHUB_ENV"
- name: Generate ephemeral Nacos PKI
run: go run ./cmd/nacos-secure-fixture generate "$NEKIRO_E2E_TLS_ROOT"
- name: Start fresh exact backend assembly
run: docker compose --project-name "$NEKIRO_E2E_COMPOSE_PROJECT" --file compose.yaml --file "$NEKIRO_E2E_COMPOSE_OVERRIDE_FILE" --profile router-nacos-secure up --detach --wait --wait-timeout 120
- name: Run trusted publication Invoke-to-Record acceptance
run: go test -tags=e2e -count=1 ./tests/backend
- name: Capture sanitized backend logs
if: always() && steps.prepare.outcome == 'success'
shell: bash
run: docker compose --project-name "$NEKIRO_E2E_COMPOSE_PROJECT" --file compose.yaml --file "$NEKIRO_E2E_COMPOSE_OVERRIDE_FILE" --profile router-nacos-secure --profile runtime-registration --profile watch-refresh logs --no-color 2>&1 | perl scripts/sanitize-logs.pl
- name: Tear down backend assembly
if: always() && steps.prepare.outcome == 'success'
run: docker compose --project-name "$NEKIRO_E2E_COMPOSE_PROJECT" --file compose.yaml --file "$NEKIRO_E2E_COMPOSE_OVERRIDE_FILE" --profile router-nacos-secure --profile runtime-registration --profile watch-refresh down --volumes --remove-orphans
browser:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Check out Stack
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Install pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda
with:
version: 11.3.0
run_install: false
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 24.16.0
- name: Write browser acceptance environment
shell: bash
run: ./scripts/write-ci-env.sh browser "$GITHUB_ENV" "$GITHUB_WORKSPACE" "nekiro-stack-browser-${GITHUB_RUN_ID}"
- name: Resolve exact components and build images
id: prepare
shell: bash
env:
PREPARED_ENV: ${{ runner.temp }}/nekiro-stack-browser.env
WORK_ROOT: ${{ runner.temp }}/nekiro-stack-browser
run: |
./scripts/prepare.sh "$GITHUB_WORKSPACE/components.json" "$WORK_ROOT" "$PREPARED_ENV"
source "$PREPARED_ENV"
for name in NEKIRO_CONTROL_PLANE_IMAGE NEKIRO_A2A_ROUTER_IMAGE NEKIRO_RUNTIME_A_IMAGE NEKIRO_RUNTIME_B_IMAGE NEKIRO_NACOS_SECURE_PROXY_IMAGE NEKIRO_STACK_CORE_DIR NEKIRO_STACK_CONSOLE_DIR NEKIRO_STACK_SDK_GO_DIR NEKIRO_STACK_SAMPLES_DIR NEKIRO_STACK_TRANSPORT_GO_DIR; do
printf '%s=%s\n' "$name" "${!name}" >>"$GITHUB_ENV"
done
printf 'NEKIRO_STACK_PREPARED_ENV=%s\n' "$PREPARED_ENV" >>"$GITHUB_ENV"
- name: Start fresh exact browser assembly
run: docker compose --project-name "$NEKIRO_E2E_COMPOSE_PROJECT" --file compose.yaml up --detach --wait --wait-timeout 120
- name: Install exact Console dependencies
shell: bash
run: pnpm --dir "$NEKIRO_STACK_CONSOLE_DIR" install --frozen-lockfile
- name: Install Chromium
shell: bash
run: pnpm --dir "$NEKIRO_STACK_CONSOLE_DIR" exec playwright install --with-deps chromium
- name: Build exact production Console
shell: bash
run: pnpm --dir "$NEKIRO_STACK_CONSOLE_DIR" run build
- name: Run production browser acceptance
shell: bash
run: pnpm --dir "$NEKIRO_STACK_CONSOLE_DIR" run test:e2e
- name: Capture sanitized browser logs
if: always() && steps.prepare.outcome == 'success'
shell: bash
run: docker compose --project-name "$NEKIRO_E2E_COMPOSE_PROJECT" --file compose.yaml logs --no-color 2>&1 | perl scripts/sanitize-logs.pl
- name: Tear down browser assembly
if: always() && steps.prepare.outcome == 'success'
run: docker compose --project-name "$NEKIRO_E2E_COMPOSE_PROJECT" --file compose.yaml down --volumes --remove-orphans
security:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Verify ownership, license, and immutable inputs
shell: bash
run: |
test -s LICENSE
test -s README.md
test -s components.json
test -s .github/pull_request_template.md
test -s .github/workflows/core-integration.yml
for path in apps agents sdks src deploy tests/e2e; do
test ! -e "$path"
done
if grep -nE '^[[:space:]]+build:|image:[[:space:]].*(latest|:(main|master))([[:space:]"@]|$)' compose.yaml compose.evaluation.yaml; then
echo 'Compose contains a source build or floating image.' >&2
exit 1
fi
if git grep -nE '^[[:space:]]*uses:' -- .github/workflows | grep -Ev '@[0-9a-f]{40}([[:space:]]|$)'; then
echo 'GitHub Action or reusable workflow is not pinned to a full commit SHA.' >&2
exit 1
fi
if git grep -nEI -- '-----BEGIN (RSA |EC |OPENSSH |DSA |)?PRIVATE KEY-----|gh[pousr]_[A-Za-z0-9]{20,}|AKIA[0-9A-Z]{16}'; then
echo 'Credential-like material is tracked.' >&2
exit 1
fi
required:
if: always()
needs:
- quality
- manifest
- compose
- backend
- browser
- security
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Require every CI gate
env:
QUALITY_RESULT: ${{ needs.quality.result }}
MANIFEST_RESULT: ${{ needs.manifest.result }}
COMPOSE_RESULT: ${{ needs.compose.result }}
BACKEND_RESULT: ${{ needs.backend.result }}
BROWSER_RESULT: ${{ needs.browser.result }}
SECURITY_RESULT: ${{ needs.security.result }}
shell: bash
run: |
for result in "$QUALITY_RESULT" "$MANIFEST_RESULT" "$COMPOSE_RESULT" "$BACKEND_RESULT" "$BROWSER_RESULT" "$SECURITY_RESULT"; do
test "$result" = success
done