[openwrt/openwrt] CI: build: add job to remove previous ccache cache if already exist

LEDE Commits lede-commits at lists.infradead.org
Tue Oct 24 08:14:38 PDT 2023


ansuel pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/fad08e8e23bc1db8224a7f34c5f3775b59cfb577

commit fad08e8e23bc1db8224a7f34c5f3775b59cfb577
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Sun May 28 02:55:26 2023 +0200

    CI: build: add job to remove previous ccache cache if already exist
    
    Github Actions cache doesn't permit to overwrite cache if it does
    already exist. As a trick to refresh and have fresh ccache pool,
    delete the ccache cache if it does exist with the help of Github REST
    API. An additional permission is needed to access this API. Add this
    permittion to each user of the build workflow.
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
    (cherry picked from commit 203cc0a7ef0bbf3b5a19db3caa96e91963ec154c)
---
 .github/workflows/build.yml           | 11 +++++++++++
 .github/workflows/coverity.yml        |  1 +
 .github/workflows/kernel.yml          |  1 +
 .github/workflows/label-kernel.yml    |  2 ++
 .github/workflows/label-target.yml    |  1 +
 .github/workflows/packages.yml        |  1 +
 .github/workflows/push-containers.yml |  1 +
 .github/workflows/toolchain.yml       |  1 +
 8 files changed, 19 insertions(+)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 31da7fa7ab..7ce8a7c034 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -136,6 +136,7 @@ jobs:
     permissions:
       contents: read
       packages: read
+      actions: write
 
     steps:
       - name: Checkout master directory
@@ -475,6 +476,16 @@ jobs:
           name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs
           path: "openwrt/logs"
 
+      - name: Delete already present ccache cache
+        if: steps.restore-ccache-cache.outputs.cache-hit == 'true'
+        uses: octokit/request-action at v2.x
+        with:
+          route: DELETE /repos/{repository}/actions/caches?key={key}
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          INPUT_REPOSITORY: ${{ github.repository }}
+          INPUT_KEY: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }}
+
       - name: Save ccache cache
         uses: actions/cache/save at v3
         with:
diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml
index 1035545632..363ce3a29a 100644
--- a/.github/workflows/coverity.yml
+++ b/.github/workflows/coverity.yml
@@ -15,6 +15,7 @@ jobs:
     permissions:
       contents: read
       packages: read
+      actions: write
     uses: ./.github/workflows/build.yml
     with:
       container_name: toolchain
diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml
index 6be7ef28c2..d9ab8581c9 100644
--- a/.github/workflows/kernel.yml
+++ b/.github/workflows/kernel.yml
@@ -105,6 +105,7 @@ jobs:
     permissions:
       contents: read
       packages: read
+      actions: write
     strategy:
        fail-fast: False
        matrix:
diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml
index 67faaddfcd..29a9d79558 100644
--- a/.github/workflows/label-kernel.yml
+++ b/.github/workflows/label-kernel.yml
@@ -30,6 +30,7 @@ jobs:
     permissions:
       contents: read
       packages: read
+      actions: write
     uses: ./.github/workflows/build.yml
     with:
       container_name: toolchain
@@ -44,6 +45,7 @@ jobs:
     permissions:
       contents: read
       packages: read
+      actions: write
     uses: ./.github/workflows/check-kernel-patches.yml
     with:
       target: ${{ needs.set_target.outputs.target }}
diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml
index 78aea28b10..610aab026a 100644
--- a/.github/workflows/label-target.yml
+++ b/.github/workflows/label-target.yml
@@ -30,6 +30,7 @@ jobs:
     permissions:
       contents: read
       packages: read
+      actions: write
     uses: ./.github/workflows/build.yml
     with:
       container_name: toolchain
diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml
index d4d3565cd7..8ab07f1f07 100644
--- a/.github/workflows/packages.yml
+++ b/.github/workflows/packages.yml
@@ -35,6 +35,7 @@ jobs:
     permissions:
       contents: read
       packages: read
+      actions: write
     strategy:
       fail-fast: False
       matrix:
diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml
index 71b9e47253..04a9b8d8e9 100644
--- a/.github/workflows/push-containers.yml
+++ b/.github/workflows/push-containers.yml
@@ -154,6 +154,7 @@ jobs:
     permissions:
       contents: read
       packages: read
+      actions: write
     strategy:
       fail-fast: False
       matrix:
diff --git a/.github/workflows/toolchain.yml b/.github/workflows/toolchain.yml
index 54e31069e6..4f4d78f4f8 100644
--- a/.github/workflows/toolchain.yml
+++ b/.github/workflows/toolchain.yml
@@ -61,6 +61,7 @@ jobs:
     permissions:
       contents: read
       packages: read
+      actions: write
     strategy:
        fail-fast: False
        matrix:




More information about the lede-commits mailing list