]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Refactor caching
authorJosh Soref <2119212+jsoref@users.noreply.github.com>
Thu, 27 Nov 2025 14:00:52 +0000 (09:00 -0500)
committerJosh Soref <2119212+jsoref@users.noreply.github.com>
Wed, 14 Jan 2026 13:50:19 +0000 (08:50 -0500)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
.github/actions/cache/action.yml [new file with mode: 0644]
.github/workflows/build-and-test-all.yml

diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml
new file mode 100644 (file)
index 0000000..a0f0d35
--- /dev/null
@@ -0,0 +1,27 @@
+name: 'Cache ccache'
+description: 'Configure GitHub Cache for ccache'
+inputs:
+  cache-key-base:
+    description: cache key base
+    required: true
+
+runs:
+  using: "composite"
+  steps:
+    - name: get timestamp for cache
+      id: get-stamp
+      run: |
+        : get timestamp for cache
+        echo "stamp=$(/bin/date +%s)" >> "$GITHUB_OUTPUT"
+      shell: bash
+      working-directory: .
+    - name: make ccache directory
+      shell: bash
+      run: mkdir -p ~/.ccache
+      working-directory: .
+    - name: let GitHub cache our ccache data
+      uses: actions/cache@v4
+      with:
+        path: ~/.ccache
+        key: ${{ inputs.cache-key-base }}-${{ steps.get-stamp.outputs.stamp }}
+        restore-keys: ${{ inputs.cache-key-base }}
index fecbf1d425bc205455b36a6981961dc80d161f7d..2a33a7be832d2e301a800894c7f3cd0853e7e627 100644 (file)
@@ -76,20 +76,10 @@ jobs:
           submodules: recursive
           ref: ${{ inputs.branch-name }}
           persist-credentials: false
-      - name: get timestamp for cache
-        id: get-stamp
-        run: |
-          echo "stamp=$(/bin/date +%s)" >> "$GITHUB_OUTPUT"
-        shell: bash
-        working-directory: .
-      - run: mkdir -p ~/.ccache
-        working-directory: .
-      - name: let GitHub cache our ccache data
-        uses: actions/cache@v4
+      - name: set up build
+        uses: ./.github/actions/cache
         with:
-          path: ~/.ccache
-          key: auth-ccache-${{ matrix.builder }}-${{ steps.get-stamp.outputs.stamp }}
-          restore-keys: auth-ccache-${{ matrix.builder }}
+          cache-key-base: auth-ccache-${{ matrix.builder }}
       - name: set sanitizers
         run: echo "SANITIZERS=${{ matrix.builder == 'meson' && 'address,undefined' || 'asan+ubsan' }}" >> "$GITHUB_ENV"
         working-directory: .
@@ -171,20 +161,10 @@ jobs:
           submodules: recursive
           ref: ${{ inputs.branch-name }}
           persist-credentials: false
-      - name: get timestamp for cache
-        id: get-stamp
-        run: |
-          echo "stamp=$(/bin/date +%s)" >> "$GITHUB_OUTPUT"
-        shell: bash
-        working-directory: .
-      - run: mkdir -p ~/.ccache
-        working-directory: .
-      - name: let GitHub cache our ccache data
-        uses: actions/cache@v4
+      - name: set up build
+        uses: ./.github/actions/cache
         with:
-          path: ~/.ccache
-          key: recursor-ccache-${{ matrix.builder }}-${{ matrix.features }}-${{ matrix.sanitizers }}-${{ steps.get-stamp.outputs.stamp }}
-          restore-keys: recursor-ccache-${{ matrix.builder }}-${{ matrix.features }}-${{ matrix.sanitizers }}
+          cache-key-base: recursor-ccache-${{ matrix.builder }}-${{ matrix.features }}-${{ matrix.sanitizers }}
       - name: install pip build dependencies
         run: |
           python3 -m venv ${REPO_HOME}/.venv
@@ -263,20 +243,10 @@ jobs:
           submodules: recursive
           ref: ${{ inputs.branch-name }}
           persist-credentials: false
-      - name: get timestamp for cache
-        id: get-stamp
-        run: |
-          echo "stamp=$(/bin/date +%s)" >> "$GITHUB_OUTPUT"
-        shell: bash
-        working-directory: .
-      - run: mkdir -p ~/.ccache
-        working-directory: .
-      - name: let GitHub cache our ccache data
-        uses: actions/cache@v4
+      - name: set up build
+        uses: ./.github/actions/cache
         with:
-          path: ~/.ccache
-          key: dnsdist-${{ matrix.features }}-${{ matrix.sanitizers }}-${{ matrix.builder}}${{ matrix.architecture_suffix }}-ccache-${{ steps.get-stamp.outputs.stamp }}
-          restore-keys: dnsdist-${{ matrix.features }}-${{ matrix.sanitizers }}-${{ matrix.builder}}${{ matrix.architecture_suffix }}-ccache-
+          cache-key-base: dnsdist-${{ matrix.features }}-${{ matrix.sanitizers }}-${{ matrix.builder}}${{ matrix.architecture_suffix }}-ccache
       - name: install pip build dependencies
         run: |
           python3 -m venv ${REPO_HOME}/.venv