diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8608b63..56b1cd4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,4 +1,7 @@ on: [ push, pull_request ] +env: + CCACHE_COMPRESS: exists means true + CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime,time_macros jobs: test-release: name: Build and run tests in Release mode @@ -7,6 +10,7 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y \ + ccache \ parallel \ libboost-thread-dev \ libboost-iostreams-dev \ @@ -29,11 +33,24 @@ jobs: cmake -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON \ -D CMAKE_C_COMPILER=gcc \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D CMAKE_CXX_COMPILER=g++ \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ .. popd + - name: Load Cache + uses: actions/cache@v1 + with: + path: ccache + key: ccache-release-${{ github.ref }}-${{ github.sha }} + restore-keys: | + ccache-release-${{ github.ref }}- + ccache-release- + ccache- - name: Build run: | + export CCACHE_DIR="$GITHUB_WORKSPACE/ccache" + mkdir -p "$CCACHE_DIR" make -j 2 -C _build - name: Test run: | @@ -51,6 +68,7 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y \ + ccache \ parallel \ libboost-thread-dev \ libboost-iostreams-dev \ @@ -73,11 +91,24 @@ jobs: cmake -D CMAKE_BUILD_TYPE=Debug \ -D CMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON \ -D CMAKE_C_COMPILER=gcc \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D CMAKE_CXX_COMPILER=g++ \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ .. popd + - name: Load Cache + uses: actions/cache@v1 + with: + path: ccache + key: ccache-debug-${{ github.ref }}-${{ github.sha }} + restore-keys: | + ccache-debug-${{ github.ref }}- + ccache-debug- + ccache- - name: Build run: | + export CCACHE_DIR="$GITHUB_WORKSPACE/ccache" + mkdir -p "$CCACHE_DIR" make -j 2 -C _build - name: Test run: |