Skip to content

Commit 175f1d8

Browse files
committed
ci: use fortran-setup for GCC version testing
1 parent c0c0647 commit 175f1d8

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

.github/workflows/CI.yml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: [ubuntu-latest, macos-12]
23-
gcc_v: [10, 11, 12, 13] # Version of GFortran we want to use.
23+
toolchain:
24+
- {compiler: gcc, version: 10}
25+
- {compiler: gcc, version: 11}
26+
- {compiler: gcc, version: 12}
27+
- {compiler: gcc, version: 13}
2428
build: [cmake]
2529
include:
2630
- os: ubuntu-latest
27-
gcc_v: 10
2831
build: cmake-inline
32+
toolchain:
33+
- {compiler: gcc, version: 10}
2934
env:
30-
FC: gfortran-${{ matrix.gcc_v }}
31-
CC: gcc-${{ matrix.gcc_v }}
32-
CXX: g++-${{ matrix.gcc_v }}
33-
GCC_V: ${{ matrix.gcc_v }}
3435
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
3536

3637
steps:
@@ -45,22 +46,12 @@ jobs:
4546
- name: Install fypp
4647
run: pip install --upgrade fypp
4748

48-
- name: Install GCC compilers Linux
49-
if: contains( matrix.os, 'ubuntu')
50-
run: |
51-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
52-
sudo apt-get update
53-
sudo apt-get install -y gcc-${GCC_V} g++-${GCC_V} gfortran-${GCC_V}
54-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
55-
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
56-
--slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_V} \
57-
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
58-
59-
- name: Install GCC compilers macOS
60-
if: contains( matrix.os, 'macos')
61-
run: |
62-
brew install gcc@${GCC_V} || brew upgrade gcc@${GCC_V} || true
63-
brew link gcc@${GCC_V}
49+
- name: Setup Fortran compiler
50+
uses: fortran-lang/[email protected]
51+
id: setup-fortran
52+
with:
53+
compiler: ${{ matrix.toolchain.compiler }}
54+
version: ${{ matrix.toolchain.version }}
6455

6556
- name: Configure with CMake
6657
if: ${{ contains(matrix.build, 'cmake') }}

0 commit comments

Comments
 (0)