Skip to content

Commit

Permalink
ci: always save vcpkg cache (GoogleCloudPlatform#377)
Browse files Browse the repository at this point in the history
Save the vcpkg cache immediately after it is generated. This makes the
next run faster if there is an error compiling our code or running one
of our tests.
  • Loading branch information
coryan committed Jul 5, 2023
1 parent 386b296 commit 3378093
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ jobs:
cmake -S . -B "${{runner.temp}}/build" -GNinja
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
- uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cache/vcpkg
~/.cache/bin
key: vcpkg-${{ env.vcpkg_SHA }}-build-ubuntu-focal-${{ hashFiles('vcpkg.json') }}
- name: build
run: cmake --build "${{runner.temp}}/build"
- name: test
Expand Down Expand Up @@ -82,6 +89,12 @@ jobs:
run: >
cmake -S examples/site/howto_local_development -B "${{runner.temp}}/howto_local_development/build" -GNinja
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
- uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cache/vcpkg
key: vcpkg-${{ env.vcpkg_SHA }}-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
- name: build-local-development
env:
VCPKG_OVERLAY_PORTS: "${{runner.temp}}/quickstart/vcpkg-overlays"
Expand Down Expand Up @@ -127,6 +140,12 @@ jobs:
'-DBUILD_TESTING=ON' `
'-DFUNCTIONS_FRAMEWORK_CPP_TEST_EXAMPLES=OFF' `
'-DCMAKE_TOOLCHAIN_FILE=${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake'
- uses: actions/cache/save@v3
if: always()
with:
path: |
~\AppData\Local\vcpkg\archives
key: vcpkg-${{ env.vcpkg_SHA }}-build-msvc-2019-2-${{ hashFiles('vcpkg.json') }}
- name: build
run: cmake --build "${{runner.temp}}/build"
- name: test
Expand Down Expand Up @@ -167,6 +186,13 @@ jobs:
cmake -S . -B "${{runner.temp}}/build" -GNinja
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
- uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cache/vcpkg
~/.cache/bin
key: vcpkg-${{ env.vcpkg_SHA }}-build-macos-10-${{ hashFiles('vcpkg.json') }}
- name: build
run: cmake --build "${{runner.temp}}/build"
- name: test
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_CXX_FLAGS=--coverage
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
- uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cache/vcpkg
~/.cache/bin
key: vcpkg-${{ env.vcpkg_SHA }}-coverage-${{ hashFiles('vcpkg.json') }}
- name: build
run: cmake --build ${{runner.workspace}}/build
- name: test
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/sanitize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ jobs:
-DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}} -DGRPC_TSAN_SUPPRESSED -DGRPC_ASAN_SUPPRESSED"
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
- uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cache/vcpkg
~/.cache/bin
key: vcpkg-${{ env.vcpkg_SHA }}-sanitize-${{ matrix.sanitizer }}-${{ hashFiles('vcpkg.json') }}
- name: -fsanitize=${{matrix.sanitizer}} / build
run: cmake --build "${{runner.temp}}/build"
- name: -fsanitize=${{matrix.sanitizer}} / test
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ jobs:
cmake -S . -B "${{runner.temp}}/build"
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
- uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cache/vcpkg
~/.cache/bin
key: vcpkg-${{ env.vcpkg_SHA }}-style-clang-tidy-${{ hashFiles('vcpkg.json') }}
- name: tidy
run: >
git ls-files -z -- '*.cc' |
Expand Down Expand Up @@ -90,6 +97,13 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
- uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cache/vcpkg
~/.cache/bin
key: vcpkg-${{ env.vcpkg_SHA }}-werror-${{ matrix.compiler.cxx }}-${{ hashFiles('vcpkg.json') }}
- name: compiler=${{matrix.compiler.cxx}} / build
run: cmake --build "${{runner.temp}}/build"
- name: compiler=${{matrix.compiler.cxx}} / test
Expand Down

0 comments on commit 3378093

Please sign in to comment.