Skip to content

Commit 627d72c

Browse files
authored
Merge pull request #834 from fortran-lang/ci/setup-fortran
ci: use fortran-setup for GCC, Intel LLVM and Intel Classic
2 parents c0c0647 + 41d734a commit 627d72c

File tree

1 file changed

+22
-178
lines changed

1 file changed

+22
-178
lines changed

.github/workflows/CI.yml

+22-178
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,25 @@ 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}
28+
- {compiler: intel, version: '2024.1'}
29+
- {compiler: intel-classic, version: '2021.9'}
2430
build: [cmake]
2531
include:
2632
- os: ubuntu-latest
27-
gcc_v: 10
2833
build: cmake-inline
34+
toolchain:
35+
- {compiler: gcc, version: 10}
36+
exclude:
37+
- os: macos-12
38+
toolchain: {compiler: intel, version: '2024.1'}
39+
- os: macos-12
40+
toolchain: {compiler: gcc, version: 13}
2941
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 }}
3442
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
3543

3644
steps:
@@ -43,29 +51,19 @@ jobs:
4351
python-version: 3.x
4452

4553
- name: Install fypp
46-
run: pip install --upgrade fypp
54+
run: pip install --upgrade fypp ninja
4755

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}
56+
- name: Setup Fortran compiler
57+
uses: fortran-lang/setup-fortran@v1.6.1
58+
id: setup-fortran
59+
with:
60+
compiler: ${{ matrix.toolchain.compiler }}
61+
version: ${{ matrix.toolchain.version }}
6462

6563
- name: Configure with CMake
6664
if: ${{ contains(matrix.build, 'cmake') }}
6765
run: >-
68-
cmake -Wdev
66+
cmake -Wdev -G Ninja
6967
-DCMAKE_BUILD_TYPE=Release
7068
-DCMAKE_MAXIMUM_RANK:String=4
7169
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
@@ -91,157 +89,3 @@ jobs:
9189
- name: Install project
9290
if: ${{ contains(matrix.build, 'cmake') }}
9391
run: cmake --install ${{ env.BUILD_DIR }}
94-
95-
intel-build-llvm:
96-
runs-on: ${{ matrix.os }}
97-
strategy:
98-
fail-fast: false
99-
matrix:
100-
os: [ubuntu-latest]
101-
fc: [ifx]
102-
cc: [icx]
103-
cxx: [icpx]
104-
env:
105-
FC: ${{ matrix.fc }}
106-
CC: ${{ matrix.cc }}
107-
CXX: ${{ matrix.cxx }}
108-
109-
steps:
110-
- name: Checkout code
111-
uses: actions/checkout@v4
112-
113-
- name: Set up Python 3.x
114-
uses: actions/setup-python@v5
115-
with:
116-
python-version: 3.x
117-
118-
- name: Add Intel repository (Linux)
119-
if: contains(matrix.os, 'ubuntu')
120-
run: |
121-
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
122-
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
123-
sudo apt-get update
124-
125-
- name: Install Intel oneAPI compiler (Linux)
126-
if: contains(matrix.os, 'ubuntu')
127-
run: |
128-
sudo apt-get install intel-oneapi-compiler-fortran
129-
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp
130-
131-
- name: Setup Intel oneAPI environment
132-
run: |
133-
source /opt/intel/oneapi/setvars.sh
134-
printenv >> $GITHUB_ENV
135-
136-
- name: Install fypp
137-
run: pip install --upgrade fypp
138-
139-
- name: Configure with CMake
140-
run: >-
141-
cmake -Wdev
142-
-DCMAKE_BUILD_TYPE=Release
143-
-DCMAKE_MAXIMUM_RANK:String=4
144-
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
145-
-S . -B build
146-
147-
- name: Build and compile
148-
run: cmake --build build
149-
150-
- name: catch build fail
151-
run: cmake --build build --verbose --parallel 1
152-
if: failure()
153-
154-
- name: test
155-
run: ctest --parallel --output-on-failure --no-tests=error
156-
working-directory: build
157-
158-
- name: Install project
159-
run: cmake --install build
160-
161-
intel-build-classic:
162-
runs-on: ${{ matrix.os }}
163-
strategy:
164-
fail-fast: false
165-
matrix:
166-
os: [macos-12]
167-
fc: [ifort]
168-
cc: [icc]
169-
cxx: [icpc]
170-
env:
171-
MACOS_HPCKIT_URL: >-
172-
https://registrationcenter-download.intel.com/akdlm/IRC_NAS/a99cb1c5-5af6-4824-9811-ae172d24e594/m_HPCKit_p_2023.1.0.44543.dmg
173-
MACOS_FORTRAN_COMPONENTS: all
174-
FC: ${{ matrix.fc }}
175-
CC: ${{ matrix.cc }}
176-
CXX: ${{ matrix.cxx }}
177-
178-
steps:
179-
- name: Checkout code
180-
uses: actions/checkout@v4
181-
182-
- name: Set up Python 3.x
183-
uses: actions/setup-python@v5
184-
with:
185-
python-version: 3.x
186-
187-
- name: Prepare for cache restore (OSX)
188-
if: contains(matrix.os, 'macos')
189-
run: |
190-
sudo mkdir -p /opt/intel
191-
sudo chown $USER /opt/intel
192-
193-
- name: Cache Intel install (OSX)
194-
if: contains(matrix.os, 'macos')
195-
id: cache-install
196-
uses: actions/cache@v2
197-
with:
198-
path: /opt/intel/oneapi
199-
key: install-${{ env.MACOS_HPCKIT_URL }}-${{ env.MACOS_FORTRAN_COMPONENTS }}
200-
201-
- name: Install Intel oneAPI compiler (OSX)
202-
if: contains(matrix.os, 'macos') && steps.cache-install.outputs.cache-hit != 'true'
203-
run: |
204-
curl --output webimage.dmg --url "$URL" --retry 5 --retry-delay 5
205-
hdiutil attach webimage.dmg
206-
if [ -z "$COMPONENTS" ]; then
207-
sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=.
208-
installer_exit_code=$?
209-
else
210-
sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --continue-with-optional-error=yes --log-dir=.
211-
installer_exit_code=$?
212-
fi
213-
hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet
214-
exit $installer_exit_code
215-
env:
216-
URL: ${{ env.MACOS_HPCKIT_URL }}
217-
COMPONENTS: ${{ env.MACOS_FORTRAN_COMPONENTS }}
218-
219-
- name: Setup Intel oneAPI environment
220-
run: |
221-
source /opt/intel/oneapi/setvars.sh
222-
printenv >> $GITHUB_ENV
223-
224-
- name: Install fypp
225-
run: pip install --upgrade fypp
226-
227-
- name: Configure with CMake
228-
run: >-
229-
cmake -Wdev
230-
-DCMAKE_BUILD_TYPE=Release
231-
-DCMAKE_MAXIMUM_RANK:String=4
232-
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
233-
-S . -B build
234-
235-
- name: Build and compile
236-
run: cmake --build build
237-
238-
- name: catch build fail
239-
run: cmake --build build --verbose --parallel 1
240-
if: failure()
241-
242-
- name: test
243-
run: ctest --parallel --output-on-failure --no-tests=error
244-
working-directory: build
245-
246-
- name: Install project
247-
run: cmake --install build

0 commit comments

Comments
 (0)