33on : [push, pull_request]
44
55env :
6- CI : " ON" # We can detect this in the build system and other vendors implement it
76 CMAKE_BUILD_PARALLEL_LEVEL : " 2" # 2 cores on each GHA VM, enable parallel builds
87 CTEST_OUTPUT_ON_FAILURE : " ON" # This way we don't need a flag to ctest
98 CTEST_PARALLEL_LEVEL : " 2"
@@ -21,14 +20,14 @@ jobs:
2120 fail-fast : false
2221 matrix :
2322 os : [ubuntu-latest, macos-latest]
24- gcc_v : [7, 8, 9, 10] # Version of GFortran we want to use.
23+ gcc_v : [9, 10, 11 ] # Version of GFortran we want to use.
2524 env :
2625 FC : gfortran-${{ matrix.gcc_v }}
2726 GCC_V : ${{ matrix.gcc_v }}
2827
2928 steps :
3029 - name : Checkout code
31- uses : actions/checkout@v1
30+ uses : actions/checkout@v2
3231
3332 - name : Set up Python 3.x
3433 uses : actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc.
5049 sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V}
5150 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
5251 --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
53- --slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
52+ --slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
5453
5554 - name : Install GFortran macOS
5655 if : contains( matrix.os, 'macos')
@@ -62,20 +61,19 @@ jobs:
6261 run : >-
6362 cmake -Wdev
6463 -DCMAKE_BUILD_TYPE=Release
65- -DCMAKE_MAXIMUM_RANK=4
64+ -DCMAKE_MAXIMUM_RANK:String =4
6665 -DCMAKE_INSTALL_PREFIX=$PWD/_dist
6766 -S . -B build
6867
6968 - name : Build and compile
70- run : cmake --build build
69+ run : cmake --build build --parallel
7170
7271 - name : catch build fail
7372 run : cmake --build build --verbose --parallel 1
7473 if : failure()
7574
7675 - name : test
77- run : ctest --parallel --output-on-failure
78- working-directory : build
76+ run : ctest --test-dir build --parallel --output-on-failure
7977
8078 - name : Install project
8179 run : cmake --install build
@@ -99,14 +97,18 @@ jobs:
9997 strategy :
10098 fail-fast : false
10199 matrix :
102- os : [ubuntu-20.04 ]
100+ os : [ubuntu-latest, macos-latest ]
103101 fc : [ifort]
104102 env :
103+ MACOS_HPCKIT_URL : >-
104+ https://registrationcenter-download.intel.com/akdlm/irc_nas/17398/m_HPCKit_p_2021.1.0.2681_offline.dmg
105+ MACOS_FORTRAN_COMPONENTS : >-
106+ intel.oneapi.mac.ifort-compiler
105107 FC : ${{ matrix.fc }}
106108
107109 steps :
108110 - name : Checkout code
109- uses : actions/checkout@v1
111+ uses : actions/checkout@v2
110112
111113 - name : Set up Python 3.x
112114 uses : actions/setup-python@v1
@@ -117,7 +119,21 @@ jobs:
117119 if : contains(matrix.os, 'ubuntu')
118120 run : ci/install_cmake.sh
119121
120- - name : Add Intel repository
122+ - name : Prepare for cache restore (OSX)
123+ if : contains(matrix.os, 'macos')
124+ run : |
125+ sudo mkdir -p /opt/intel
126+ sudo chown $USER /opt/intel
127+
128+ - name : Cache Intel install (OSX)
129+ if : contains(matrix.os, 'macos')
130+ id : cache-install
131+ uses : actions/cache@v2
132+ with :
133+ path : /opt/intel/oneapi
134+ key : install-${{ env.MACOS_HPCKIT_URL }}-${{ env.MACOS_FORTRAN_COMPONENTS }}
135+
136+ - name : Add Intel repository (Linux)
121137 if : contains(matrix.os, 'ubuntu')
122138 run : |
123139 wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
@@ -126,10 +142,31 @@ jobs:
126142 echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
127143 sudo apt-get update
128144
129- - name : Install Intel oneAPI compiler
145+ - name : Install Intel oneAPI compiler (Linux)
130146 if : contains(matrix.os, 'ubuntu')
131147 run : |
132148 sudo apt-get install intel-oneapi-compiler-fortran
149+
150+ - name : Install Intel oneAPI compiler (OSX)
151+ if : contains(matrix.os, 'macos') && steps.cache-install.outputs.cache-hit != 'true'
152+ run : |
153+ curl --output webimage.dmg --url "$URL" --retry 5 --retry-delay 5
154+ hdiutil attach webimage.dmg
155+ if [ -z "$COMPONENTS" ]; then
156+ sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=.
157+ installer_exit_code=$?
158+ else
159+ sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --continue-with-optional-error=yes --log-dir=.
160+ installer_exit_code=$?
161+ fi
162+ hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet
163+ exit $installer_exit_code
164+ env :
165+ URL : ${{ env.MACOS_HPCKIT_URL }}
166+ COMPONENTS : ${{ env.MACOS_FORTRAN_COMPONENTS }}
167+
168+ - name : Setup Intel oneAPI environment
169+ run : |
133170 source /opt/intel/oneapi/setvars.sh
134171 printenv >> $GITHUB_ENV
135172
@@ -140,7 +177,7 @@ jobs:
140177 run : >-
141178 cmake -Wdev
142179 -DCMAKE_BUILD_TYPE=Release
143- -DCMAKE_MAXIMUM_RANK=4
180+ -DCMAKE_MAXIMUM_RANK:String =4
144181 -DCMAKE_INSTALL_PREFIX=$PWD/_dist
145182 -S . -B build
146183
0 commit comments