-
Notifications
You must be signed in to change notification settings - Fork 12
289 lines (260 loc) · 9.78 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
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.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}}
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
# 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.cxx}}-${{matrix.mpi}}-${{matrix.omp}}-${{ steps.ccache_cache_timestamp.outputs.date_and_time }}
restore-keys: |
${{ 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') }}
run: |
sudo apt update
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 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 ${{github.workspace}}/sopt/build
cd ${{github.workspace}}/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: |
cd ${{github.workspace}}
tar cfv dependencies.tar local
- uses: actions/upload-artifact@v4
with:
name: dependencies-${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }}
path: ${{github.workspace}}/dependencies.tar
retention-days: 5
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 }}
- 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 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 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}
export DYLD_LIBRARY_PATH=${{github.workspace}}/local/lib:${{github.workspace}}/local/external/lib:${DYLD_LIBRARY_PATH}
export DYLD_LIBRARY_PATH=$(brew --prefix)/lib:${DYLD_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 }}
- 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.