diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8aa3e5b22..33b5192c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,8 +43,6 @@ jobs: if: runner.os == 'Linux' shell: bash run: | - # Install compiler - cc="${{ matrix.compiler }}-${{ matrix.version }}" cc="${cc%-}" cxx="${cc/clang/clang++}" @@ -58,7 +56,7 @@ jobs: sudo apt-get remove libstdc++-9-dev libgcc-9-dev cpp-9 fi sudo apt-get update - sudo apt-get install -y libtool m4 autoconf + sudo apt-get install -y libtool m4 autoconf ccache if [ "${{ matrix.compiler }}" = "gcc" ]; then sudo apt-get install -y "${cxx}" else @@ -69,7 +67,8 @@ jobs: - name: Install (macOS) if: runner.os == 'macOS' run: | - brew install autoconf automake libtool cmake + brew install autoconf automake libtool cmake ccache + export PATH="/usr/local/opt/ccache/libexec:$PATH"; if [ "${{ matrix.compiler }}" = "gcc" ]; then echo "::set-env name=CC::gcc-${{ matrix.version }}" echo "::set-env name=CXX::g++-${{ matrix.version }}" @@ -83,7 +82,11 @@ jobs: - name: Create Build Environment shell: bash run: cmake -E make_directory ${{runner.workspace}}/build - + - name: Cache ccache files + uses: actions/cache@v1.1.2 + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('**/*.c') }}-${{ hashFiles('**/*.cpp') }} - name: Configure shell: bash working-directory: ${{runner.workspace}}/build @@ -92,8 +95,9 @@ jobs: - name: Build shell: bash working-directory: ${{runner.workspace}}/build - run: cmake --build . --config Debug -- -j 4 - + run: | + [ -d "$HOME/.ccache" ] && sudo chown -R "$USER": "$HOME/.ccache" + cmake --build . --config Debug -- -j 4 - name: Test shell: bash working-directory: ${{runner.workspace}}/build