Skip to content

Commit 90c0369

Browse files
authored
Merge pull request #350 from astro-informatics/tk/refactor-ci
Refactor CI to remove duplication
2 parents 0a92448 + ffd2cc8 commit 90c0369

File tree

3 files changed

+139
-114
lines changed

3 files changed

+139
-114
lines changed

.github/workflows/cmake.yml renamed to .github/workflows/ci.yml

Lines changed: 136 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CMake
1+
name: CI
22

33
on:
44
push:
@@ -22,7 +22,7 @@ jobs:
2222
build:
2323
# Skip CI if PR is a draft
2424
if: github.event.pull_request.draft == false
25-
name: ${{matrix.os}}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}}
25+
name: build (${{matrix.os}}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}})
2626
# The CMake configure and build commands are platform agnostic and should work equally
2727
# well on Windows or Mac. You can convert this to a matrix build if you need
2828
# cross-platform coverage.
@@ -35,15 +35,13 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
os:
38-
- ubuntu-20.04
38+
- ubuntu-22.04
3939
- macos-14
4040
cc:
41-
- gcc-10
42-
- gcc-11
41+
- gcc-12
4342
- clang
4443
cxx:
45-
- g++-10
46-
- g++-11
44+
- g++-12
4745
- clang++
4846
mpi:
4947
- "ON"
@@ -52,32 +50,16 @@ jobs:
5250
- "ON"
5351
- "OFF"
5452
exclude:
55-
- cc: gcc-11
56-
cxx: clang++
57-
- cc: clang
58-
cxx: g++-11
59-
- cc: gcc-10
60-
cxx: clang++
61-
- cc: clang
62-
cxx: g++-10
63-
- os: ubuntu-20.04
53+
- os: ubuntu-22.04
6454
cc: clang
55+
- os: ubuntu-22.04
6556
cxx: clang++
6657
- os: macos-14
67-
cxx: g++-10
68-
- os: macos-14
69-
cc: gcc-10
70-
- os: ubuntu-20.04
71-
cxx: g++-11
72-
- os: ubuntu-20.04
73-
cc: gcc-11
58+
cc: gcc-12
7459
- os: macos-14
75-
mpi: "on"
60+
cxx: g++-12
7661
- os: macos-14
77-
cxx: g++-11
78-
- cxx: clang++
79-
omp: "on"
80-
62+
mpi: "ON"
8163
steps:
8264
- uses: actions/checkout@v4
8365

