Added c compiler to recipe #207
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test of package installation & execution | |
| 'on': | |
| push: | |
| branches-ignore: | |
| - gh-pages | |
| tags: | |
| - '*' | |
| schedule: | |
| - cron: 0 10 * * 1 | |
| jobs: | |
| build_cxx: | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| strategy: | |
| matrix: | |
| sundials-version: [latest] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| with-coverage: [false, true] | |
| with-asan: [false, true] | |
| with-elf: [false] | |
| with-valgrind: [false, true] | |
| with-mpi: [false] | |
| with-python: [false] | |
| with-yggdrasil: [false] | |
| include: | |
| - sundials-version: "5.7.0" | |
| os: ubuntu-latest | |
| with-coverage: false | |
| with-asan: false | |
| with-elf: false | |
| with-valgrind: false | |
| with-mpi: false | |
| with-python: false | |
| with-yggdrasil: false | |
| - sundials-version: "6.7.0" | |
| os: ubuntu-latest | |
| with-coverage: false | |
| with-asan: false | |
| with-elf: false | |
| with-valgrind: false | |
| with-mpi: false | |
| with-python: false | |
| with-yggdrasil: false | |
| - sundials-version: "7.1.1" | |
| os: ubuntu-latest | |
| with-coverage: false | |
| with-asan: false | |
| with-elf: false | |
| with-valgrind: false | |
| with-mpi: false | |
| with-python: false | |
| with-yggdrasil: false | |
| - sundials-version: latest | |
| os: ubuntu-latest | |
| with-coverage: false | |
| with-asan: false | |
| with-elf: false | |
| with-valgrind: false | |
| with-mpi: true | |
| with-python: false | |
| with-yggdrasil: true | |
| - sundials-version: "6.7.0" | |
| os: ubuntu-latest | |
| with-coverage: false | |
| with-asan: false | |
| with-elf: false | |
| with-valgrind: false | |
| with-mpi: true | |
| with-python: false | |
| with-yggdrasil: true | |
| - sundials-version: "7.1.1" | |
| os: ubuntu-latest | |
| with-coverage: false | |
| with-asan: false | |
| with-elf: false | |
| with-valgrind: false | |
| with-mpi: true | |
| with-python: false | |
| with-yggdrasil: true | |
| - sundials-version: latest | |
| os: ubuntu-latest | |
| with-coverage: false | |
| with-asan: false | |
| with-elf: false | |
| with-valgrind: false | |
| with-mpi: false | |
| with-python: true | |
| with-yggdrasil: true | |
| exclude: | |
| - os: windows-latest | |
| with-asan: true | |
| - os: ubuntu-latest | |
| with-asan: true | |
| - os: windows-latest | |
| with-valgrind: true | |
| - os: windows-latest | |
| with-elf: true | |
| - os: macos-latest | |
| with-valgrind: true | |
| - os: macos-latest | |
| with-elf: true | |
| - with-valgrind: true | |
| with-elf: true | |
| - with-valgrind: true | |
| with-asan: true | |
| - with-coverage: true | |
| with-valgrind: true | |
| - with-coverage: true | |
| with-asan: true | |
| - with-yggdrasil: true | |
| with-coverage: true | |
| - with-yggdrasil: true | |
| with-mpi: true | |
| - with-yggdrasil: true | |
| with-elf: true | |
| - with-yggdrasil: true | |
| with-valgrind: true | |
| fail-fast: false | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| ################################### | |
| # CONDA SETUP | |
| ################################### | |
| - name: Set up MSVC Compiler on windows | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| if: matrix.os == 'windows-latest' | |
| - name: Set up miniconda test environment (W/O MPI) | |
| if: matrix.with-mpi == false | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| activate-environment: ephoto | |
| environment-file: environment.yml | |
| auto-update-conda: true | |
| channels: conda-forge | |
| channel-priority: strict | |
| miniforge-variant: Miniforge3 | |
| miniforge-version: latest | |
| conda-remove-defaults: true | |
| - name: Set up miniconda test environment (W/ MPI) | |
| if: matrix.with-mpi == true | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| activate-environment: ephoto | |
| environment-file: environment_mpi.yml | |
| auto-update-conda: true | |
| channels: conda-forge | |
| channel-priority: strict | |
| miniforge-variant: Miniforge3 | |
| miniforge-version: latest | |
| conda-remove-defaults: true | |
| - name: Configure yggdrasil & compile interface | |
| if: matrix.with-yggdrasil == true | |
| run: | | |
| yggconfig | |
| yggcompile cpp | |
| ygginfo | |
| - name: Install mpi with non-mpi Sundials to test compilation | |
| if: matrix.with-mpi == false | |
| run: | | |
| conda install openmpi -y | |
| - name: Install specific version of Sundials via conda | |
| if: matrix.sundials-version != 'latest' && matrix.with-mpi == false | |
| run: | | |
| conda install sundials==${{ matrix.sundials-version }} -y | |
| - name: Check conda installation | |
| run: | | |
| conda info | |
| conda list | |
| - name: Install compilers using conda on Linux/Mac | |
| if: matrix.os != 'windows-latest' && matrix.with-valgrind != true | |
| run: | | |
| conda install c-compiler cxx-compiler | |
| - name: Install valgrind on unix systems (and required debug symbols) | |
| if: matrix.os != 'windows-latest' && matrix.with-valgrind == true | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libc6-dbg | |
| conda install valgrind | |
| ################################### | |
| # INSTALL SUNDIALS W/ MPI | |
| ################################### | |
| - name: CMake flags for building Sundials W/ MPI | |
| shell: bash -l {0} | |
| if: matrix.with-mpi == true | |
| run: | | |
| CMAKE_BUILD_TYPE_TEST="RelWithDebInfo" | |
| echo "CMAKE_BUILD_TYPE_TEST=RelWithDebInfo" >> "$GITHUB_ENV" | |
| echo "CMAKE_ARGS=-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DENABLE_MPI:BOOL=ON -DEXAMPLES_ENABLE_C:BOOL=OFF -DEXAMPLES_ENABLE_CXX:BOOL=OFF" >> "$GITHUB_ENV" | |
| - name: Clone Sundials for build W/ MPI | |
| if: matrix.with-mpi == true | |
| run: | | |
| git clone https://github.com/LLNL/sundials.git | |
| - name: Check out specific version of Sundials for build W/ MPI | |
| if: matrix.sundials-version != 'latest' && matrix.with-mpi == true | |
| run: | | |
| cd sundials | |
| git checkout tags/v${{ matrix.sundials-version }} -b tagged | |
| - name: Configure Sundials W/ MPI | |
| if: matrix.with-mpi == true | |
| run: | | |
| cd sundials | |
| mkdir build | |
| cd build | |
| cmake .. ${{ env.CMAKE_ARGS }} | |
| - name: Build Sundials W/ MPI in parallel (CONDA, UNIX) | |
| if: matrix.with-mpi == true && matrix.os != 'windows-latest' | |
| run: | | |
| cd sundials/build | |
| cmake --build . --config ${{ env.CMAKE_BUILD_TYPE_TEST }} -- -j 4 | |
| - name: Build Sundials W/ MPI in serial (CONDA, WINDOWS) | |
| if: matrix.with-mpi == true && matrix.os == 'windows-latest' | |
| run: | | |
| cd sundials/build | |
| cmake --build . --config ${{ env.CMAKE_BUILD_TYPE_TEST }} | |
| - name: Install Sundials W/ MPI | |
| if: matrix.with-mpi == true | |
| run: | | |
| cd sundials/build | |
| cmake --install . --prefix /home/runner/miniconda3/envs/ephoto | |
| ################################### | |
| # PIP INSTALL THINGS | |
| ################################### | |
| - name: Install packages not current on conda-forge (gcovr) | |
| if: matrix.with-coverage == true | |
| run: | | |
| pip install gcovr | |
| ################################### | |
| # SET CONFIG FLAGS | |
| ################################### | |
| - name: Global config flags | |
| run: | | |
| CMAKE_BUILD_TYPE_TEST="Debug" | |
| echo "CMAKE_BUILD_TYPE_TEST=Debug" >> "$GITHUB_ENV" | |
| echo "CMAKE_ARGS=-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" >> "$GITHUB_ENV" | |
| echo "CMAKE_ARGS_TEST=-DBUILD_TESTS=ON" >> "$GITHUB_ENV" | |
| echo "TEST_FLAGS=-C ${CMAKE_BUILD_TYPE_TEST} --output-on-failure -VV" >> "$GITHUB_ENV" | |
| echo "BUILD_ARGS=--config ${CMAKE_BUILD_TYPE_TEST}" >> "$GITHUB_ENV" | |
| - name: Config flags for linking against yggdrasil | |
| if: matrix.with-yggdrasil == true | |
| run: | | |
| echo "CMAKE_ARGS=${{ env.CMAKE_ARGS }} -DWITH_YGGDRASIL:BOOL=ON" >> "$GITHUB_ENV" | |
| - name: Set flags to build in parallel (UNIX) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| echo "BUILD_ARGS=${{ env.BUILD_ARGS }} -- -j 4" >> "$GITHUB_ENV" | |
| - name: Coverage config flags | |
| if: matrix.with-coverage == true && matrix.os != 'windows-latest' | |
| run: | | |
| echo "CMAKE_ARGS_TEST=${{ env.CMAKE_ARGS_TEST }} -DTEST_COVERAGE=ON" >> "$GITHUB_ENV" | |
| - name: ASAN config flags | |
| if: matrix.with-asan == true | |
| run: | | |
| echo "CMAKE_ARGS=${{ env.CMAKE_ARGS }} -DWITH_ASAN=ON" >> "$GITHUB_ENV" | |
| echo "ASAN_OPTIONS=detect_odr_violation=0:detect_container_overflow=0" >> $GITHUB_ENV | |
| echo "TEST_FLAGS=${{ env.TEST_FLAGS }} -E valgrind*" >> "$GITHUB_ENV" | |
| - name: ASAN dynamic library | |
| if: matrix.with-asan == true && matrix.os == 'macos-latest' | |
| run: | | |
| echo "DYLD_INSERT_LIBRARIES=$(clang -print-file-name=libclang_rt.asan_osx_dynamic.dylib)" >> "$GITHUB_ENV" | |
| - name: ELF config flags | |
| if: matrix.with-elf == true | |
| run: | | |
| echo "CMAKE_ARGS_TEST=${{ env.CMAKE_ARGS_TEST }} -DTEST_ELF=ON" >> "$GITHUB_ENV" | |
| - name: Valgrind off config flags | |
| if: matrix.with-valgrind == true | |
| run: | | |
| echo "CMAKE_ARGS_TEST=${{ env.CMAKE_ARGS_TEST }} -DTEST_VALGRIND=ON" >> "$GITHUB_ENV" | |
| ################################### | |
| # Add paths for Windows dlls | |
| ################################### | |
| - name: Conda library paths on Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| # This isn't necessary, but it speeds up the build | |
| LIB_DIRECTORY="${CONDA_PREFIX}/Library/lib" | |
| ls ${LIB_DIRECTORY} | |
| echo "${LIB_DIRECTORY}" >> $GITHUB_PATH | |
| DLL_DIRECTORY="${CONDA_PREFIX}/Library/bin" | |
| ls ${DLL_DIRECTORY} | |
| echo "${DLL_DIRECTORY}" >> $GITHUB_PATH | |
| ################################### | |
| # Configure | |
| ################################### | |
| - name: Configure (CONDA) | |
| run: | | |
| mkdir build | |
| cd build | |
| which cmake | |
| cmake .. ${{ env.CMAKE_ARGS }} ${{ env.CMAKE_ARGS_TEST }} | |
| ################################### | |
| # Build CXX | |
| ################################### | |
| - name: Build C++ & C | |
| run: | | |
| cd build | |
| cmake --build . ${{ env.BUILD_ARGS }} | |
| ################################### | |
| # Test CXX | |
| ################################### | |
| - name: Test C++ | |
| if: matrix.with-coverage != true | |
| run: | | |
| conda list | |
| echo "PATH=$PATH" | |
| cd build | |
| which ctest | |
| ctest ${{ env.TEST_FLAGS }} | |
| - name: Test C++ (COVERAGE) | |
| if: matrix.with-coverage && matrix.os != 'windows-latest' | |
| run: | | |
| conda list | |
| echo "PATH=$PATH" | |
| cd build | |
| make coverage | |
| - name: Preserve coverage information | |
| if: matrix.with-coverage && matrix.os != 'windows-latest' | |
| run: | | |
| cp -r build/coverage coverage | |
| ################################### | |
| # Build Python | |
| ################################### | |
| - name: Install Python via pip | |
| if: matrix.with-python == true | |
| run: | | |
| pip install . -v --no-build-isolation | |
| # - name: Configure Python | |
| # if: matrix.with-python == true | |
| # run: | | |
| # cd build | |
| # cmake .. -DBUILD_PYTHON=ON ${{ env.CMAKE_ARGS }} | |
| # - name: Build & install Python | |
| # if: matrix.with-python == true | |
| # run: | | |
| # cd build | |
| # cmake --build . --target pyPhotosynthesis ${{ env.BUILD_ARGS }} | |
| # cmake --install . --prefix /home/runner/miniconda3/envs/ephoto --component Python | |
| ################################### | |
| # Test Python | |
| ################################### | |
| - name: Test Python Interfaces | |
| if: matrix.with-python == true | |
| run: | | |
| pytest -sv tests/python | |
| ################################### | |
| # Coverage | |
| ################################### | |
| - name: Upload coverage report | |
| if: matrix.with-coverage == true && matrix.os != 'windows-latest' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| name: ${{ matrix.os }}-${{ matrix.sundials-version }}-${{ matrix.with-coverage }}-${{ matrix.with-asan }}-${{ matrix.with-elf }}-${{ matrix.with-valgrind }}-${{ matrix.with-mpi }}-${{ matrix.with-python }} | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: coverage/coverage.info | |
| functionalities: gcov | |
| ####################################### | |
| # Build & Publish docs | |
| ####################################### | |
| docs: | |
| name: Build/Publish the Docs | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Get tags required by setuptools_scm to generate version | |
| run: | | |
| git fetch --prune --unshallow | |
| git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
| - name: Set up miniconda test environment | |
| if: matrix.with-mpi == false | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| activate-environment: ephoto | |
| environment-file: environment.yml | |
| auto-update-conda: true | |
| channels: conda-forge | |
| channel-priority: strict | |
| miniforge-variant: Miniforge3 | |
| miniforge-version: latest | |
| conda-remove-defaults: true | |
| - name: Install doc dependencies | |
| run: | | |
| conda env update -n ephoto --file environment_docs.yml | |
| conda list | |
| - name: Build docs | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| python scripts/devtasks.py docs --rebuild | |
| - name: Publish docs to Github pages | |
| # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| uses: JamesIves/github-pages-deploy-action@3.7.1 | |
| with: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| BRANCH: gh-pages | |
| FOLDER: build/doc/html/ |