-
Notifications
You must be signed in to change notification settings - Fork 0
214 lines (183 loc) · 5.55 KB
/
ci.yml
File metadata and controls
214 lines (183 loc) · 5.55 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
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
# 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:
- test
- bakery
- bakery-native
- release
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
test:
name: Test
runs-on: ubuntu-latest-4x
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Setup goss
uses: ./setup-goss
- name: Set up Docker
uses: docker/setup-docker-action@v4
with:
daemon-config: |
{
"features": {
"containerd-snapshotter": true
}
}
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Setup docker buildx
uses: docker/setup-buildx-action@v3
- name: Setup ORAS CLI
uses: oras-project/setup-oras@v1
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
python-version-file: "posit-bakery/pyproject.toml"
- 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
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
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
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
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@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
python-version-file: "posit-bakery/pyproject.toml"
- 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@v4
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 }}
run: |
gh release create ${{ github.ref_name }} \
--draft \
--generate-notes \
--latest
gh release upload ${{ github.ref_name }} \
./posit-bakery/dist/*