-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #350 from astro-informatics/tk/refactor-ci
Refactor CI to remove duplication
- Loading branch information
Showing
3 changed files
with
139 additions
and
114 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: CMake | ||
name: CI | ||
|
||
on: | ||
push: | ||
|
@@ -22,7 +22,7 @@ jobs: | |
build: | ||
# Skip CI if PR is a draft | ||
if: github.event.pull_request.draft == false | ||
name: ${{matrix.os}}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}} | ||
name: build (${{matrix.os}}-${{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. | ||
|
@@ -35,15 +35,13 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-20.04 | ||
- ubuntu-22.04 | ||
- macos-14 | ||
cc: | ||
- gcc-10 | ||
- gcc-11 | ||
- gcc-12 | ||
- clang | ||
cxx: | ||
- g++-10 | ||
- g++-11 | ||
- g++-12 | ||
- clang++ | ||
mpi: | ||
- "ON" | ||
|
@@ -52,32 +50,16 @@ jobs: | |
- "ON" | ||
- "OFF" | ||
exclude: | ||
- cc: gcc-11 | ||
cxx: clang++ | ||
- cc: clang | ||
cxx: g++-11 | ||
- cc: gcc-10 | ||
cxx: clang++ | ||
- cc: clang | ||
cxx: g++-10 | ||
- os: ubuntu-20.04 | ||
- os: ubuntu-22.04 | ||
cc: clang | ||
- os: ubuntu-22.04 | ||
cxx: clang++ | ||
- os: macos-14 | ||
cxx: g++-10 | ||
- os: macos-14 | ||
cc: gcc-10 | ||
- os: ubuntu-20.04 | ||
cxx: g++-11 | ||
- os: ubuntu-20.04 | ||
cc: gcc-11 | ||
cc: gcc-12 | ||
- os: macos-14 | ||
mpi: "on" | ||
cxx: g++-12 | ||
- os: macos-14 | ||
cxx: g++-11 | ||
- cxx: clang++ | ||
omp: "on" | ||
|
||
mpi: "ON" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
|
@@ -93,7 +75,7 @@ jobs: | |
shell: bash | ||
run: echo "CCACHE_DIR=${{runner.workspace}}/.ccache" >> "${GITHUB_ENV}" | ||
- name: Cache ccache files | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{runner.workspace}}/.ccache | ||
key: ${{matrix.os}}-${{matrix.cxx}}-${{matrix.mpi}}-${{matrix.omp}}-${{ steps.ccache_cache_timestamp.outputs.date_and_time }} | ||
|
@@ -110,12 +92,12 @@ jobs: | |
if: ${{ contains(matrix.os, 'ubuntu') }} | ||
run: | | ||
sudo apt update | ||
sudo apt install openmpi-bin libopenmpi-dev ccache graphviz libeigen3-dev libspdlog-dev libtiff-dev libcfitsio-dev libbenchmark-dev libboost-all-dev libyaml-cpp-dev | ||
sudo apt install openmpi-bin libopenmpi-dev libyaml-cpp-dev libeigen3-dev libtiff-dev ccache | ||
- name: Install Dependencies on MacOS | ||
if: ${{ contains(matrix.os, 'macos') }} | ||
run: | | ||
brew install gcc libtiff open-mpi libomp eigen libyaml ccache cfitsio boost yaml-cpp | ||
brew install open-mpi libomp yaml-cpp eigen cfitsio ccache | ||
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV | ||
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH | ||
|
@@ -157,13 +139,77 @@ jobs: | |
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}} -Dtests=OFF -Dexamples=OFF | ||
make -j$(nproc --ignore 1) install | ||
- name: Install | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: dependencies-${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }} | ||
path: ${{github.workspace}}/local | ||
|
||
|
||
test: | ||
needs: | ||
build | ||
name: test (${{matrix.os}}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}}) | ||
runs-on: ${{matrix.os}} | ||
env: | ||
CC: ${{ matrix.cc }} | ||
CXX: ${{ matrix.cxx }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-22.04 | ||
- macos-14 | ||
cc: | ||
- gcc-12 | ||
- clang | ||
cxx: | ||
- g++-12 | ||
- clang++ | ||
mpi: | ||
- "ON" | ||
- "OFF" | ||
omp: | ||
- "ON" | ||
- "OFF" | ||
exclude: | ||
- os: ubuntu-22.04 | ||
cc: clang | ||
- os: ubuntu-22.04 | ||
cxx: clang++ | ||
- os: macos-14 | ||
cc: gcc-12 | ||
- os: macos-14 | ||
cxx: g++-12 | ||
- os: macos-14 | ||
mpi: "ON" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dependencies-${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }} | ||
path: ${{github.workspace}}/local | ||
|
||
- name: Install Dependencies on Ubunutu | ||
if: ${{ contains(matrix.os, 'ubuntu') }} | ||
run: | | ||
sudo apt update | ||
sudo apt install openmpi-bin libopenmpi-dev ccache 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 open-mpi libomp eigen ccache cfitsio boost yaml-cpp | ||
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 -Ddocasa=OFF -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}} | ||
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddocasa=OFF -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}} -Dtests=ON | ||
make -j$(nproc --ignore 1) install | ||
- name: Test | ||
|
@@ -173,3 +219,60 @@ jobs: | |
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: | ||
CC: ${{ matrix.cc }} | ||
CXX: ${{ matrix.cxx }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-22.04 | ||
cc: | ||
- gcc-12 | ||
cxx: | ||
- g++-12 | ||
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 }} | ||
path: ${{github.workspace}}/local | ||
|
||
- 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 | ||
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 -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. |
This file was deleted.
Oops, something went wrong.
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