From 6c71a4d6718a29d385cfb22ce6ac94ad1ad8f543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Thu, 27 Jun 2024 13:12:09 +0300 Subject: [PATCH] fix: caching strategies of colcon-build/test and clang-tidy (#304) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- clang-tidy/action.yaml | 8 ++++++-- colcon-build/action.yaml | 8 ++++++-- colcon-test/action.yaml | 9 --------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/clang-tidy/action.yaml b/clang-tidy/action.yaml index be96e559..a7baab0a 100644 --- a/clang-tidy/action.yaml +++ b/clang-tidy/action.yaml @@ -28,6 +28,10 @@ inputs: include-eol-distros: description: "" required: false + cache-key-element: + description: Will be part of the cache key + default: default + required: false runs: using: composite @@ -83,12 +87,12 @@ runs: - name: Restore build files from cache id: restore-build-files - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: | ./build ./install - key: build-${{ inputs.rosdistro }}-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cmake-build-type }}-${{ github.sha }} + key: build-${{ runner.arch }}-${{ inputs.rosdistro }}-${{ inputs.cache-key-element }}-${{ inputs.cmake-build-type }}-${{ github.sha }} - name: Build if: ${{ steps.restore-build-files.outputs.cache-hit != 'true' }} diff --git a/colcon-build/action.yaml b/colcon-build/action.yaml index 84e1cbbd..49b7e1c3 100644 --- a/colcon-build/action.yaml +++ b/colcon-build/action.yaml @@ -22,6 +22,10 @@ inputs: include-eol-distros: description: "" required: false + cache-key-element: + description: Will be part of the cache key + default: default + required: false runs: using: composite @@ -85,9 +89,9 @@ runs: shell: bash - name: Cache build artifacts - uses: actions/cache@v4 + uses: actions/cache/save@v4 with: path: | ./build ./install - key: build-${{ inputs.rosdistro }}-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cmake-build-type }}-${{ github.sha }} + key: build-${{ runner.arch }}-${{ inputs.rosdistro }}-${{ inputs.cache-key-element }}-${{ inputs.cmake-build-type }}-${{ github.sha }} diff --git a/colcon-test/action.yaml b/colcon-test/action.yaml index 7e005778..d7517ada 100644 --- a/colcon-test/action.yaml +++ b/colcon-test/action.yaml @@ -77,15 +77,6 @@ runs: DEBIAN_FRONTEND=noninteractive rosdep install -yqq --from-paths ${package_paths} --ignore-src --rosdistro ${{ inputs.rosdistro }} shell: bash - - name: Restore build files from cache - id: restore-build-files - uses: actions/cache@v4 - with: - path: | - ./build - ./install - key: build-${{ inputs.rosdistro }}-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cmake-build-type }}-${{ github.sha }} - - name: Test run: | set -e