From fbcfc103ddd08f5004ec7d43d6efcc2ebb128bef Mon Sep 17 00:00:00 2001 From: Edgar Gomes Date: Thu, 22 Aug 2024 10:46:51 -0300 Subject: [PATCH] chore: clean-up GH cache (#21) * add cache cleaning after merges * add comment --- .github/workflows/cache-clean-up.yaml | 29 +++++++++++++++++++++++++++ .github/workflows/ci.yml | 7 ++++--- 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/cache-clean-up.yaml diff --git a/.github/workflows/cache-clean-up.yaml b/.github/workflows/cache-clean-up.yaml new file mode 100644 index 0000000..e6bdb12 --- /dev/null +++ b/.github/workflows/cache-clean-up.yaml @@ -0,0 +1,29 @@ +name: cleanup caches by a branch +on: + pull_request: + types: + - closed + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Cleanup + run: | + gh extension install actions/gh-actions-cache + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1e7ed7..2d3f661 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,7 +62,8 @@ jobs: strategy: matrix: component: [kontrol-service, kontrol-frontend] - # arch: [amd64, arm64] + # Skipping arm64 builds due GH cache rate limit casue by the + # number of cache entries generated by pkgsCross builds arch: [amd64] steps: - name: Git checkout @@ -77,14 +78,14 @@ jobs: # relax sandbox due impure kontrol-service tests during build extra_nix_config: | sandbox = relaxed - # extra-platforms = aarch64-linux + extra-platforms = aarch64-linux - name: Magic cache uses: DeterminateSystems/magic-nix-cache-action@v7 - name: Build ${{ matrix.component }} run: | - nix build .#${{ matrix.component }} --print-build-logs + nix build .#${{ matrix.component }} --no-link --print-out-paths --print-build-logs - name: Build ${{ matrix.component }} for ${{ matrix.arch }} run: |