Skip to content

Commit

Permalink
Modified: Caching dependencies to speed up the workflow
Browse files Browse the repository at this point in the history
restore a cached version of the snappy from a previous run
If the cache is not found (cache-hit != 'true'), it installs snappy and the installed files are cached for future runs.
Caches the build directory to speed up subsequent builds (The cache key is based on the CMakeLists.txt files' hash to ensure the cache is updated when the build configuration changes).
  • Loading branch information
s-bose7 committed Jun 20, 2024
1 parent 0742260 commit 664480a
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,29 @@ jobs:
with:
submodules: true # This ensures that the googletest submodule is also checked out

- name: Install dependencies
- name: Cache snappy dependencies
id: cache-snappy
uses: actions/cache@v2
with:
path: /usr/local/snappy
key: ${{ runner.os }}-snappy-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-snappy-
- name: Install snappy dependencies if not cached
if: steps.cache-snappy.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y libsnappy-dev
- name: Cache CMake build
uses: actions/cache@v2
with:
path: build
key: ${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-cmake-
- name: Configure CMake
run: mkdir build && cd build && cmake -DUSE_SUBMODULE_GTEST=ON ..

Expand Down

0 comments on commit 664480a

Please sign in to comment.