From 3b6173946504e2b48bab214c7dca0e8aa2e45a8f Mon Sep 17 00:00:00 2001 From: Rupert Nash Date: Fri, 15 Dec 2023 13:36:57 +0000 Subject: [PATCH] CI: compile main app with clang and GCC for several versions --- .github/actions/setup-compilers/action.yml | 28 ++++++++++++++++++++++ .github/workflows/main-app.yml | 11 +++++---- 2 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 .github/actions/setup-compilers/action.yml diff --git a/.github/actions/setup-compilers/action.yml b/.github/actions/setup-compilers/action.yml new file mode 100644 index 000000000..e25ba1a75 --- /dev/null +++ b/.github/actions/setup-compilers/action.yml @@ -0,0 +1,28 @@ +name: 'Set CC and CXX env vars for the configured compiler' + +inputs: + compiler: + description: 'Use $suite-$version' + required: true + +runs: + using: 'composite' + steps: + shell: bash + run: | + input=${{ inputs.compiler }} + split=(${input//-/ }) + suite=${split[0]} + version=${split[1]} + case $suite in + gnu) + CC=gcc-$version + CXX=g++-$version + ;; + llvm) + CC=clang-$version + CXX=clang++-$version + ;; + esac + echo "CC=$CC" >> $GITHUB_ENV + echo "CXX=$CXX" >> $GITHUB_ENV diff --git a/.github/workflows/main-app.yml b/.github/workflows/main-app.yml index 21e8a9b68..4d2b3c988 100644 --- a/.github/workflows/main-app.yml +++ b/.github/workflows/main-app.yml @@ -24,9 +24,6 @@ env: hemelb_install_prefix: ${{github.workspace}}/install # VMs have 2 cores, double as compilation often IO bound CMAKE_BUILD_PARALLEL_LEVEL: 4 - # Latest Gnu compiler on Ubuntu 22.04 - CC: gcc-12 - CXX: g++-12 jobs: basic-checks: @@ -45,10 +42,16 @@ jobs: fluid_only_build: name: Build in fluid-only mode runs-on: ubuntu-22.04 - + strategy: + matrix: + compiler: [gnu-11, gnu-12, gnu-13, llvm-13, llvm-14, llvm-15] steps: - uses: actions/checkout@v3 + - uses: ./.github/actions/install-hemelb-deps + with: + compiler: matrix.compiler + - uses: ./.github/actions/install-hemelb-deps with: name: fluidonly