Update docker-release.yml #108
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: diyHue CI Build | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build Docker Image | |
strategy: | |
matrix: | |
include: | |
- arch: linux/amd64 | |
arch_friendly: amd64 | |
- arch: linux/arm/v7 | |
arch_friendly: armv7 | |
- arch: linux/arm64 | |
arch_friendly: arm64 | |
- arch: linux/arm/v6 | |
arch_friendly: armv6 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Enable qemu | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.arch }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.arch }}- | |
- name: Build docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./.build/Dockerfile | |
platforms: ${{ matrix.arch }} | |
tags: diyhue/diyhue:ci | |
build-args: | | |
TARGETPLATFORM=${{ matrix.arch }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max | |
- name: Verify image exists | |
run: | | |
docker images diyhue/diyhue:ci | |
- name: Save tarball | |
run: | | |
docker save --output output.tar diyhue/diyhue:ci | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ci-${{ matrix.arch_friendly }}-${{ github.run_number }}.tar | |
path: output.tar | |
test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
name: Test Image | |
strategy: | |
matrix: | |
arch: [amd64, armv7, arm64, armv6] | |
steps: | |
- name: Enable qemu | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Download container artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ci-${{ matrix.arch }}-${{ github.run_number }}.tar | |
- name: Import image | |
run: | | |
docker load --input output.tar | |
- name: Run docker image | |
if: success() | |
run: | | |
docker run -d --name diyhue --network=host -v /mnt/hue-emulator/export:/opt/hue-emulator/export -e MAC=b8:27:eb:d4:dc:11 -e IP=192.168.1.123 -e DEBUG=true diyhue/diyhue:ci | |
sleep 15 | |
docker logs diyhue | |
- name: Cleanup | |
run: | | |
docker kill diyhue | |
docker rm diyhue | |
cleanup_failed: | |
needs: [build, test] | |
if: failure() | |
name: Delete failed artifacts | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: [amd64, armv7, arm64, armv6] | |
steps: | |
- uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: ci-${{ matrix.arch }}-${{ github.run_number }}.tar |