@@ -22,24 +22,6 @@ permissions:
2222 contents : read # to fetch code (actions/checkout)
2323
2424jobs :
25- prepare :
26- runs-on : ubuntu-latest
27- outputs :
28- matrix : ${{ steps.platforms.outputs.matrix }}
29- steps :
30- -
31- name : Checkout
32- uses : actions/checkout@v4
33- -
34- name : Create matrix
35- id : platforms
36- run : |
37- echo matrix=$(docker buildx bake binary-cross --print | jq -cr '.target."binary-cross".platforms') >> $GITHUB_OUTPUT
38- -
39- name : Show matrix
40- run : |
41- echo ${{ steps.platforms.outputs.matrix }}
42-
4325 validate :
4426 runs-on : ubuntu-latest
4527 strategy :
@@ -53,111 +35,148 @@ jobs:
5335 steps :
5436 -
5537 name : Checkout
56- uses : actions/checkout@v4
38+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
5739 -
5840 name : Set up Docker Buildx
59- uses : docker/setup-buildx-action@v3
41+ uses : docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
6042 -
6143 name : Run
6244 run : |
6345 make ${{ matrix.target }}
6446
6547 binary :
48+ uses : docker/github-builder/.github/workflows/bake.yml@70313223e2665c3211b454b3fea6534624e78d64 # v1.4.0
49+ permissions :
50+ contents : read # same as global permission
51+ id-token : write # for signing attestation(s) with GitHub OIDC Token
52+ with :
53+ runner : amd64
54+ artifact-name : compose
55+ artifact-upload : true
56+ cache : true
57+ cache-scope : binary
58+ target : release
59+ output : local
60+ sbom : true
61+ sign : ${{ github.event_name != 'pull_request' }}
62+
63+ binary-finalize :
6664 runs-on : ubuntu-latest
6765 needs :
68- - prepare
69- strategy :
70- fail-fast : false
71- matrix :
72- platform : ${{ fromJson(needs.prepare.outputs.matrix) }}
66+ - binary
7367 steps :
7468 -
75- name : Checkout
76- uses : actions/checkout@v4
77- -
78- name : Prepare
79- run : |
80- platform=${MATRIX_PLATFORM}
81- echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
82- env :
83- MATRIX_PLATFORM : ${{ matrix.platform }}
84- -
85- name : Set up QEMU
86- uses : docker/setup-qemu-action@v3
87- -
88- name : Set up Docker Buildx
89- uses : docker/setup-buildx-action@v3
90- -
91- name : Build
92- uses : docker/bake-action@v6
69+ name : Download artifacts
70+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
9371 with :
94- source : .
95- targets : release
96- provenance : mode=max
97- sbom : true
98- set : |
99- *.platform=${{ matrix.platform }}
100- *.cache-from=type=gha,scope=binary-${{ env.PLATFORM_PAIR }}
101- *.cache-to=type=gha,scope=binary-${{ env.PLATFORM_PAIR }},mode=max
72+ path : /tmp/compose-output
73+ name : ${{ needs.binary.outputs.artifact-name }}
10274 -
10375 name : Rename provenance and sbom
104- working-directory : ./bin/release
10576 run : |
106- binname=$(find . -name 'docker-compose-*')
107- filename=$(basename "$binname" | sed -E 's/\.exe$//')
108- mv "provenance.json" "${filename}.provenance.json"
109- mv "sbom-binary.spdx.json" "${filename}.sbom.json"
110- find . -name 'sbom*.json' -exec rm {} \;
77+ for pdir in /tmp/compose-output/*/; do
78+ (
79+ cd "$pdir"
80+ binname=$(find . -name 'docker-compose-*')
81+ filename=$(basename "${binname%.exe}")
82+ mv "provenance.json" "${filename}.provenance.json"
83+ mv "sbom-binary.spdx.json" "${filename}.sbom.json"
84+ find . -name 'sbom*.json' -exec rm {} \;
85+ if [ -f "provenance.sigstore.json" ]; then
86+ mv "provenance.sigstore.json" "${filename}.sigstore.json"
87+ fi
88+ )
89+ done
90+ mkdir -p "./bin/release"
91+ mv /tmp/compose-output/**/* "./bin/release/"
11192 -
112- name : List artifacts
93+ name : Create checksum file
94+ working-directory : ./bin/release
11395 run : |
114- tree -nh ./bin/release
96+ find . -type f -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# \*\./# *#' > $RUNNER_TEMP/checksums.txt
97+ shasum -a 256 -U -c $RUNNER_TEMP/checksums.txt
98+ mv $RUNNER_TEMP/checksums.txt .
99+ cat checksums.txt | while read sum file; do
100+ if [[ "${file#\*}" == docker-compose-* && "${file#\*}" != *.provenance.json && "${file#\*}" != *.sbom.json && "${file#\*}" != *.sigstore.json ]]; then
101+ echo "$sum $file" > ${file#\*}.sha256
102+ fi
103+ done
115104 -
116105 name : Upload artifacts
117- uses : actions/upload-artifact@v4
106+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
118107 with :
119- name : compose-${{ env.PLATFORM_PAIR }}
120- path : ./bin/release
108+ name : release
109+ path : ./bin/release/*
121110 if-no-files-found : error
122111
112+ bin-image-test :
113+ if : github.event_name == 'pull_request'
114+ uses : docker/github-builder/.github/workflows/bake.yml@70313223e2665c3211b454b3fea6534624e78d64 # v1.4.0
115+ with :
116+ runner : amd64
117+ target : image-cross
118+ cache : true
119+ cache-scope : bin-image-test
120+ output : image
121+ push : false
122+ sbom : true
123+ set-meta-labels : true
124+ meta-images : |
125+ compose-bin
126+ meta-tags : |
127+ type=ref,event=pr
128+ meta-bake-target : meta-helper
129+
123130 test :
124131 runs-on : ubuntu-latest
125132 steps :
126133 -
127134 name : Set up Docker Buildx
128- uses : docker/setup-buildx-action@v3
135+ uses : docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
129136 -
130137 name : Test
131- uses : docker/bake-action@v6
138+ uses : docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7
132139 with :
133140 targets : test
134141 set : |
135142 *.cache-from=type=gha,scope=test
136143 *.cache-to=type=gha,scope=test
137144 -
138145 name : Gather coverage data
139- uses : actions/upload-artifact@v4
146+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
140147 with :
141148 name : coverage-data-unit
142149 path : bin/coverage/unit/
143150 if-no-files-found : error
144151 -
145152 name : Unit Test Summary
146- uses : test-summary/action@v2
153+ uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
147154 with :
148155 paths : bin/coverage/unit/report.xml
149156 if : always()
157+
150158 e2e :
151159 runs-on : ubuntu-latest
160+ name : e2e (${{ matrix.mode }}, ${{ matrix.channel }})
152161 strategy :
153162 fail-fast : false
154163 matrix :
155- mode :
156- - plugin
157- - standalone
158- engine :
159- - 27 # old stable (latest major - 1)
160- - 28 # current stable
164+ include :
165+ # current stable
166+ - mode : plugin
167+ engine : 29
168+ channel : stable
169+ - mode : standalone
170+ engine : 29
171+ channel : stable
172+
173+ # old stable (latest major - 1)
174+ - mode : plugin
175+ engine : 28
176+ channel : oldstable
177+ - mode : standalone
178+ engine : 28
179+ channel : oldstable
161180 steps :
162181 - name : Prepare
163182 run : |
@@ -166,7 +185,7 @@ jobs:
166185 echo "MODE_ENGINE_PAIR=${mode}-${engine}" >> $GITHUB_ENV
167186
168187 - name : Checkout
169- uses : actions/checkout@v4
188+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
170189
171190 - name : Install Docker ${{ matrix.engine }}
172191 run : |
@@ -180,25 +199,25 @@ jobs:
180199 run : docker --version
181200
182201 - name : Set up Docker Buildx
183- uses : docker/setup-buildx-action@v3
202+ uses : docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
184203
185204 - name : Set up Docker Model
186205 run : |
187206 sudo apt-get install docker-model-plugin
188207 docker model version
189208
190209 - name : Set up Go
191- uses : actions/setup-go@v5
210+ uses : actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
192211 with :
193- go-version-file : ' go.mod '
212+ go-version-file : ' .go-version '
194213 check-latest : true
195214 cache : true
196215
197216 - name : Build example provider
198217 run : make example-provider
199218
200219 - name : Build
201- uses : docker/bake-action@v6
220+ uses : docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7
202221 with :
203222 source : .
204223 targets : binary-with-coverage
@@ -211,7 +230,7 @@ jobs:
211230
212231 - name : Setup tmate session
213232 if : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
214- uses : mxschmitt/action-tmate@8b4e4ac71822ed7e0ad5fb3d1c33483e9e8fb270 # v3.11
233+ uses : mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
215234 with :
216235 limit-access-to-actor : true
217236 github-token : ${{ secrets.GITHUB_TOKEN }}
@@ -225,7 +244,7 @@ jobs:
225244
226245 - name : Gather coverage data
227246 if : ${{ matrix.mode == 'plugin' }}
228- uses : actions/upload-artifact@v4
247+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
229248 with :
230249 name : coverage-data-e2e-${{ env.MODE_ENGINE_PAIR }}
231250 path : bin/coverage/e2e/
@@ -239,10 +258,11 @@ jobs:
239258 make e2e-compose-standalone
240259
241260 - name : e2e Test Summary
242- uses : test-summary/action@v2
261+ uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
243262 with :
244263 paths : /tmp/report/report.xml
245264 if : always()
265+
246266 coverage :
247267 runs-on : ubuntu-latest
248268 needs :
@@ -251,20 +271,20 @@ jobs:
251271 steps :
252272 # codecov won't process the report without the source code available
253273 - name : Checkout
254- uses : actions/checkout@v4
274+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
255275 - name : Set up Go
256- uses : actions/setup-go@v5
276+ uses : actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
257277 with :
258- go-version-file : ' go.mod '
278+ go-version-file : ' .go-version '
259279 check-latest : true
260280 - name : Download unit test coverage
261- uses : actions/download-artifact@v4
281+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
262282 with :
263283 name : coverage-data-unit
264284 path : coverage/unit
265285 merge-multiple : true
266286 - name : Download E2E test coverage
267- uses : actions/download-artifact@v4
287+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
268288 with :
269289 pattern : coverage-data-e2e-*
270290 path : coverage/e2e
@@ -273,46 +293,32 @@ jobs:
273293 run : |
274294 go tool covdata textfmt -i=./coverage/unit,./coverage/e2e -o ./coverage.txt
275295 - name : Store coverage report in GitHub Actions
276- uses : actions/upload-artifact@v4
296+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
277297 with :
278298 name : go-covdata-txt
279299 path : ./coverage.txt
280300 if-no-files-found : error
281301 - name : Upload coverage to Codecov
282- uses : codecov/codecov-action@v3
302+ uses : codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
283303 with :
284304 files : ./coverage.txt
285305
286306 release :
287307 permissions :
288308 contents : write # to create a release (ncipollo/release-action)
289-
290309 runs-on : ubuntu-latest
291310 needs :
292- - binary
311+ - binary-finalize
293312 steps :
294313 -
295314 name : Checkout
296- uses : actions/checkout@v4
315+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
297316 -
298317 name : Download artifacts
299- uses : actions/download-artifact@v4
318+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
300319 with :
301- pattern : compose-*
302320 path : ./bin/release
303- merge-multiple : true
304- -
305- name : Create checksums
306- working-directory : ./bin/release
307- run : |
308- find . -type f -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# \*\./# *#' > $RUNNER_TEMP/checksums.txt
309- shasum -a 256 -U -c $RUNNER_TEMP/checksums.txt
310- mv $RUNNER_TEMP/checksums.txt .
311- cat checksums.txt | while read sum file; do
312- if [[ "${file#\*}" == docker-compose-* && "${file#\*}" != *.provenance.json && "${file#\*}" != *.sbom.json ]]; then
313- echo "$sum $file" > ${file#\*}.sha256
314- fi
315- done
321+ name : release
316322 -
317323 name : List artifacts
318324 run : |
@@ -324,7 +330,7 @@ jobs:
324330 -
325331 name : GitHub Release
326332 if : startsWith(github.ref, 'refs/tags/v')
327- uses : ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37 # v1.10 .0
333+ uses : ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21 .0
328334 with :
329335 artifacts : ./bin/release/*
330336 generateReleaseNotes : true
0 commit comments