|
| 1 | +name: Test of package installation & execution |
| 2 | +'on': |
| 3 | + push: |
| 4 | + branches-ignore: |
| 5 | + - gh-pages |
| 6 | + tags: |
| 7 | + - '*' |
| 8 | + schedule: |
| 9 | + - cron: 0 10 * * 1 |
| 10 | +jobs: |
| 11 | + build_cxx: |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + defaults: |
| 14 | + run: |
| 15 | + shell: bash -el {0} |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + sundials-version: [latest] |
| 19 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 20 | + with-coverage: [false, true] |
| 21 | + with-asan: [false, true] |
| 22 | + with-elf: [false] |
| 23 | + with-valgrind: [false, true] |
| 24 | + with-mpi: [false] |
| 25 | + with-python: [false] |
| 26 | + include: |
| 27 | + - sundials-version: "5.7.0" |
| 28 | + os: ubuntu-latest |
| 29 | + with-coverage: false |
| 30 | + with-asan: false |
| 31 | + with-elf: false |
| 32 | + with-valgrind: false |
| 33 | + with-mpi: false |
| 34 | + with-python: false |
| 35 | + - sundials-version: "6.7.0" |
| 36 | + os: ubuntu-latest |
| 37 | + with-coverage: false |
| 38 | + with-asan: false |
| 39 | + with-elf: false |
| 40 | + with-valgrind: false |
| 41 | + with-mpi: false |
| 42 | + with-python: false |
| 43 | + - sundials-version: "7.1.1" |
| 44 | + os: ubuntu-latest |
| 45 | + with-coverage: false |
| 46 | + with-asan: false |
| 47 | + with-elf: false |
| 48 | + with-valgrind: false |
| 49 | + with-mpi: false |
| 50 | + with-python: false |
| 51 | + - sundials-version: latest |
| 52 | + os: ubuntu-latest |
| 53 | + with-coverage: false |
| 54 | + with-asan: false |
| 55 | + with-elf: false |
| 56 | + with-valgrind: false |
| 57 | + with-mpi: true |
| 58 | + with-python: false |
| 59 | + - sundials-version: "6.7.0" |
| 60 | + os: ubuntu-latest |
| 61 | + with-coverage: false |
| 62 | + with-asan: false |
| 63 | + with-elf: false |
| 64 | + with-valgrind: false |
| 65 | + with-mpi: true |
| 66 | + with-python: false |
| 67 | + - sundials-version: "7.1.1" |
| 68 | + os: ubuntu-latest |
| 69 | + with-coverage: false |
| 70 | + with-asan: false |
| 71 | + with-elf: false |
| 72 | + with-valgrind: false |
| 73 | + with-mpi: true |
| 74 | + with-python: false |
| 75 | + - sundials-version: latest |
| 76 | + os: ubuntu-latest |
| 77 | + with-coverage: false |
| 78 | + with-asan: false |
| 79 | + with-elf: false |
| 80 | + with-valgrind: false |
| 81 | + with-mpi: false |
| 82 | + with-python: true |
| 83 | + exclude: |
| 84 | + - os: windows-latest |
| 85 | + with-asan: true |
| 86 | + - os: ubuntu-latest |
| 87 | + with-asan: true |
| 88 | + - os: windows-latest |
| 89 | + with-valgrind: true |
| 90 | + - os: windows-latest |
| 91 | + with-elf: true |
| 92 | + - os: macos-latest |
| 93 | + with-valgrind: true |
| 94 | + - os: macos-latest |
| 95 | + with-elf: true |
| 96 | + - with-valgrind: true |
| 97 | + with-elf: true |
| 98 | + - with-valgrind: true |
| 99 | + with-asan: true |
| 100 | + - with-coverage: true |
| 101 | + with-valgrind: true |
| 102 | + - with-coverage: true |
| 103 | + with-asan: true |
| 104 | + fail-fast: false |
| 105 | + steps: |
| 106 | + - name: Check out repository code |
| 107 | + uses: actions/checkout@v4 |
| 108 | + with: |
| 109 | + submodules: true |
| 110 | + |
| 111 | + ################################### |
| 112 | + # CONDA SETUP |
| 113 | + ################################### |
| 114 | + - name: Set up MSVC Compiler on windows |
| 115 | + uses: ilammy/msvc-dev-cmd@v1 |
| 116 | + if: matrix.os == 'windows-latest' |
| 117 | + - name: Set up miniconda test environment (W/O MPI) |
| 118 | + if: matrix.with-mpi == false |
| 119 | + uses: conda-incubator/setup-miniconda@v3 |
| 120 | + with: |
| 121 | + activate-environment: ephoto |
| 122 | + environment-file: environment.yml |
| 123 | + auto-update-conda: true |
| 124 | + channels: conda-forge |
| 125 | + channel-priority: strict |
| 126 | + miniforge-version: latest |
| 127 | + use-mamba: true |
| 128 | + mamba-version: "1.5.10" |
| 129 | + conda-remove-defaults: true |
| 130 | + - name: Set up miniconda test environment (W/ MPI) |
| 131 | + if: matrix.with-mpi == true |
| 132 | + uses: conda-incubator/setup-miniconda@v3 |
| 133 | + with: |
| 134 | + activate-environment: ephoto |
| 135 | + environment-file: environment_mpi.yml |
| 136 | + auto-update-conda: true |
| 137 | + channels: conda-forge |
| 138 | + channel-priority: strict |
| 139 | + miniforge-version: latest |
| 140 | + use-mamba: true |
| 141 | + mamba-version: "1.5.10" |
| 142 | + conda-remove-defaults: true |
| 143 | + - name: Set USERPROFILE |
| 144 | + if: matrix.os == 'windows-latest' |
| 145 | + run: | |
| 146 | + echo "USERPROFILE=${{ github.workspace }}" >> "$GITHUB_ENV" |
| 147 | + - name: Install specific version of Sundials via conda |
| 148 | + if: matrix.sundials-version != 'latest' && matrix.with-mpi == false |
| 149 | + run: | |
| 150 | + mamba install sundials==${{ matrix.sundials-version }} -y |
| 151 | + - name: Check mamba installation |
| 152 | + run: | |
| 153 | + mamba info |
| 154 | + mamba list |
| 155 | + - name: Install doxgen on unix systems |
| 156 | + if: matrix.os != 'windows-latest' |
| 157 | + run: | |
| 158 | + mamba install doxygen>=1.9.2 graphviz -y |
| 159 | + - name: Install compilers using conda on Linux/Mac |
| 160 | + if: matrix.os != 'windows-latest' && matrix.with-valgrind != true |
| 161 | + run: | |
| 162 | + mamba install c-compiler cxx-compiler |
| 163 | + - name: Install valgrind on unix systems (and required debug symbols) |
| 164 | + if: matrix.os != 'windows-latest' && matrix.with-valgrind == true |
| 165 | + run: | |
| 166 | + sudo apt-get update |
| 167 | + sudo apt-get install libc6-dbg |
| 168 | + mamba install valgrind |
| 169 | + |
| 170 | + ################################### |
| 171 | + # INSTALL SUNDIALS W/ MPI |
| 172 | + ################################### |
| 173 | + - name: CMake flags for building Sundials W/ MPI |
| 174 | + shell: bash -l {0} |
| 175 | + if: matrix.with-mpi == true |
| 176 | + run: | |
| 177 | + CMAKE_BUILD_TYPE_TEST="RelWithDebInfo" |
| 178 | + echo "CMAKE_BUILD_TYPE_TEST=RelWithDebInfo" >> "$GITHUB_ENV" |
| 179 | + echo "CMAKE_ARGS=-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DENABLE_MPI:BOOL=ON -DEXAMPLES_ENABLE_C:BOOL=OFF -DEXAMPLES_ENABLE_CXX:BOOL=OFF" >> "$GITHUB_ENV" |
| 180 | + - name: Clone Sundials for build W/ MPI |
| 181 | + if: matrix.with-mpi == true |
| 182 | + run: | |
| 183 | + git clone https://github.com/LLNL/sundials.git |
| 184 | + - name: Check out specific version of Sundials for build W/ MPI |
| 185 | + if: matrix.sundials-version != 'latest' && matrix.with-mpi == true |
| 186 | + run: | |
| 187 | + cd sundials |
| 188 | + git checkout tags/v${{ matrix.sundials-version }} -b tagged |
| 189 | + - name: Configure Sundials W/ MPI |
| 190 | + if: matrix.with-mpi == true |
| 191 | + run: | |
| 192 | + cd sundials |
| 193 | + mkdir build |
| 194 | + cd build |
| 195 | + cmake .. ${{ env.CMAKE_ARGS }} |
| 196 | + - name: Build Sundials W/ MPI in parallel (CONDA, UNIX) |
| 197 | + if: matrix.with-mpi == true && matrix.os != 'windows-latest' |
| 198 | + run: | |
| 199 | + cd sundials/build |
| 200 | + cmake --build . --config ${{ env.CMAKE_BUILD_TYPE_TEST }} -- -j 4 |
| 201 | + - name: Build Sundials W/ MPI in serial (CONDA, WINDOWS) |
| 202 | + if: matrix.with-mpi == true && matrix.os == 'windows-latest' |
| 203 | + run: | |
| 204 | + cd sundials/build |
| 205 | + cmake --build . --config ${{ env.CMAKE_BUILD_TYPE_TEST }} |
| 206 | + - name: Install Sundials W/ MPI |
| 207 | + if: matrix.with-mpi == true |
| 208 | + run: | |
| 209 | + cd sundials/build |
| 210 | + cmake --install . --prefix /home/runner/miniconda3/envs/ephoto |
| 211 | +
|
| 212 | + ################################### |
| 213 | + # PIP INSTALL THINGS |
| 214 | + ################################### |
| 215 | + - name: Install packages not current on conda-forge (gcovr) |
| 216 | + if: matrix.with-coverage == true |
| 217 | + run: | |
| 218 | + pip install gcovr |
| 219 | +
|
| 220 | + ################################### |
| 221 | + # SET CONFIG FLAGS |
| 222 | + ################################### |
| 223 | + - name: Global config flags |
| 224 | + run: | |
| 225 | + CMAKE_BUILD_TYPE_TEST="Debug" |
| 226 | + echo "CMAKE_BUILD_TYPE_TEST=Debug" >> "$GITHUB_ENV" |
| 227 | + echo "CMAKE_ARGS=-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" >> "$GITHUB_ENV" |
| 228 | + echo "CMAKE_ARGS_TEST=-DBUILD_TESTS=ON" >> "$GITHUB_ENV" |
| 229 | + echo "TEST_FLAGS=-C ${CMAKE_BUILD_TYPE_TEST} --output-on-failure -VV" >> "$GITHUB_ENV" |
| 230 | + echo "BUILD_ARGS=--config ${CMAKE_BUILD_TYPE_TEST}" >> "$GITHUB_ENV" |
| 231 | + - name: Set flags to build in parallel (UNIX) |
| 232 | + if: matrix.os != 'windows-latest' |
| 233 | + run: | |
| 234 | + echo "BUILD_ARGS=${{ env.BUILD_ARGS }} -- -j 4" >> "$GITHUB_ENV" |
| 235 | + - name: Coverage config flags |
| 236 | + if: matrix.with-coverage == true && matrix.os != 'windows-latest' |
| 237 | + run: | |
| 238 | + echo "CMAKE_ARGS_TEST=${{ env.CMAKE_ARGS_TEST }} -DTEST_COVERAGE=ON" >> "$GITHUB_ENV" |
| 239 | + - name: ASAN config flags |
| 240 | + if: matrix.with-asan == true |
| 241 | + run: | |
| 242 | + echo "CMAKE_ARGS=${{ env.CMAKE_ARGS }} -DWITH_ASAN=ON" >> "$GITHUB_ENV" |
| 243 | + echo "ASAN_OPTIONS=detect_odr_violation=0:detect_container_overflow=0" >> $GITHUB_ENV |
| 244 | + echo "TEST_FLAGS=${{ env.TEST_FLAGS }} -E valgrind*" >> "$GITHUB_ENV" |
| 245 | + - name: ASAN dynamic library |
| 246 | + if: matrix.with-asan == true && matrix.os == 'macos-latest' |
| 247 | + run: | |
| 248 | + echo "DYLD_INSERT_LIBRARIES=$(clang -print-file-name=libclang_rt.asan_osx_dynamic.dylib)" >> "$GITHUB_ENV" |
| 249 | + - name: ELF config flags |
| 250 | + if: matrix.with-elf == true |
| 251 | + run: | |
| 252 | + echo "CMAKE_ARGS_TEST=${{ env.CMAKE_ARGS_TEST }} -DTEST_ELF=ON" >> "$GITHUB_ENV" |
| 253 | + - name: Valgrind off config flags |
| 254 | + if: matrix.with-valgrind == true |
| 255 | + run: | |
| 256 | + echo "CMAKE_ARGS_TEST=${{ env.CMAKE_ARGS_TEST }} -DTEST_VALGRIND=ON" >> "$GITHUB_ENV" |
| 257 | +
|
| 258 | + ################################### |
| 259 | + # Add paths for Windows dlls |
| 260 | + ################################### |
| 261 | + - name: Conda library paths on Windows |
| 262 | + if: matrix.os == 'windows-latest' |
| 263 | + run: | |
| 264 | + # This isn't necessary, but it speeds up the build |
| 265 | + LIB_DIRECTORY="${CONDA_PREFIX}/Library/lib" |
| 266 | + ls ${LIB_DIRECTORY} |
| 267 | + echo "${LIB_DIRECTORY}" >> $GITHUB_PATH |
| 268 | + DLL_DIRECTORY="${CONDA_PREFIX}/Library/bin" |
| 269 | + ls ${DLL_DIRECTORY} |
| 270 | + echo "${DLL_DIRECTORY}" >> $GITHUB_PATH |
| 271 | + |
| 272 | + ################################### |
| 273 | + # Configure |
| 274 | + ################################### |
| 275 | + - name: Configure (CONDA) |
| 276 | + run: | |
| 277 | + mkdir build |
| 278 | + cd build |
| 279 | + which cmake |
| 280 | + cmake .. ${{ env.CMAKE_ARGS }} ${{ env.CMAKE_ARGS_TEST }} |
| 281 | + |
| 282 | + ################################### |
| 283 | + # Build CXX |
| 284 | + ################################### |
| 285 | + - name: Build C++ & C |
| 286 | + run: | |
| 287 | + cd build |
| 288 | + cmake --build . ${{ env.BUILD_ARGS }} |
| 289 | + |
| 290 | + ################################### |
| 291 | + # Test CXX |
| 292 | + ################################### |
| 293 | + - name: Test C++ |
| 294 | + if: matrix.with-coverage != true |
| 295 | + run: | |
| 296 | + mamba list |
| 297 | + echo "PATH=$PATH" |
| 298 | + cd build |
| 299 | + which ctest |
| 300 | + ctest ${{ env.TEST_FLAGS }} |
| 301 | + - name: Test C++ (COVERAGE) |
| 302 | + if: matrix.with-coverage && matrix.os != 'windows-latest' |
| 303 | + run: | |
| 304 | + mamba list |
| 305 | + echo "PATH=$PATH" |
| 306 | + cd build |
| 307 | + make coverage |
| 308 | + - name: Preserve coverage information |
| 309 | + if: matrix.with-coverage && matrix.os != 'windows-latest' |
| 310 | + run: | |
| 311 | + cp -r build/coverage coverage |
| 312 | +
|
| 313 | + ################################### |
| 314 | + # Build Python |
| 315 | + ################################### |
| 316 | + - name: Configure Python |
| 317 | + if: matrix.with-python == true |
| 318 | + run: | |
| 319 | + cd build |
| 320 | + cmake .. -DBUILD_PYTHON=ON ${{ env.CMAKE_ARGS }} |
| 321 | + - name: Build & install Python |
| 322 | + if: matrix.with-python == true |
| 323 | + run: | |
| 324 | + cd build |
| 325 | + cmake --build . --target pyPhotosynthesis ${{ env.BUILD_ARGS }} |
| 326 | + cmake --install . --prefix /home/runner/miniconda3/envs/ephoto --component Python |
| 327 | +
|
| 328 | + ################################### |
| 329 | + # Test Python |
| 330 | + ################################### |
| 331 | + - name: Test Python Interfaces |
| 332 | + if: matrix.with-python == true |
| 333 | + run: | |
| 334 | + pytest -sv tests/python |
| 335 | +
|
| 336 | + ################################### |
| 337 | + # Docs tests |
| 338 | + ################################### |
| 339 | + - name: Build docs |
| 340 | + if: matrix.os != 'windows-latest' |
| 341 | + run: | |
| 342 | + python scripts/devtasks.py docs --rebuild |
| 343 | + |
| 344 | + ################################### |
| 345 | + # Coverage |
| 346 | + ################################### |
| 347 | + - name: Upload coverage report |
| 348 | + if: matrix.with-coverage == true && matrix.os != 'windows-latest' |
| 349 | + uses: codecov/codecov-action@v4 |
| 350 | + with: |
| 351 | + name: ${{ matrix.os }}-${{ matrix.sundials-version }}-${{ matrix.with-coverage }}-${{ matrix.with-asan }}-${{ matrix.with-elf }}-${{ matrix.with-valgrind }}-${{ matrix.with-mpi }}-${{ matrix.with-python }} |
| 352 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 353 | + file: coverage/coverage.info |
| 354 | + functionalities: gcov |
0 commit comments