File: ci.yml

package info (click to toggle)
purify 5.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 186,836 kB
  • sloc: cpp: 17,731; python: 510; xml: 182; makefile: 7; sh: 6
file content (393 lines) | stat: -rw-r--r-- 13,883 bytes parent folder | download
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
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:
  dependencies:
    # Skip CI if PR is a draft
    if: github.event.pull_request.draft == false
    name: dependencies (${{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

    - name: Setup cmake
      uses: jwlawson/actions-setup-cmake@v2
      with:
        cmake-version: '3.31.6'

   # 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: Install HDF5
      run: |
        wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.3/src/hdf5-1.14.3.tar.gz -O- | tar --no-same-owner -xz;
        cd hdf5-1.14.3/
        mkdir build && cd build
        #CC=`which mpicc` CXX=`which mpicxx` ./configure --prefix=${{github.workspace}}/local --enable-parallel --enable-shared --enable-cxx
        CC=`which mpicc` CXX=`which mpicxx` cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -DHDF5_ENABLE_PARALLEL:BOOL=ON -DALLOW_UNSUPPORTED:BOOL=ON -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=ON -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF
        make -j2 install

    - 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:
      dependencies
    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: Setup cmake
      uses: jwlawson/actions-setup-cmake@v2
      with:
        cmake-version: '3.31.6'

    - 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
        #export PATH=${{github.workspace}}/local:$PATH
        mkdir -p ${{github.workspace}}/build
        cd ${{github.workspace}}/build
        cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Donnxrt=ON -Dhdf5=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

  examples_benchmarks:
    needs:
      dependencies
    name: examples_benchmarks (${{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"
          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"
            - os: ubuntu-22.04
              mpi: "OFF"
    steps:
    - uses: actions/checkout@v4

    - uses: actions/download-artifact@v4
      with:
        name: dependencies-${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }}

    - name: Setup cmake
      uses: jwlawson/actions-setup-cmake@v2
      with:
        cmake-version: '3.31.6'

    - 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
        wget https://github.com/google/benchmark/archive/refs/tags/v1.8.5.tar.gz -O- | tar --no-same-owner -xz;
        cd benchmark-1.8.5
        cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -S . -B "build"
        cmake --build "build" --config Release --target install

    - name: Install Dependencies on MacOS
      if: ${{ contains(matrix.os, 'macos') }}
      run: |
        brew install open-mpi libomp eigen ccache cfitsio boost yaml-cpp onnxruntime google-benchmark
        echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
        echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH

    - name: Build examples
      # 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 -Dhdf5=ON -Ddocasa=OFF -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}} -Dtests=OFF -Dexamples=ON -Dbenchmarks=ON
        make -j$(nproc --ignore 1) install


  doc:
    needs:
      dependencies
    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: Setup cmake
      uses: jwlawson/actions-setup-cmake@v2
      with:
        cmake-version: '3.31.6'

    - 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 -Dhdf5=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/github-pages-deploy-action@4.1.6
      with:
        branch: gh-pages # The branch the action should deploy to.
        folder: build/cpp/docs/html # The folder the action should deploy.