-
Notifications
You must be signed in to change notification settings - Fork 0
283 lines (246 loc) · 8.09 KB
/
ci.yml
File metadata and controls
283 lines (246 loc) · 8.09 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
name: CI
on:
merge_group:
pull_request:
push:
tags:
- "v*"
concurrency:
# Only cancel in-progress runs for pull_request events, this prevents cancelling workflows against main or tags
# A pull_request will reuse the same group thus enabling cancelation, all others receive a unique run_id
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
ci:
name: CI
permissions: {}
# This should be the only action checked as required in the repo settings.
#
# This is a meta-job, here to express the conditions we require
# in order to consider a CI run to be successful.
if: always()
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- lint
- test
- bakery
- bakery-native
- bakery-pr
- release
- zizmor
steps:
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
allowed-skips: bakery-pr, lint
jobs: ${{ toJSON(needs) }}
lint:
name: Lint
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version-file: posit-bakery/pyproject.toml
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
env:
SKIP: no-commit-to-branch
test:
name: Test
permissions:
contents: read
checks: write
pull-requests: write
runs-on: ubuntu-latest-8x
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
fetch-tags: true
- name: Setup goss
uses: ./setup-goss
- name: Set up Docker
uses: docker/setup-docker-action@b2189fbf2a6592b51fee7cdd93ee2bfaeba733db # v5.1.0
with:
daemon-config: |
{
"features": {
"containerd-snapshotter": true
}
}
- name: Setup QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
with:
platforms: linux/amd64,linux/arm64
- name: Setup docker buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Setup hadolint
uses: ./setup-hadolint
- name: Setup wizcli
uses: ./setup-wizcli
- name: Setup ORAS CLI
uses: oras-project/setup-oras@38de303aac69abb66f3e6255b7198bff35f323e3 # v2.0.0
- name: Add tools/ to path
run: echo "${GITHUB_WORKSPACE}/tools" >> "$GITHUB_PATH"
- name: Setup uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version-file: "posit-bakery/pyproject.toml"
enable-cache: false
- name: Install dependencies
working-directory: ./posit-bakery
run: |
uv sync
- name: Run pytest
working-directory: ./posit-bakery
run: |
GOSS_PATH=${GITHUB_WORKSPACE}/tools/goss \
DGOSS_PATH=${GITHUB_WORKSPACE}/tools/dgoss \
uv run pytest -n auto \
--dist loadgroup \
--cov=posit_bakery \
--cov-report=xml \
--junit-xml=results.xml \
test/
- name: Build
working-directory: ./posit-bakery
run: |
uv build
- name: Publish results
# Dependabot and fork PRs get a restricted GITHUB_TOKEN without
# checks:write. Skip rather than switch to pull_request_target.
if: >-
always()
&& github.actor != 'dependabot[bot]'
&& github.event.pull_request.head.repo.fork != true
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2.23.0
with:
files: ./posit-bakery/results.xml
bakery:
name: Bakery
permissions:
contents: read
packages: write
uses: "./.github/workflows/bakery-build.yml"
with:
version: ${{ github.head_ref || github.ref_name }}
context: "./posit-bakery/test/resources/with-macros/"
dev-versions: include
bakery-native:
name: Bakery Native Build
permissions:
contents: read
packages: write
uses: "./.github/workflows/bakery-build-native.yml"
with:
version: ${{ github.head_ref || github.ref_name }}
context: "./posit-bakery/test/resources/multiplatform/"
dev-versions: include
bakery-pr:
name: Bakery PR Build
if: github.event_name == 'pull_request'
permissions:
contents: read
packages: write
uses: "./.github/workflows/bakery-build-pr.yml"
with:
context: "./posit-bakery/test/resources/multiplatform/"
dev-versions: include
zizmor:
name: Zizmor
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
with-macros-clean-caches:
name: Clean Caches (with-macros suite)
permissions:
contents: read
packages: write
needs:
- bakery
- bakery-native
uses: "./.github/workflows/clean.yml"
with:
version: ${{ github.head_ref || github.ref_name }}
context: "./posit-bakery/test/resources/with-macros/"
remove-dangling-caches: true
remove-caches-older-than: 14
clean-temporary-images: false # TODO: flip to true if this build starts using the native workflow
multiplatform-clean-caches:
name: Clean Caches (multiplatform suite)
permissions:
contents: read
packages: write
needs:
- bakery
- bakery-native
uses: "./.github/workflows/clean.yml"
with:
version: ${{ github.head_ref || github.ref_name }}
context: "./posit-bakery/test/resources/multiplatform/"
remove-dangling-caches: true
remove-caches-older-than: 14
remove-dangling-temporary-images: false
remove-temporary-images-older-than: 3
release:
name: Release/Snapshot
permissions:
contents: write
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'pull_request' || github.event_name == 'merge_group')
needs:
- test
- bakery
- bakery-native
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
fetch-tags: true
- name: Setup uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version-file: "posit-bakery/pyproject.toml"
enable-cache: false
- name: Install dependencies
working-directory: ./posit-bakery
run: |
uv sync
- name: Build
working-directory: ./posit-bakery
run: |
uv build
- name: Upload snapshot artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bakery-snapshot-pr${{ github.event.pull_request.number }}
path: ./posit-bakery/dist
retention-days: 7
overwrite: true
- name: Create a release draft
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REF_NAME: ${{ github.ref_name }}
run: |
gh release create "$REF_NAME" \
--draft \
--generate-notes \
--latest
gh release upload "$REF_NAME" \
./posit-bakery/dist/*