Update views.py #120
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: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Create builder instance | |
run: | | |
docker buildx create --name mybuilder --use | |
docker buildx inspect --bootstrap | |
- name: Enable qemu | |
run: | | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- 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 | |
run: | | |
docker buildx build --builder mybuilder --platform=${{ matrix.arch }} --build-arg TARGETPLATFORM=${{ matrix.arch }} --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache -t diyhue/diyhue:ci -f ./.build/Dockerfile --load . | |
- 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 | |
run: | | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- 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 |