From 433c259d919b0cb28f410f8bdcba37455eccb444 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Mon, 23 Nov 2020 22:28:17 -0700 Subject: [PATCH] [Test] Add ccache for compilation results to speed up CI --- .github/workflows/build.yml | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66a95a298..56875bca7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,8 +19,21 @@ env: # Multiple job to tests jobs: # Test the compilation - build_gcc8: - runs-on: ubuntu-18.04 + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + + # Branch on different OS and settings + strategy: + fail-fast: false + matrix: + config: + - { + name: "Build Compatibility: GCC-8 (Ubuntu 18.04)" + artifact: "OpenFPGA-ubuntu-18.04-gcc8-build.7z" + os: ubuntu-18.04 + cc: "gcc-8", cxx: "g++-8" + } # Define the steps to run the build job steps: @@ -30,6 +43,21 @@ jobs: - name: Install dependency run: source ./.github/workflows/install_dependency.sh + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::set-output name=timestamp::${current_date}") + + - name: ccache cache files + uses: actions/cache@v1.1.0 + with: + path: .ccache + key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: | + ${{ matrix.config.name }}-ccache- + - name: Create CMake build environment # Some projects don't allow in-source building, so create a separate build directory # We'll use this as our working directory for all subsequent commands