Modified: Caching dependencies to speed up the workflow #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake Continuous Integration | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
submodules: true # This ensures that the googletest submodule is also checked out | |
- 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: Prepare build directory | |
run: | | |
if [ -d build ]; then rm -rf build; fi | |
mkdir build | |
- name: Configure CMake | |
run: cd build && cmake -DUSE_SUBMODULE_GTEST=ON .. | |
- name: Build | |
run: cd build && make | |
- name: Run tests | |
run: cd build && ./run_tests |