-
Notifications
You must be signed in to change notification settings - Fork 40
290 lines (239 loc) · 6.71 KB
/
build.yml
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
name: build
on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: false
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-latest
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
- name: 📥 Setup Node.js
uses: ./.github/actions/setup-node
with:
save-cache: true
lint:
runs-on: ubuntu-latest
needs: setup
timeout-minutes: 15
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
- name: 📥 Setup Node.js
uses: ./.github/actions/setup-node
- name: lint
run: |
pnpm eslint -f gha
pnpm prettier
pnpm lint:types
- name: shellcheck
if: ${{ github.event_name != 'merge_group' }}
uses: reviewdog/action-shellcheck@ccaafec556ffa154f112bfcb7b9c9574190b7091 # v1.27.0
with:
fail_on_error: true
reporter: github-pr-annotations
filter_mode: nofilter
path: |
src
.husky
pattern: |
*.sh
*.bats
check_all_files_with_shebangs: 'true'
bats:
runs-on: ubuntu-latest
needs: setup
timeout-minutes: 15
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
- name: Install ubuntu dependencies
run: |
sudo apt-get -qq update
sudo apt-get -qq install -y libarchive-tools
- name: 📥 Setup Node.js
uses: ./.github/actions/setup-node
- name: build
run: pnpm build
- name: bats
run: pnpm test:bats
vitest:
runs-on: ubuntu-latest
needs: setup
timeout-minutes: 15
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
- name: 📥 Setup Node.js
uses: ./.github/actions/setup-node
- name: vitest
run: pnpm test:vitest
- name: Codecov
if: github.event_name != 'merge_group'
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
base:
runs-on: ubuntu-latest
needs: setup
timeout-minutes: 15
outputs:
base: ${{ steps.init.outputs.base }}
steps:
- name: docker-config
uses: containerbase/internal-tools@72750e92d57f4ec2412af2f4f63f57eafa626bb4 # v3.4.42
with:
command: docker-config
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
- name: init
id: init
run: |
export base="ttl.sh/$(uuidgen):1d"
echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV}
echo "BASE=${base}" >> ${GITHUB_ENV}
echo "base=${base}" >> ${GITHUB_OUTPUT}
- name: 📥 Setup Node.js
uses: ./.github/actions/setup-node
- name: prepare apt proxy
uses: ./.github/actions/prepare-proxy
- name: build
run: pnpm build
- name: test distro
run: docker buildx bake --set build-ttl.tags=${{env.BASE}} build-ttl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CONTAINERBASE_CDN: ${{ vars.CONTAINERBASE_CDN }}
distro:
runs-on: ubuntu-latest
needs:
- bats
- lint
- vitest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
distro:
- focal
- jammy
- noble
env:
TAG: ${{ matrix.distro }}
steps:
- name: docker-config
uses: containerbase/internal-tools@72750e92d57f4ec2412af2f4f63f57eafa626bb4 # v3.4.42
with:
command: docker-config
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
- name: init
run: |
echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV}
- name: 📥 Setup Node.js
uses: ./.github/actions/setup-node
- name: prepare apt proxy
uses: ./.github/actions/prepare-proxy
- name: build
run: pnpm build
- name: test distro
run: docker buildx bake test-distro --set settings.secrets=type=env,id=GITHUB_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CONTAINERBASE_CDN: ${{ vars.CONTAINERBASE_CDN }}
lang:
runs-on: ubuntu-latest
needs:
- base
- bats
- lint
- vitest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
tag:
- dart
- dotnet
- erlang
- flutter
- flux
- golang
- java
- jb
- helm
- nix
- node
- php
- powershell
- python
- ruby
- rust
- swift
- latest
env:
TAG: ${{ matrix.tag }}
steps:
- name: docker-config
uses: containerbase/internal-tools@72750e92d57f4ec2412af2f4f63f57eafa626bb4 # v3.4.42
with:
command: docker-config
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
show-progress: false
- name: init
run: |
echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV}
echo "BASE_IMAGE=${{ needs.base.outputs.base }}" >> ${GITHUB_ENV}
- name: 📥 Setup Node.js
uses: ./.github/actions/setup-node
- name: prepare apt proxy
uses: ./.github/actions/prepare-proxy
- name: test
run: docker buildx bake test --set settings.secrets=type=env,id=GITHUB_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CONTAINERBASE_CDN: ${{ vars.CONTAINERBASE_CDN }}
# Catch-all required check for test matrix
test-success:
needs:
- distro
- lang
runs-on: ubuntu-latest
timeout-minutes: 1
if: always()
steps:
- 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 == 'skipped'
run: exit 1