-
Notifications
You must be signed in to change notification settings - Fork 1
333 lines (292 loc) · 12.8 KB
/
container.yml
File metadata and controls
333 lines (292 loc) · 12.8 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
# ────────────────────────────────────────────────────────────────────────────────
# CI — AOT Builds + Agent Container
#
# Triggered automatically when CI1 (Unit Tests) passes on main, or manually.
#
# Produces:
# • aot-linux-x64 — BareMetalWeb.Host AOT binary (Ubuntu 22.04 runner)
# • aot-linux-arm64 — BareMetalWeb.Host AOT binary (Ubuntu 24.04 arm runner)
# • aot-linux-arm64-bookworm — BareMetalWeb.Host AOT binary (Debian bookworm, glibc 2.36)
# • bmw-agent-linux-x64 — bmw-agent AOT binary
# • bmw-agent-linux-arm64 — bmw-agent AOT binary
#
# All artifacts are uploaded to GitHub Actions for later use by the agent bootstrap
# system. There is NO deployment step — the agent downloads and installs the
# correct versioned binary itself.
# ────────────────────────────────────────────────────────────────────────────────
name: "2 · CI2 — AOT Builds & Agent Container"
run-name: "2 · CI2 — AOT Builds & Agent Container — V${{ vars.MAJOR_VERSION || '1' }}.${{ github.run_number }}"
on:
workflow_run:
workflows: ["1 · CI1 — Tests & JIT Build"]
types: [completed]
branches: [main]
workflow_dispatch:
concurrency:
group: ci2-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
# ── Gate: skip if CI1 failed ────────────────────────────────────────────
gate:
name: Check CI1 result
runs-on: ubuntu-latest
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
steps:
- run: echo "CI1 passed — proceeding with AOT builds"
# ── Version ─────────────────────────────────────────────────────────────
version:
name: Compute version
needs: gate
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
info_version: ${{ steps.version.outputs.info_version }}
assembly_version: ${{ steps.version.outputs.assembly_version }}
steps:
- name: Compute version
id: version
run: |
MAJOR="${{ vars.MAJOR_VERSION || '1' }}"
DATE="$(date +%Y%m%d)"
BUILD="${{ github.run_number }}"
SHA="${GITHUB_SHA:0:7}"
echo "tag=${MAJOR}.${DATE}.${BUILD}" >> $GITHUB_OUTPUT
echo "info_version=${MAJOR}.${DATE}.${BUILD}+${SHA}" >> $GITHUB_OUTPUT
echo "assembly_version=${MAJOR}.0.0.${BUILD}" >> $GITHUB_OUTPUT
# ── AOT: BareMetalWeb.Host linux-x64 ────────────────────────────────────
aot-host-linux-x64:
name: "AOT Host · linux-x64"
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: nuget-
- name: Install native AOT prerequisites
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang zlib1g-dev
- name: AOT publish (linux-x64)
run: |
dotnet publish BareMetalWeb.Host/BareMetalWeb.Host.csproj \
--configuration Release \
--runtime linux-x64 \
--self-contained \
--output ./publish \
-p:AssemblyVersion=${{ needs.version.outputs.assembly_version }} \
-p:FileVersion=${{ needs.version.outputs.assembly_version }} \
-p:InformationalVersion=${{ needs.version.outputs.info_version }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: aot-linux-x64
path: ./publish
retention-days: 30
# ── AOT: BareMetalWeb.Host linux-arm64 (Ubuntu 24.04) ───────────────────
aot-host-linux-arm64:
name: "AOT Host · linux-arm64"
needs: version
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: nuget-
- name: Install native AOT prerequisites
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang zlib1g-dev
- name: AOT publish (linux-arm64)
run: |
dotnet publish BareMetalWeb.Host/BareMetalWeb.Host.csproj \
--configuration Release \
--runtime linux-arm64 \
--self-contained \
--output ./publish \
-p:AssemblyVersion=${{ needs.version.outputs.assembly_version }} \
-p:FileVersion=${{ needs.version.outputs.assembly_version }} \
-p:InformationalVersion=${{ needs.version.outputs.info_version }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: aot-linux-arm64
path: ./publish
retention-days: 30
# ── AOT: BareMetalWeb.Host linux-arm64 (Debian bookworm, glibc 2.36) ───
aot-host-linux-arm64-bookworm:
name: "AOT Host · linux-arm64 (bookworm/glibc 2.36)"
needs: version
runs-on: ubuntu-24.04-arm
container:
image: debian:bookworm
steps:
- name: Install build dependencies
run: |
apt-get update && apt-get install -y --no-install-recommends \
curl git ca-certificates clang zlib1g-dev
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: AOT publish (linux-arm64, bookworm)
run: |
dotnet publish BareMetalWeb.Host/BareMetalWeb.Host.csproj \
--configuration Release \
--runtime linux-arm64 \
--self-contained \
--output ./publish \
-p:AssemblyVersion=${{ needs.version.outputs.assembly_version }} \
-p:FileVersion=${{ needs.version.outputs.assembly_version }} \
-p:InformationalVersion=${{ needs.version.outputs.info_version }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: aot-linux-arm64-bookworm
path: ./publish
retention-days: 30
# ── AOT: bmw-agent linux-x64 ─────────────────────────────────────────────
aot-agent-linux-x64:
name: "AOT Agent · linux-x64"
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: nuget-
- name: Install native AOT prerequisites
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang zlib1g-dev
- name: AOT publish agent (linux-x64)
run: |
dotnet publish BareMetalWeb.Agent/BareMetalWeb.Agent.csproj \
--configuration Release \
--runtime linux-x64 \
--self-contained \
--output ./agent-out \
-p:AssemblyVersion=${{ needs.version.outputs.assembly_version }} \
-p:FileVersion=${{ needs.version.outputs.assembly_version }} \
-p:InformationalVersion=${{ needs.version.outputs.info_version }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bmw-agent-linux-x64
path: ./agent-out
retention-days: 30
# ── AOT: bmw-agent linux-arm64 ───────────────────────────────────────────
aot-agent-linux-arm64:
name: "AOT Agent · linux-arm64"
needs: version
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: nuget-
- name: Install native AOT prerequisites
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang zlib1g-dev
- name: AOT publish agent (linux-arm64)
run: |
dotnet publish BareMetalWeb.Agent/BareMetalWeb.Agent.csproj \
--configuration Release \
--runtime linux-arm64 \
--self-contained \
--output ./agent-out \
-p:AssemblyVersion=${{ needs.version.outputs.assembly_version }} \
-p:FileVersion=${{ needs.version.outputs.assembly_version }} \
-p:InformationalVersion=${{ needs.version.outputs.info_version }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bmw-agent-linux-arm64
path: ./agent-out
retention-days: 30
# ── Agent container (build verification — no push) ──────────────────────
agent-container:
name: "Agent container (build verification)"
needs: version
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build agent container image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.agent
platforms: linux/arm64
push: false
tags: bmw-agent:${{ needs.version.outputs.tag }}-linux-arm64
labels: |
org.opencontainers.image.title=BareMetalWeb Agent
org.opencontainers.image.version=${{ needs.version.outputs.tag }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
# ── Summary ────────────────────────────────────────────────────────────
summary:
name: Build summary
needs:
- version
- aot-host-linux-x64
- aot-host-linux-arm64
- aot-host-linux-arm64-bookworm
- aot-agent-linux-x64
- aot-agent-linux-arm64
- agent-container
if: always()
runs-on: ubuntu-latest
steps:
- name: Fail if gate was skipped
if: needs.version.result == 'skipped'
run: |
echo "::error::CI1 did not pass — CI2 skipped."
exit 1
- name: Summary
if: needs.version.result != 'skipped'
run: |
TAG="${{ needs.version.outputs.tag }}"
echo "### 🏗️ CI2 Build Summary (${TAG})" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Artifact | Status |" >> $GITHUB_STEP_SUMMARY
echo "|----------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| AOT Host linux-x64 | ${{ needs.aot-host-linux-x64.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| AOT Host linux-arm64 | ${{ needs.aot-host-linux-arm64.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| AOT Host linux-arm64 (bookworm) | ${{ needs.aot-host-linux-arm64-bookworm.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| AOT Agent linux-x64 | ${{ needs.aot-agent-linux-x64.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| AOT Agent linux-arm64 | ${{ needs.aot-agent-linux-arm64.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Agent container build | ${{ needs.agent-container.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "All artifacts available for download from this run." >> $GITHUB_STEP_SUMMARY
echo "The agent self-registers and downloads the correct binary at runtime — no CD step needed." >> $GITHUB_STEP_SUMMARY