@@ -93,7 +75,7 @@ jobs:
9375
shell: bash
9476
run: echo "CCACHE_DIR=${{runner.workspace}}/.ccache" >> "${GITHUB_ENV}"
9577
- name: Cache ccache files
96-
uses: actions/cache@v3
78+
uses: actions/cache@v4
9779
with:
9880
path: ${{runner.workspace}}/.ccache
9981
key: ${{matrix.os}}-${{matrix.cxx}}-${{matrix.mpi}}-${{matrix.omp}}-${{ steps.ccache_cache_timestamp.outputs.date_and_time }}
@@ -110,12 +92,12 @@ jobs:
11092
if: ${{ contains(matrix.os, 'ubuntu') }}
11193
run: |
11294
sudo apt update
113-
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
95+
sudo apt install openmpi-bin libopenmpi-dev libyaml-cpp-dev libeigen3-dev libtiff-dev ccache
11496
11597
- name: Install Dependencies on MacOS
11698
if: ${{ contains(matrix.os, 'macos') }}
11799
run: |
118-
brew install gcc libtiff open-mpi libomp eigen libyaml ccache cfitsio boost yaml-cpp
100+
brew install open-mpi libomp yaml-cpp eigen cfitsio ccache
119101
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
120102
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH
121103
@@ -157,13 +139,77 @@ jobs:
157139
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}} -Dtests=OFF -Dexamples=OFF
158140
make -j$(nproc --ignore 1) install
159141
160-
- name: Install
142+
- uses: actions/upload-artifact@v4
143+
with:
144+
name: dependencies-${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }}
145+
path: ${{github.workspace}}/local
146+
147+
148+
test:
149+
needs:
150+
build
151+
name: test (${{matrix.os}}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}})
152+
runs-on: ${{matrix.os}}
153+
env:
154+
CC: ${{ matrix.cc }}
155+
CXX: ${{ matrix.cxx }}
156+
strategy:
157+
fail-fast: false
158+
matrix:
159+
os:
160+
- ubuntu-22.04
161+
- macos-14
162+
cc:
163+
- gcc-12
164+
- clang
165+
cxx:
166+
- g++-12
167+
- clang++
168+
mpi:
169+
- "ON"
170+
- "OFF"
171+
omp:
172+
- "ON"
173+
- "OFF"
174+
exclude:
175+
- os: ubuntu-22.04
176+
cc: clang
177+
- os: ubuntu-22.04
178+
cxx: clang++
179+
- os: macos-14
180+
cc: gcc-12
181+
- os: macos-14
182+
cxx: g++-12
183+
- os: macos-14
184+
mpi: "ON"
185+
steps:
186+
- uses: actions/checkout@v4
187+
188+
- uses: actions/download-artifact@v4
189+
with:
190+
name: dependencies-${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }}
191+
path: ${{github.workspace}}/local
192+
193+
- name: Install Dependencies on Ubunutu
194+
if: ${{ contains(matrix.os, 'ubuntu') }}
195+
run: |
196+
sudo apt update
197+
sudo apt install openmpi-bin libopenmpi-dev ccache graphviz libeigen3-dev libtiff-dev libcfitsio-dev libboost-all-dev libyaml-cpp-dev
198+
199+
- name: Install Dependencies on MacOS
200+
if: ${{ contains(matrix.os, 'macos') }}
201+
run: |
202+
brew install open-mpi libomp eigen ccache cfitsio boost yaml-cpp
203+
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
204+
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH
205+
206+
- name: Build tests
161207
# Build your program with the given configuration
162208
run: |
163209
export CMAKE_PREFIX_PATH=${{github.workspace}}/local:$CMAKE_PREFIX_PATH
164210
mkdir -p ${{github.workspace}}/build
165211
cd ${{github.workspace}}/build
166-
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddocasa=OFF -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}}
212+
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddocasa=OFF -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}} -Dtests=ON
167213
make -j$(nproc --ignore 1) install
168214
169215
- name: Test
@@ -173,3 +219,60 @@ jobs:
173219
run: |
174220
export LD_LIBRARY_PATH=${{github.workspace}}/local/lib:${{github.workspace}}/local/external/lib:${LD_LIBRARY_PATH}
175221
ctest -C ${{env.BUILD_TYPE}} --output-on-failure
222+
223+
doc:
224+
needs:
225+
build
226+
name: doc (${{matrix.os}}-${{matrix.cxx}}-mpi:${{matrix.mpi}}-openmp:${{matrix.omp}})
227+
runs-on: ${{matrix.os}}
228+
env:
229+
CC: ${{ matrix.cc }}
230+
CXX: ${{ matrix.cxx }}
231+
strategy:
232+
fail-fast: false
233+
matrix:
234+
os:
235+
- ubuntu-22.04
236+
cc:
237+
- gcc-12
238+
cxx:
239+
- g++-12
240+
mpi:
241+
- "OFF"
242+
omp:
243+
- "OFF"
244+
steps:
245+
- uses: actions/checkout@v4
246+
247+
- uses: actions/download-artifact@v4
248+
with:
249+
name: dependencies-${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }}
250+
path: ${{github.workspace}}/local
251+
252+
- name: Install Dependencies on Ubunutu
253+
if: ${{ contains(matrix.os, 'ubuntu') }}
254+
run: |
255+
sudo apt update
256+
sudo apt install ccache doxygen graphviz libeigen3-dev libtiff-dev libcfitsio-dev libboost-all-dev libyaml-cpp-dev
257+
258+
- name: Install Dependencies on MacOS
259+
if: ${{ contains(matrix.os, 'macos') }}
260+
run: |
261+
brew install gcc libtiff eigen libyaml ccache cfitsio boost yaml-cpp
262+
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
263+
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH
264+
265+
- name: Build docs
266+
run: |
267+
export CMAKE_PREFIX_PATH=${{github.workspace}}/local:$CMAKE_PREFIX_PATH
268+
mkdir -p ${{github.workspace}}/build
269+
cd ${{github.workspace}}/build
270+
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddompi=OFF -Dopenmp=OFF -Ddocs=ON
271+
make -j$(nproc --ignore 1) install
272+
273+
- name: Deploy to GH pages
274+
if: ${{github.event_name == 'push'}}
275+
uses: JamesIves/github-pages-deploy-action@4.1.6
276+
with:
277+
branch: gh-pages # The branch the action should deploy to.
278+
folder: build/cpp/docs/html # The folder the action should deploy.

.github/workflows/documentation.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

.github/workflows/linting.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ on:
99

1010
jobs:
1111
linting:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313
steps:
1414
- name: Checkout repo
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

1717
# Check code meets Google C++ style guide https://google.github.io/styleguide/cppguide.html
1818
- name: Run linting
19-
uses: DoozyX/clang-format-lint-action@v0.16.2
19+
uses: DoozyX/clang-format-lint-action@v0.18.2
2020
with:
2121
source: '.'
2222
extensions: 'h,cc'

0 commit comments

Comments
 (0)