From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Thu, 27 Nov 2025 14:00:52 +0000 (-0500) Subject: Refactor caching X-Git-Tag: rec-5.4.0-beta1~45^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f34e7302054ce18981136245cc1db6cd2fcb4d67;p=thirdparty%2Fpdns.git Refactor caching Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml new file mode 100644 index 0000000000..a0f0d3521e --- /dev/null +++ b/.github/actions/cache/action.yml @@ -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 }} diff --git a/.github/workflows/build-and-test-all.yml b/.github/workflows/build-and-test-all.yml index fecbf1d425..2a33a7be83 100644 --- a/.github/workflows/build-and-test-all.yml +++ b/.github/workflows/build-and-test-all.yml @@ -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