-
Notifications
You must be signed in to change notification settings - Fork 55
360 lines (304 loc) · 8.45 KB
/
build.yml
File metadata and controls
360 lines (304 loc) · 8.45 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
name: build
on:
workflow_call:
env:
OWNER: ${{ github.repository_owner }}
FILE: base
BUILDKIT_PROGRESS: plain
BUILDX_NO_DEFAULT_LOAD: 1
CONTAINERBASE_VERSION: ${{ github.sha }}
APT_HTTP_PROXY: http://172.17.0.1:8000
HUSKY: 0
permissions:
contents: read
jobs:
setup:
runs-on: ubuntu-24.04
timeout-minutes: 15
outputs:
uid: ${{ steps.init.outputs.uid }}
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@2c1de3d6da2b11f8db1569520266e557e281bb98 # v4.5.22
with:
save-cache: true
- name: ⚙️ Init
id: init
run: echo "uid=$(uuidgen)" >> ${GITHUB_OUTPUT}
lint:
runs-on: ubuntu-24.04
needs: setup
timeout-minutes: 15
permissions:
contents: read
checks: write
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@2c1de3d6da2b11f8db1569520266e557e281bb98 # v4.5.22
- name: lint
run: |
pnpm eslint -f gha
pnpm prettier
pnpm lint:markdown
pnpm lint:types
- name: shellcheck
if: ${{ github.event_name != 'merge_group' }}
uses: reviewdog/action-shellcheck@4c07458293ac342d477251099501a718ae5ef86e # v1.32.0
with:
fail_level: any
reporter: github-pr-annotations
filter_mode: nofilter
path: |
src
.husky
pattern: |
*.sh
*.bats
check_all_files_with_shebangs: 'true'
bats:
runs-on: ubuntu-24.04
needs: setup
timeout-minutes: 15
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@2c1de3d6da2b11f8db1569520266e557e281bb98 # v4.5.22
- name: Install ubuntu dependencies
run: |
sudo apt-get -qq update
sudo apt-get -qq install -y libarchive-tools
- name: build
run: pnpm build
- name: bats
run: pnpm test:bats
vitest:
runs-on: ubuntu-24.04
needs: setup
timeout-minutes: 15
permissions:
id-token: write
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@2c1de3d6da2b11f8db1569520266e557e281bb98 # v4.5.22
- name: vitest
run: pnpm test:vitest
- name: Codecov test results
if: github.event_name != 'merge_group' && !cancelled()
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
use_oidc: true
report_type: test_results
- name: Codecov coverage results
if: github.event_name != 'merge_group'
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
use_oidc: true
build:
runs-on: ubuntu-24.04
needs: setup
timeout-minutes: 15
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@2c1de3d6da2b11f8db1569520266e557e281bb98 # v4.5.22
- name: build
run: pnpm build
- name: upload dist
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist
path: |
dist/
base:
runs-on: ${{ matrix.arch.os }}
name: base (${{ matrix.arch.name }})
needs:
- setup
- build
strategy:
fail-fast: false
matrix:
arch:
- name: x86_64
os: ubuntu-24.04
tag: amd64
- name: aarch64
os: ubuntu-24.04-arm
tag: arm64
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@2c1de3d6da2b11f8db1569520266e557e281bb98 # v4.5.22
with:
node: false
apt-proxy: true
- name: Check system
uses: ./.github/actions/check
- name: ⚙️ Init
run: |
echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV}
echo "BASE=ttl.sh/${{ needs.setup.outputs.uid }}/${{ matrix.arch.tag }}:1d" >> ${GITHUB_ENV}
- name: build base
uses: ./.github/actions/bake
with:
args: >-
--set build-ttl.tags=${{env.BASE}}
--set build-ttl.cache-to=type=gha,mode=max,scope=${{ needs.setup.outputs.uid }}-${{ matrix.arch.tag }}
--set settings.cache-from+=type=gha,scope=${{ needs.setup.outputs.uid }}-${{ matrix.arch.tag }}
build-ttl
distro:
runs-on: ubuntu-24.04
needs:
- bats
- lint
- vitest
- build
strategy:
fail-fast: false
matrix:
distro:
- jammy
- noble
env:
TAG: ${{ matrix.distro }}
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@2c1de3d6da2b11f8db1569520266e557e281bb98 # v4.5.22
with:
node: false
apt-proxy: true
- name: Check system
uses: ./.github/actions/check
- name: ⚙️ Init
run: |
echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV}
- name: test distro
uses: ./.github/actions/bake
with:
args: test-distro
# test old distros on arm64
base-arm64:
runs-on: ubuntu-24.04-arm
needs:
- bats
- lint
- vitest
- build
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
distro:
- jammy
env:
TAG: ${{ matrix.distro }}
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@2c1de3d6da2b11f8db1569520266e557e281bb98 # v4.5.22
with:
node: false
apt-proxy: true
- name: Check system
uses: ./.github/actions/check
- name: ⚙️ Init
run: |
echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV}
- name: test distro
uses: ./.github/actions/bake
with:
args: test-base
lang:
runs-on: ${{ matrix.arch.os }}
name: ${{ matrix.lang }} (${{ matrix.arch.name }})
needs:
- setup
- base
- bats
- lint
- vitest
strategy:
max-parallel: 10
fail-fast: false
matrix:
lang:
- dart
- dotnet
- erlang
- flutter
- flux
- golang
- haskell
- java
- jb
- helm
- nix
- node
- php
- powershell
- python
- ruby
- rust
- swift
- latest
arch:
- name: x86_64
os: ubuntu-24.04
tag: amd64
- name: aarch64
os: ubuntu-24.04-arm
tag: arm64
# include:
# # no ubuntu arm64 support for haskell
# - lang: haskell
# arch:
# name: x86_64
# os: ubuntu-24.04
# tag: amd64
env:
TAG: ${{ matrix.lang }}
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@2c1de3d6da2b11f8db1569520266e557e281bb98 # v4.5.22
with:
node: false
apt-proxy: true
- name: Check system
uses: ./.github/actions/check
- name: ⚙️ Init
run: |
echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV}
echo "BASE_IMAGE=ttl.sh/${{ needs.setup.outputs.uid }}/${{ matrix.arch.tag }}:1d" >> ${GITHUB_ENV}
- name: build base
uses: ./.github/actions/bake
with:
args: >-
--set build-ttl.tags=${{env.BASE_IMAGE}}
--set build-ttl.cache-to=type=gha,mode=max,scope=${{ needs.setup.outputs.uid }}-${{ matrix.arch.tag }}
--set settings.cache-from+=type=gha,scope=${{ needs.setup.outputs.uid }}-${{ matrix.arch.tag }}
build-ttl
- name: test distro
uses: ./.github/actions/bake
with:
args: test-${{ matrix.arch.name }}
# Catch-all required check for test matrix
test-success:
needs:
- base-arm64
- distro
- lang
runs-on: ubuntu-24.04
timeout-minutes: 1
if: always()
steps:
- name: Fail for failed or cancelled distro tests
if: |
needs.base-arm64.result == 'failure' ||
needs.base-arm64.result == 'cancelled'
run: exit 1
- name: Fail for failed or cancelled distro tests
if: |
needs.distro.result == 'failure' ||
needs.distro.result == 'cancelled'
run: exit 1
- name: Fail for failed or cancelled lang tests
if: |
needs.lang.result == 'failure' ||
needs.lang.result == 'cancelled'
run: exit 1