@@ -171,68 +171,15 @@ jobs:
171171 name : LedFx-${{ steps.ledfx-version.outputs.ledfx-version }}-osx-arm64
172172 path : ${{ github.workspace }}/dist/*
173173
174- docker- build-amd64 :
175- name : Build amd64 edge and cache images
174+ build-ledfx-docker :
175+ name : Build LedFx Docker Image for ${{ matrix.ARCH }}
176176 runs-on : ubuntu-latest
177+ strategy :
178+ matrix :
179+ ARCH : ["amd64", "arm64"]
180+ fail-fast : false
177181 env :
178182 IMAGE_NAME : ledfx
179- ARCH : amd64
180- steps :
181- - name : Checkout code
182- uses : actions/checkout@v4
183- - name : Set up QEMU (for arm64 emulation)
184- uses : docker/setup-qemu-action@v3
185- - name : Set up Docker Buildx
186- uses : docker/setup-buildx-action@v3
187- - name : Lowercase repository owner
188- id : repo
189- run : |
190- GHCR_IMAGE="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE_NAME}"
191- echo "GHCR_IMAGE=${GHCR_IMAGE}" >> $GITHUB_ENV
192- if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == refs/tags/v* ]] && [[ "${GITHUB_EVENT_NAME}" != "pull_request" ]]; then
193- echo "DOCKER_CACHE_TO=type=registry,ref=${GHCR_IMAGE}:cache-${ARCH},mode=max" >> $GITHUB_ENV
194- else
195- echo "DOCKER_CACHE_TO=" >> $GITHUB_ENV
196- fi
197- - name : Login to GitHub Container Registry
198- uses : docker/login-action@v3
199- with :
200- registry : ghcr.io
201- username : ${{ github.actor }}
202- password : ${{ secrets.GITHUB_TOKEN }}
203- - name : Build and push image ${{ env.GHCR_IMAGE }}:edge-${{ env.ARCH }} and ${{ env.GHCR_IMAGE }}:cache-${{ env.ARCH }}
204- uses : docker/build-push-action@v6
205- with :
206- context : ./
207- file : ./ledfx_docker/Dockerfile
208- platforms : linux/${{ env.ARCH }}
209- provenance : false # https://github.com/orgs/community/discussions/45969#discussioncomment-4852744
210- sbom : false
211- push : ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.event_name != 'pull_request' }}
212- load : true
213- tags : |
214- ${{ env.GHCR_IMAGE }}:edge-${{ env.ARCH }}
215- ${{ env.GHCR_IMAGE }}:edge-${{ env.ARCH }}-${{ github.sha }}
216- cache-from : type=registry,ref=${{ env.GHCR_IMAGE }}:cache-${{ env.ARCH }}
217- cache-to : ${{ env.DOCKER_CACHE_TO }}
218- build-args : |
219- GITHUB_SHA=${{ github.sha }}
220- IS_RELEASE=${{ startsWith(github.ref, 'refs/tags/') }}
221- - name : Save Docker image as artifact
222- run : |
223- docker save ${{ env.GHCR_IMAGE }}:edge-${{ env.ARCH }}-${{ github.sha }} -o image-${{ env.ARCH }}.tar
224- - name : Upload image artifact
225- uses : actions/upload-artifact@v4
226- with :
227- name : image-${{ env.ARCH }}
228- path : image-${{ env.ARCH }}.tar
229-
230- docker-build-arm64 :
231- name : Build arm64 edge and cache images
232- runs-on : ubuntu-latest
233- env :
234- IMAGE_NAME : ledfx
235- ARCH : arm64
236183 steps :
237184 - name : Checkout code
238185 uses : actions/checkout@v4
@@ -246,7 +193,7 @@ jobs:
246193 GHCR_IMAGE="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE_NAME}"
247194 echo "GHCR_IMAGE=${GHCR_IMAGE}" >> $GITHUB_ENV
248195 if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == refs/tags/v* ]] && [[ "${GITHUB_EVENT_NAME}" != "pull_request" ]]; then
249- echo "DOCKER_CACHE_TO=type=registry,ref=${GHCR_IMAGE}:cache-${ARCH},mode=max" >> $GITHUB_ENV
196+ echo "DOCKER_CACHE_TO=type=registry,ref=${GHCR_IMAGE}:cache-${{ matrix. ARCH } },mode=max" >> $GITHUB_ENV
250197 else
251198 echo "DOCKER_CACHE_TO=" >> $GITHUB_ENV
252199 fi
@@ -256,72 +203,77 @@ jobs:
256203 registry : ghcr.io
257204 username : ${{ github.actor }}
258205 password : ${{ secrets.GITHUB_TOKEN }}
259- - name : Build and push image ${{ env.GHCR_IMAGE }}:edge-${{ env .ARCH }} and ${{ env.GHCR_IMAGE }}:cache-${{ env .ARCH }}
206+ - name : Build and push image ${{ env.GHCR_IMAGE }}:edge-${{ matrix .ARCH }} and ${{ env.GHCR_IMAGE }}:cache-${{ matrix .ARCH }}
260207 uses : docker/build-push-action@v6
261208 with :
262209 context : ./
263210 file : ./ledfx_docker/Dockerfile
264- platforms : linux/${{ env .ARCH }}
211+ platforms : linux/${{ matrix .ARCH }}
265212 provenance : false # https://github.com/orgs/community/discussions/45969#discussioncomment-4852744
266213 sbom : false
267214 push : ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.event_name != 'pull_request' }}
268215 load : true
269216 tags : |
270- ${{ env.GHCR_IMAGE }}:edge-${{ env .ARCH }}
271- ${{ env.GHCR_IMAGE }}:edge-${{ env .ARCH }}-${{ github.sha }}
272- cache-from : type=registry,ref=${{ env.GHCR_IMAGE }}:cache-${{ env .ARCH }}
217+ ${{ env.GHCR_IMAGE }}:edge-${{ matrix .ARCH }}
218+ ${{ env.GHCR_IMAGE }}:edge-${{ matrix .ARCH }}-${{ github.sha }}
219+ cache-from : type=registry,ref=${{ env.GHCR_IMAGE }}:cache-${{ matrix .ARCH }}
273220 cache-to : ${{ env.DOCKER_CACHE_TO }}
274221 build-args : |
275222 GITHUB_SHA=${{ github.sha }}
276223 IS_RELEASE=${{ startsWith(github.ref, 'refs/tags/') }}
277224 - name : Save Docker image as artifact
278225 run : |
279- docker save ${{ env.GHCR_IMAGE }}:edge-${{ env .ARCH }}-${{ github.sha }} -o image-${{ env .ARCH }}.tar
226+ docker save ${{ env.GHCR_IMAGE }}:edge-${{ matrix .ARCH }}-${{ github.sha }} -o image-${{ matrix .ARCH }}.tar
280227 - name : Upload image artifact
281228 uses : actions/upload-artifact@v4
282229 with :
283- name : image-${{ env .ARCH }}
284- path : image-${{ env .ARCH }}.tar
285- docker-test-amd64 :
286- name : Test amd64 image
287- needs : [docker- build-amd64 ]
230+ name : image-${{ matrix .ARCH }}
231+ path : image-${{ matrix .ARCH }}.tar
232+ docker-test :
233+ name : Test docker images
234+ needs : [build-ledfx-docker ]
288235 runs-on : ubuntu-latest
236+ strategy :
237+ matrix :
238+ ARCH : ["amd64", "arm64"]
239+ fail-fast : false
289240 env :
290241 IMAGE_NAME : ledfx
291- ARCH : amd64
292242 steps :
293243 - name : Lowercase repository owner
294244 id : repo
295245 run : |
296246 echo "GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV
247+
248+ - name : Set up QEMU (for arm64 emulation)
249+ uses : docker/setup-qemu-action@v3
250+
297251 - name : Download image artifact
298252 uses : actions/download-artifact@v4
299253 with :
300- name : image-${{ env .ARCH }}
254+ name : image-${{ matrix .ARCH }}
301255 - name : Load Docker image
302- run : docker load -i image-${{ env .ARCH }}.tar
256+ run : docker load -i image-${{ matrix .ARCH }}.tar
303257 - name : Run test container
304258 run : |
305- docker run --rm ${{ env.GHCR_IMAGE }}:edge-${{ env .ARCH }}-${{ github.sha }} --ci-smoke-test -vv --offline
259+ docker run --rm ${{ env.GHCR_IMAGE }}:edge-${{ matrix .ARCH }}-${{ github.sha }} --ci-smoke-test -vv --offline
306260 - name : Get LedFx Version
307261 run : |
308- docker run --rm --entrypoint ledfx ${{ env.GHCR_IMAGE }}:edge-${{ env .ARCH }}-${{ github.sha }} --version | sed 's/LedFx //' > ledfx_version_docker.txt
262+ docker run --rm --entrypoint ledfx ${{ env.GHCR_IMAGE }}:edge-${{ matrix .ARCH }}-${{ github.sha }} --version | sed 's/LedFx //' > ledfx_version_docker.txt
309263 - name : Upload image artifact
310264 uses : actions/upload-artifact@v4
311265 with :
312- name : ledfx_version_docker
266+ name : ledfx_version_docker-${{ matrix.ARCH }}
313267 path : ledfx_version_docker.txt
314268
315269 docker-publish :
316270 name : Publish docker multiarch image
317- needs : [docker- build-amd64, docker-build-arm64 , docker-test-amd64 ]
271+ needs : [build-ledfx-docker , docker-test]
318272 runs-on : ubuntu-latest
319273 env :
320274 IMAGE_NAME : ledfx
321275 ARCH : amd64
322276 steps :
323- # - name: Set up Docker Buildx
324- # uses: docker/setup-buildx-action@v3
325277 - name : Lowercase repository owner
326278 id : repo
327279 run : |
@@ -335,7 +287,7 @@ jobs:
335287 - name : Download ledfx version docker txt
336288 uses : actions/download-artifact@v4
337289 with :
338- name : ledfx_version_docker
290+ name : ledfx_version_docker-${{ env.ARCH }}
339291 - name : Get LedFx Version
340292 id : ledfx-version
341293 run : |
0 commit comments