| 1 |
name: CMake |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
- try-github-actions-for-windows |
| 8 |
paths: |
| 9 |
- .github/workflows/cmake.yml |
| 10 |
- '**CMakeLists.txt' |
| 11 |
- 'BLAS/**' |
| 12 |
- 'CBLAS/**' |
| 13 |
- 'CMAKE/**' |
| 14 |
- 'INSTALL/**' |
| 15 |
- 'LAPACKE/**' |
| 16 |
- 'SRC/**' |
| 17 |
- 'TESTING/**' |
| 18 |
- '!**README' |
| 19 |
- '!**Makefile' |
| 20 |
- '!**md' |
| 21 |
pull_request: |
| 22 |
paths: |
| 23 |
- .github/workflows/cmake.yml |
| 24 |
- '**CMakeLists.txt' |
| 25 |
- 'BLAS/**' |
| 26 |
- 'CBLAS/**' |
| 27 |
- 'CMAKE/**' |
| 28 |
- 'INSTALL/**' |
| 29 |
- 'LAPACKE/**' |
| 30 |
- 'SRC/**' |
| 31 |
- 'TESTING/**' |
| 32 |
- '!**README' |
| 33 |
- '!**Makefile' |
| 34 |
- '!**md' |
| 35 |
|
| 36 |
permissions: |
| 37 |
contents: read |
| 38 |
|
| 39 |
env: |
| 40 |
CFLAGS: "-Wall -pedantic" |
| 41 |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
| 42 |
|
| 43 |
defaults: |
| 44 |
run: |
| 45 |
shell: bash |
| 46 |
|
| 47 |
jobs: |
| 48 |
|
| 49 |
test-install-release: |
| 50 |
# Use GNU compilers |
| 51 |
|
| 52 |
# The CMake configure and build commands are platform agnostic and should work equally |
| 53 |
# well on Windows or Mac. You can convert this to a matrix build if you need |
| 54 |
# cross-platform coverage. |
| 55 |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
| 56 |
runs-on: ${{ matrix.os }} |
| 57 |
|
| 58 |
env: |
| 59 |
BUILD_TYPE: Release |
| 60 |
FFLAGS: ${{ matrix.fflags }} |
| 61 |
|
| 62 |
strategy: |
| 63 |
fail-fast: true |
| 64 |
matrix: |
| 65 |
os: [ macos-latest, ubuntu-latest, windows-latest ] |
| 66 |
fflags: [ |
| 67 |
"-Wall -Wno-unused-dummy-argument -Wno-unused-variable -Wno-unused-label -Werror=conversion -fimplicit-none -frecursive -fcheck=all", |
| 68 |
"-Wall -Wno-unused-dummy-argument -Wno-unused-variable -Wno-unused-label -Werror=conversion -fimplicit-none -frecursive -fcheck=all -fopenmp" ] |
| 69 |
|
| 70 |
steps: |
| 71 |
|
| 72 |
- name: Checkout LAPACK |
| 73 |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 |
| 74 |
|
| 75 |
- name: Install ninja-build tool |
| 76 |
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3 |
| 77 |
|
| 78 |
- name: Use GCC-14 on MacOS |
| 79 |
if: ${{ matrix.os == 'macos-latest' }} |
| 80 |
run: > |
| 81 |
cmake -B build -G Ninja |
| 82 |
-D CMAKE_C_COMPILER="gcc-14" |
| 83 |
-D CMAKE_Fortran_COMPILER="gfortran-14" |
| 84 |
-D USE_FLAT_NAMESPACE:BOOL=ON |
| 85 |
|
| 86 |
- name: Special flags for Windows |
| 87 |
if: ${{ matrix.os == 'windows-latest' }} |
| 88 |
run: > |
| 89 |
cmake -B build -G Ninja |
| 90 |
-D CMAKE_EXE_LINKER_FLAGS="-Wl,--stack=2097152" |
| 91 |
|
| 92 |
- name: Configure CMake |
| 93 |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
| 94 |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
| 95 |
run: > |
| 96 |
cmake -B build -G Ninja |
| 97 |
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 98 |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/lapack_install |
| 99 |
-D CBLAS:BOOL=ON |
| 100 |
-D LAPACKE:BOOL=ON |
| 101 |
-D BUILD_TESTING:BOOL=ON |
| 102 |
-D LAPACKE_WITH_TMG:BOOL=ON |
| 103 |
-D BUILD_SHARED_LIBS:BOOL=ON |
| 104 |
|
| 105 |
- name: Build |
| 106 |
# Execute tests defined by the CMake configuration. |
| 107 |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
| 108 |
run: cmake --build build --config ${{env.BUILD_TYPE}} |
| 109 |
|
| 110 |
- name: Test with OpenMP |
| 111 |
working-directory: ${{github.workspace}}/build |
| 112 |
if: ${{ contains( matrix.fflags, 'openmp' ) && (matrix.os != 'windows-latest') }} |
| 113 |
run: ctest -C ${{env.BUILD_TYPE}} --schedule-random -j1 --output-on-failure --timeout 100 |
| 114 |
|
| 115 |
- name: Test |
| 116 |
working-directory: ${{github.workspace}}/build |
| 117 |
if: ${{ !contains( matrix.fflags, 'openmp' ) && (matrix.os != 'windows-latest') }} |
| 118 |
run: ctest -C ${{env.BUILD_TYPE}} --schedule-random -j2 --output-on-failure --timeout 100 |
| 119 |
|
| 120 |
- name: Install |
| 121 |
run: cmake --build build --target install -j2 |
| 122 |
|
| 123 |
coverage: |
| 124 |
runs-on: ubuntu-latest |
| 125 |
env: |
| 126 |
BUILD_TYPE: Coverage |
| 127 |
FFLAGS: "-fopenmp" |
| 128 |
steps: |
| 129 |
|
| 130 |
- name: Checkout LAPACK |
| 131 |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 |
| 132 |
|
| 133 |
- name: Install ninja-build tool |
| 134 |
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3 |
| 135 |
|
| 136 |
- name: Configure CMake |
| 137 |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
| 138 |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
| 139 |
run: > |
| 140 |
cmake -B build -G Ninja |
| 141 |
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 142 |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/lapack_install |
| 143 |
-D CBLAS:BOOL=ON |
| 144 |
-D LAPACKE:BOOL=ON |
| 145 |
-D BUILD_TESTING:BOOL=ON |
| 146 |
-D LAPACKE_WITH_TMG:BOOL=ON |
| 147 |
-D BUILD_SHARED_LIBS:BOOL=ON |
| 148 |
|
| 149 |
- name: Install |
| 150 |
run: cmake --build build --target install -j2 |
| 151 |
|
| 152 |
- name: Coverage |
| 153 |
run: | |
| 154 |
echo "Coverage" |
| 155 |
cmake --build build --target coverage |
| 156 |
bash <(curl -s https://codecov.io/bash) -X gcov |
| 157 |
|
| 158 |
test-install-cblas-lapacke-without-fortran-compiler: |
| 159 |
runs-on: ubuntu-latest |
| 160 |
steps: |
| 161 |
- name: Checkout LAPACK |
| 162 |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 |
| 163 |
|
| 164 |
- name: Install ninja-build tool |
| 165 |
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3 |
| 166 |
|
| 167 |
- name: Install basics |
| 168 |
run: | |
| 169 |
sudo apt update |
| 170 |
sudo apt install -y cmake liblapack-dev libblas-dev |
| 171 |
sudo apt purge gfortran |
| 172 |
|
| 173 |
- name: Configure CMake |
| 174 |
run: > |
| 175 |
cmake -B build -G Ninja |
| 176 |
-D CMAKE_BUILD_TYPE=Release |
| 177 |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/lapack_install |
| 178 |
-D CBLAS:BOOL=ON |
| 179 |
-D LAPACKE:BOOL=ON |
| 180 |
-D USE_OPTIMIZED_BLAS:BOOL=ON |
| 181 |
-D USE_OPTIMIZED_LAPACK:BOOL=ON |
| 182 |
-D BUILD_TESTING:BOOL=OFF |
| 183 |
-D LAPACKE_WITH_TMG:BOOL=OFF |
| 184 |
-D BUILD_SHARED_LIBS:BOOL=ON |
| 185 |
|
| 186 |
- name: Install |
| 187 |
run: cmake --build build --target install -j2 |
| 188 |
|
| 189 |
memory-check: |
| 190 |
runs-on: ubuntu-latest |
| 191 |
env: |
| 192 |
BUILD_TYPE: Debug |
| 193 |
|
| 194 |
steps: |
| 195 |
|
| 196 |
- name: Checkout LAPACK |
| 197 |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 |
| 198 |
|
| 199 |
- name: Install ninja-build tool |
| 200 |
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3 |
| 201 |
|
| 202 |
- name: Install APT packages |
| 203 |
run: | |
| 204 |
sudo apt update |
| 205 |
sudo apt install -y cmake valgrind gfortran |
| 206 |
|
| 207 |
- name: Configure CMake |
| 208 |
run: > |
| 209 |
cmake -B build -G Ninja |
| 210 |
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 211 |
-D CBLAS:BOOL=ON |
| 212 |
-D LAPACKE:BOOL=ON |
| 213 |
-D BUILD_TESTING:BOOL=ON |
| 214 |
-D LAPACKE_WITH_TMG:BOOL=ON |
| 215 |
-D BUILD_SHARED_LIBS:BOOL=ON |
| 216 |
-D LAPACK_TESTING_USE_PYTHON:BOOL=OFF |
| 217 |
|
| 218 |
- name: Build |
| 219 |
run: cmake --build build --config ${{env.BUILD_TYPE}} |
| 220 |
|
| 221 |
- name: Test |
| 222 |
working-directory: ${{github.workspace}}/build |
| 223 |
run: | |
| 224 |
ctest -C ${{env.BUILD_TYPE}} --schedule-random -j2 -T memcheck > memcheck.out |
| 225 |
cat memcheck.out |
| 226 |
if tail -n 1 memcheck.out | grep -q "Memory checking results:"; then |
| 227 |
exit 0 |
| 228 |
else |
| 229 |
for f in Testing/Temporary/MemoryChecker.*.log; do |
| 230 |
if tail -n 1 $f | grep -q "ERROR SUMMARY: 0 errors"; then |
| 231 |
tail -n 1 $f |
| 232 |
continue |
| 233 |
else |
| 234 |
echo "Memory check failed in $f" |
| 235 |
cat $f |
| 236 |
exit 1 |
| 237 |
fi |
| 238 |
done |
| 239 |
exit 0 |
| 240 |
fi |