Clean up CI matrix and add Fedora build #170
This file contains 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: CI | |
on: | |
push: | |
branches: [ development ] | |
pull_request: | |
# CI runs when new commits are pushed or when draft PR is marked ready for review | |
types: [opened, synchronize, reopened, ready_for_review] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
OMP_NUM_THREADS: 2 | |
jobs: | |
build: | |
# Skip CI if PR is a draft | |
if: github.event.pull_request.draft == false | |
name: build (${{matrix.os}}-${{matrix.container}}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}}) | |
# The CMake configure and build commands are platform agnostic and should work equally | |
# well on Windows or Mac. You can convert this to a matrix build if you need | |
# cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ${{matrix.os}} | |
container: ${{matrix.container}} | |
env: | |
CXX: ${{ matrix.cxx }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: ubuntu-22.04, cxx: g++, mpi: "ON", omp: "ON" } | |
- { os: ubuntu-22.04, cxx: g++, mpi: "ON", omp: "OFF" } | |
- { os: ubuntu-22.04, cxx: g++, mpi: "OFF", omp: "ON" } | |
- { os: ubuntu-22.04, cxx: g++, mpi: "OFF", omp: "OFF"} | |
- { os: ubuntu-22.04, cxx: g++, mpi: "OFF", omp: "ON", distribution: "fedora", container: "fedora:39" } | |
- { os: macos-14, cxx: clang++, mpi: "ON", omp: "ON" } | |
- { os: macos-14, cxx: clang++, mpi: "OFF", omp: "OFF" } | |
steps: | |
- uses: actions/checkout@v4 | |
# Enable tmate debugging of manually-triggered workflows if the input option was provided | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} | |
- name: Prepare ccache timestamp | |
id: ccache_cache_timestamp | |
run: echo "{date_and_time}={$(date +'%Y-%m-%d-%H;%M;%S')}" >> $GITHUB_OUTPUT | |
- name: Set ccache cache directory | |
shell: bash | |
run: echo "CCACHE_DIR=${{runner.workspace}}/.ccache" >> "${GITHUB_ENV}" | |
- name: Cache ccache files | |
uses: actions/cache@v4 | |
with: | |
path: ${{runner.workspace}}/.ccache | |
key: ${{matrix.os}}-${{matrix.container}}-${{matrix.cxx}}-${{matrix.mpi}}-${{matrix.omp}}-${{ steps.ccache_cache_timestamp.outputs.date_and_time }} | |
restore-keys: | | |
${{ matrix.os }}-${{matrix.container}}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }} | |
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }} | |
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }} | |
${{ matrix.os }}-${{ matrix.cxx }} | |
${{ matrix.os }} | |
# - name: Clear ccache | |
# run: ccache --clear | |
- name: Install Dependencies on Ubunutu | |
if: contains(matrix.os, 'ubuntu') && !contains(matrix.container, 'fedora') | |
run: | | |
sudo apt update | |
sudo apt install openmpi-bin libopenmpi-dev libyaml-cpp-dev libeigen3-dev libtiff-dev ccache | |
- name: Install Dependencies on Fedora | |
if: ${{ contains(matrix.container, 'fedora') }} | |
run: | | |
sudo dnf -y update | |
sudo dnf -y install cmake gcc gcc-c++ wget | |
sudo dnf -y install openmpi openmpi-devel yaml-cpp ccache eigen3-devel libtiff-devel git | |
- name: Install Dependencies on MacOS | |
if: ${{ contains(matrix.os, 'macos') }} | |
run: | | |
brew install open-mpi libomp yaml-cpp eigen cfitsio ccache onnxruntime | |
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV | |
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH | |
- name: Checkout Catch2 | |
uses: actions/checkout@v4 | |
with: | |
repository: catchorg/Catch2.git | |
path: Catch2 | |
ref: v3.4.0 | |
- name: Build Catch2 | |
run: | | |
mkdir Catch2/build | |
cd Catch2/build | |
cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local | |
make -j$(nproc --ignore 1) install | |
- name: Install FFTW | |
run: | | |
wget --no-check-certificate --no-verbose http://www.fftw.org/fftw-3.3.10.tar.gz -O- | tar --no-same-owner -xz; | |
cd fftw-3.3.10 | |
./configure --prefix=${{github.workspace}}/local --enable-shared | |
make -j$(nproc --ignore 1) install CFLAGS=-fPIC | |
# Fix bug in FFT3 (cf. https://github.com/FFTW/fftw3/issues/332) | |
sed -i -e 's/^.*FFTW3LibraryDepends.cmake.*$//1' ${{github.workspace}}/local/lib*/cmake/*/FFTW3Config.cmake | |
- name: Checkout SOPT | |
uses: actions/checkout@v4 | |
with: | |
repository: astro-informatics/sopt.git | |
path: sopt | |
ref: development | |
- name: Build sopt | |
run: | | |
export CMAKE_PREFIX_PATH=${{github.workspace}}/local:$CMAKE_PREFIX_PATH | |
mkdir -p sopt/build | |
cd sopt/build | |
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Donnxrt=ON -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}} -Dtests=OFF -Dexamples=OFF | |
make -j$(nproc --ignore 1) install | |
- name: Pack dependencies | |
run: | | |
tar cfv dependencies.tar ${{github.workspace}}/local | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dependencies-${{ matrix.os }}-${{ matrix.distribution }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }} | |
path: ${{github.workspace}}/dependencies.tar | |
retention-days: 5 | |
test: | |
needs: | |
build | |
name: test (${{matrix.os}}-${{ matrix.distribution }}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}}) | |
runs-on: ${{matrix.os}} | |
container: ${{matrix.container}} | |
env: | |
CXX: ${{ matrix.cxx }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: ubuntu-22.04, cxx: g++, mpi: "ON", omp: "ON" } | |
- { os: ubuntu-22.04, cxx: g++, mpi: "ON", omp: "OFF" } | |
- { os: ubuntu-22.04, cxx: g++, mpi: "OFF", omp: "ON" } | |
- { os: ubuntu-22.04, cxx: g++, mpi: "OFF", omp: "OFF" } | |
- { os: ubuntu-22.04, cxx: g++, mpi: "OFF", omp: "ON", distribution: "fedora", container: "fedora:39" } | |
- { os: macos-14, cxx: clang++, mpi: "ON", omp: "ON" } | |
- { os: macos-14, cxx: clang++, mpi: "OFF", omp: "OFF" } | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dependencies-${{ matrix.os }}-${{matrix.container}}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }} | |
- name: Unpack dependencies | |
run: tar xfv dependencies.tar | |
- name: Install Dependencies on Ubunutu | |
if: contains(matrix.os, 'ubuntu') && !contains(matrix.container, 'fedora') | |
run: | | |
sudo apt update | |
sudo apt install openmpi-bin libopenmpi-dev ccache libeigen3-dev libtiff-dev libcfitsio-dev libboost-all-dev libyaml-cpp-dev | |
- name: Install Dependencies on Fedora | |
if: ${{ contains(matrix.container, 'fedora') }} | |
run: | | |
sudo dnf -y update | |
sudo dnf -y install cmake gcc gcc-c++ | |
sudo dnf -y install openmpi openmpi-devel yaml-cpp ccache eigen3-devel libtiff-devel cfitsio-devel boost-devel | |
- name: Install Dependencies on MacOS | |
if: ${{ contains(matrix.os, 'macos') }} | |
run: | | |
brew install open-mpi libomp eigen ccache cfitsio boost yaml-cpp onnxruntime | |
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV | |
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH | |
- name: Build tests | |
# Build your program with the given configuration | |
run: | | |
export CMAKE_PREFIX_PATH=${{github.workspace}}/local:$CMAKE_PREFIX_PATH | |
mkdir -p ${{github.workspace}}/build | |
cd ${{github.workspace}}/build | |
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Donnxrt=ON -Ddocasa=OFF -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}} -Dtests=ON | |
make -j$(nproc --ignore 1) install | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: | | |
export LD_LIBRARY_PATH=${{github.workspace}}/local/lib:${{github.workspace}}/local/external/lib:${LD_LIBRARY_PATH} | |
ctest -C ${{env.BUILD_TYPE}} --output-on-failure | |
doc: | |
needs: | |
build | |
name: doc (${{matrix.os}}--${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}}) | |
runs-on: ${{matrix.os}} | |
env: | |
CXX: ${{ matrix.cxx }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: ubuntu-22.04, cxx: g++, mpi: "OFF", omp: "OFF" } | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dependencies-${{ matrix.os }}--${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }} | |
- name: Unpack dependencies | |
run: tar xfv dependencies.tar | |
- name: Install Dependencies on Ubunutu | |
if: ${{ contains(matrix.os, 'ubuntu') }} | |
run: | | |
sudo apt update | |
sudo apt install ccache doxygen graphviz libeigen3-dev libtiff-dev libcfitsio-dev libboost-all-dev libyaml-cpp-dev | |
- name: Install Dependencies on MacOS | |
if: ${{ contains(matrix.os, 'macos') }} | |
run: | | |
brew install gcc libtiff eigen libyaml ccache cfitsio boost yaml-cpp onnxruntime | |
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV | |
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH | |
- name: Build docs | |
run: | | |
export CMAKE_PREFIX_PATH=${{github.workspace}}/local:$CMAKE_PREFIX_PATH | |
mkdir -p ${{github.workspace}}/build | |
cd ${{github.workspace}}/build | |
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Donnxrt=ON -Ddompi=OFF -Dopenmp=OFF -Ddocs=ON | |
make -j$(nproc --ignore 1) install | |
- name: Deploy to GH pages | |
if: ${{github.event_name == 'push'}} | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: build/cpp/docs/html # The folder the action should deploy. |