Skip to content

Commit 8f68ef0

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

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

.github/workflows/CI.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ 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, 11, 12, 13]}
2425
build: [cmake]
2526
include:
2627
- os: ubuntu-latest
27-
gcc_v: 10
2828
build: cmake-inline
29+
toolchain:
30+
- {compiler: gcc, version: 10}
2931
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 }}
3432
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
3533

3634
steps:
@@ -45,22 +43,12 @@ jobs:
4543
- name: Install fypp
4644
run: pip install --upgrade fypp
4745

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}
46+
- name: Setup Fortran compiler
47+
uses: fortran-lang/[email protected]
48+
id: setup-fortran
49+
with:
50+
compiler: ${{ matrix.toolchain.compiler }}
51+
version: ${{ matrix.toolchain.version }}
6452

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

0 commit comments

Comments
 (0)