From d767ac994095db1c3985901317a29d3fc2d852b0 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 17 Aug 2021 22:00:33 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Add-on=20CI=20improvements=20(#1?= =?UTF-8?q?90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 18 ++++++++++++------ .github/workflows/deploy.yaml | 16 +++++++++++----- .github/workflows/pr-labels.yaml | 3 ++- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 05ff901..e6f1c8f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -38,7 +38,7 @@ jobs: - name: โคต๏ธ Check out code from GitHub uses: actions/checkout@v2.3.4 - name: ๐Ÿš€ Run Add-on Lint - uses: frenck/action-addon-linter@v2 + uses: frenck/action-addon-linter@v2.2 with: community: true path: "./${{ needs.information.outputs.target }}" @@ -132,11 +132,9 @@ jobs: uses: actions/cache@v2.1.6 with: path: /tmp/.docker-cache - key: - docker-${{ github.ref }}-${{ matrix.architecture }}-${{ github.sha - }} + key: docker-${{ matrix.architecture }}-${{ github.sha }} restore-keys: | - docker-${{ github.ref }}-${{ matrix.architecture }} + docker-${{ matrix.architecture }} - name: ๐Ÿ— Set up QEMU uses: docker/setup-qemu-action@v1.2.0 - name: ๐Ÿ— Set up Docker Buildx @@ -186,7 +184,7 @@ jobs: cache-from: | type=local,src=/tmp/.docker-cache ghcr.io/hassio-addons/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge - cache-to: type=local,mode=max,dest=/tmp/.docker-cache + cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new platforms: ${{ steps.flags.outputs.platform }} build-args: | BUILD_ARCH=${{ matrix.architecture }} @@ -197,3 +195,11 @@ jobs: BUILD_REF=${{ github.sha }} BUILD_REPOSITORY=${{ github.repository }} BUILD_VERSION=edge + # This ugly bit is necessary, or our cache will grow forever... + # Well until we hit GitHub's limit of 5GB :) + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + - name: ๐Ÿšš Swap build cache + run: | + rm -rf /tmp/.docker-cache + mv /tmp/.docker-cache-new /tmp/.docker-cache diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index cea2687..e29ce07 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -75,11 +75,9 @@ jobs: uses: actions/cache@v2.1.6 with: path: /tmp/.docker-cache - key: - docker-${{ github.ref }}-${{ matrix.architecture }}-${{ github.sha - }} + key: docker-${{ matrix.architecture }}-${{ github.sha }} restore-keys: | - docker-${{ github.ref }}-${{ matrix.architecture }} + docker-${{ matrix.architecture }} - name: ๐Ÿ— Set up QEMU uses: docker/setup-qemu-action@v1.2.0 - name: ๐Ÿ— Set up Docker Buildx @@ -140,7 +138,7 @@ jobs: cache-from: | type=local,src=/tmp/.docker-cache ghcr.io/hassio-addons/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge - cache-to: type=local,mode=max,dest=/tmp/.docker-cache + cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new platforms: ${{ steps.flags.outputs.platform }} build-args: | BUILD_ARCH=${{ matrix.architecture }} @@ -151,6 +149,14 @@ jobs: BUILD_REF=${{ github.sha }} BUILD_REPOSITORY=${{ github.repository }} BUILD_VERSION=${{ needs.information.outputs.version }} + # This ugly bit is necessary, or our cache will grow forever... + # Well until we hit GitHub's limit of 5GB :) + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + - name: ๐Ÿšš Swap build cache + run: | + rm -rf /tmp/.docker-cache + mv /tmp/.docker-cache-new /tmp/.docker-cache - name: ๐Ÿ” Notarize # yamllint disable rule:line-length run: | diff --git a/.github/workflows/pr-labels.yaml b/.github/workflows/pr-labels.yaml index 41da9cf..cdb62ab 100644 --- a/.github/workflows/pr-labels.yaml +++ b/.github/workflows/pr-labels.yaml @@ -3,7 +3,7 @@ name: PR Labels # yamllint disable-line rule:truthy on: - pull_request: + pull_request_target: types: [opened, labeled, unlabeled, synchronize] jobs: @@ -14,6 +14,7 @@ jobs: - name: ๐Ÿท Verify PR has a valid label uses: jesusvasquez333/verify-pr-label-action@v1.4.0 with: + pull-request-number: "${{ github.event.pull_request.number }}" github-token: "${{ secrets.GITHUB_TOKEN }}" valid-labels: >- breaking-change, bugfix, documentation, enhancement, refactor,