From 62b549d1be8bf76a3d191b8d07baac04c67ca057 Mon Sep 17 00:00:00 2001 From: "James D. Mitchell" Date: Fri, 27 Oct 2023 14:12:09 +0100 Subject: [PATCH] ci: use multiple versions of gcc --- .github/workflows/runtests.yml | 48 +++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml index 19c1e79e..5e1d2e21 100644 --- a/.github/workflows/runtests.yml +++ b/.github/workflows/runtests.yml @@ -10,29 +10,51 @@ jobs: name: "ubuntu-latest | g++" timeout-minutes: 60 runs-on: ubuntu-latest - env: - CXX: "ccache g++" - CXXFLAGS: "-fdiagnostics-color" - CMAKE_CXX_COMPILER: "ccache g++" + strategy: + matrix: + sys: + - { compiler: 'gcc', version: '6'} + - { compiler: 'gcc', version: '7'} + - { compiler: 'gcc', version: '8'} + - { compiler: 'gcc', version: '9'} + - { compiler: 'gcc', version: '10'} + - { compiler: 'gcc', version: '11'} + # - { compiler: 'clang', version: '8'} + # - { compiler: 'clang', version: '10'} + # - { compiler: 'clang', version: '12'} + # - { compiler: 'clang', version: '13'} + # - { compiler: 'clang', version: '14'} steps: - name: "Checkout HPCombi repo . . ." uses: actions/checkout@v3 - - name: "Setup ccache . . ." - uses: Chocobo1/setup-ccache-action@v1 - with: - update_packager_index: false - override_cache_key: ${{ runner.os }}-${{ github.ref }} - override_cache_key_fallback: ${{ runner.os }} + if: ${{ matrix.sys.compiler == 'gcc' }} + run: | + GCC_VERSION=${{ matrix.sys.version }} + if [[ $GCC_VERSION == '6' || $GCC_VERSION == '7' || $GCC_VERSION == '8' ]]; then + sudo apt-get update + sudo apt-get --no-install-suggests --no-install-recommends install g++-$GCC_VERSION + fi + CC=gcc-$GCC_VERSION + echo "CC=$CC" >> $GITHUB_ENV + CXX=g++-$GCC_VERSION + echo "CXX=$CXX" >> $GITHUB_ENV - name: "Install dependencies . . ." run: | sudo apt-get --yes update sudo apt-get install --yes ccache sudo apt-get install --yes libbenchmark-dev - - name: "Build + run HPCombi tests . . ." + - name: "Build HPCombi tests . . ." + env: + CC: ${{ env.CC }} + CXX: ${{ env.CXX }} run: | mkdir build cd build - cmake -DBUILD_TESTING=1 -DCMAKE_BUILD_TYPE=Release .. + cmake .. -DBUILD_TESTS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=$CC \ + -DCMAKE_CXX_COMPILER=$CXX cd tests - make + make -j4 + - name: "Run HPCombi tests . . ." ./test_all