This is an automated email from the ASF dual-hosted git repository. jdanek pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-cpp.git
The following commit(s) were added to refs/heads/main by this push: new 33adb6780 QPID-8610: split GitHub Actions caching into /restore and /save (#38) 33adb6780 is described below commit 33adb6780ebaf65b69ed2804f1748b139bd3816a Author: Jiri Daněk <jda...@redhat.com> AuthorDate: Sat Apr 8 15:43:48 2023 +0200 QPID-8610: split GitHub Actions caching into /restore and /save (#38) This implements the https://github.com/actions/cache/blob/main/caching-strategies.md#saving-cache-even-if-the-build-fails The time savings from caching are significant, especially on Windows CI where caching vcpkg helps a lot. --- .github/workflows/build.yml | 78 +++++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40ec5c15e..2db19c4ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -91,8 +91,9 @@ jobs: sudo chmod +x /usr/bin/sccache shell: bash - - name: Cache scoop (on Windows) - uses: actions/cache@v3 + - name: Cache scoop (restore) (on Windows) + uses: actions/cache/restore@v3 + id: restore-scoop-cache if: runner.os == 'Windows' with: path: ~\scoop @@ -101,33 +102,18 @@ jobs: ${{ runner.os }}-scoop-${{ env.OS_VER }}- ${{ runner.os }}-scoop- - - name: Cache vcpkg/downloads (on Windows) - uses: actions/cache@v3 + - name: Cache vcpkg/downloads and vcpkg/installed (restore) (on Windows) + uses: actions/cache/restore@v3 + id: restore-vcpkg-cache if: runner.os == 'Windows' with: - path: C:\vcpkg\downloads - key: ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-${{ hashFiles('.github/workflows/build.yml') }} + path: | + C:\vcpkg\downloads + C:\vcpkg\installed + key: ${{ runner.os }}-vcpkg-${{ env.OS_VER }}-${{ hashFiles('.github/workflows/build.yml') }} restore-keys: | - ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}- - ${{ runner.os }}-vcpkg-download- - - name: Cache vcpkg/installed (on Windows) - uses: actions/cache@v3 - if: runner.os == 'Windows' - with: - path: C:\vcpkg\installed - key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-${{ hashFiles('.github/workflows/build.yml') }} - restore-keys: | - ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}- - ${{ runner.os }}-vcpkg-installed- - - - name: Cache SCCACHE_DIR - uses: actions/cache@v3 - with: - path: "${{ env.SCCACHE_DIR }}" - key: ${{ runner.os }}-sccache-${{ matrix.os }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-sccache-${{ matrix.os }}- - ${{ runner.os }}-sccache- + ${{ runner.os }}-vcpkg-${{ env.OS_VER }}- + ${{ runner.os }}-vcpkg- - name: Install Windows dependencies if: runner.os == 'Windows' @@ -141,13 +127,35 @@ jobs: # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#add-a-system-path-add-path Add-Content ${env:GITHUB_PATH} "${HOME}/scoop/shims" - + shell: pwsh + + - name: Cache scoop (save) (on Windows) + uses: actions/cache/save@v3 + if: runner.os == 'Windows' + with: + path: ~\scoop + key: ${{ steps.restore-scoop-cache.outputs.cache-primary-key }} + + - name: Cache vcpkg/downloads and vcpkg/installed (save) (on Windows) + uses: actions/cache/save@v3 + if: runner.os == 'Windows' + with: + path: | + C:\vcpkg\downloads + C:\vcpkg\installed + key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }} + + # don't save this into the vcpkg cache + - name: Copy over Boost DLLs to where we expect them + if: runner.os == 'Windows' + run: | # work around assumptions in our build scripts about boost libs layout Copy-Item -Path C:/vcpkg/installed/x64-windows/debug/bin/* -Include *.dll -Destination C:/vcpkg/installed/x64-windows/debug/lib Get-Item C:/vcpkg/installed/x64-windows/debug/lib/*.dll | Rename-Item -NewName { $_.Name -replace '-vc14.-mt-gd-x64-1_81.dll','-vc140-mt-gd.dll' } # display results of this hard work ls C:/vcpkg/installed/x64-windows/debug/bin/ ls C:/vcpkg/installed/x64-windows/debug/lib/ + # now do the same for release Copy-Item -Path C:/vcpkg/installed/x64-windows/bin/* -Include *.dll -Destination C:/vcpkg/installed/x64-windows/lib Get-Item C:/vcpkg/installed/x64-windows/lib/*.dll | Rename-Item -NewName { $_.Name -replace '-vc14.-mt-x64-1_81.dll','-vc140-mt.dll' } @@ -156,6 +164,16 @@ jobs: ls C:/vcpkg/installed/x64-windows/lib/ shell: pwsh + - name: Cache SCCACHE_DIR (restore) + uses: actions/cache/restore@v3 + id: restore-sccache-cache + with: + path: "${{ env.SCCACHE_DIR }}" + key: ${{ runner.os }}-sccache-${{ matrix.os }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-sccache-${{ matrix.os }}- + ${{ runner.os }}-sccache- + # Windows build should ideally use something like '-G "Visual Studio 16 2019" -A x64', # but -DCMAKE_C_COMPILER_LAUNCHER is only supported by make and ninja generators # https://devblogs.microsoft.com/scripting/powertip-line-continuation-in-powershell/ @@ -176,6 +194,12 @@ jobs: cmake --install "${{env.BuildDir}}" --config ${{env.BuildType}} shell: pwsh + - name: Cache SCCACHE_DIR (save) + uses: actions/cache/save@v3 + with: + path: "${{ env.SCCACHE_DIR }}" + key: ${{ steps.restore-sccache-cache.outputs.cache-primary-key }} + - id: ctest name: ctest working-directory: ${{env.BuildDir}} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org