-
Notifications
You must be signed in to change notification settings - Fork 19
180 lines (180 loc) · 7.67 KB
/
Copy pathc-cpp.yml
File metadata and controls
180 lines (180 loc) · 7.67 KB
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
name: native
on:
push:
branches: [master]
paths-ignore:
- 'docker/Dockerfile'
- 'docker/docker*.yml'
- '**.md'
- 'VirtualBox/**'
- '.github/workflows/*docker*'
- 'CITATION.cff'
- '.mailmap'
- 'NOTICE.txt'
- 'LICENSE.txt'
pull_request:
branches: [master]
paths-ignore:
- 'docker/Dockerfile'
- 'docker/docker*.yml'
- '**.md'
- 'VirtualBox/**'
- '.github/workflows/*docker*'
- 'CITATION.cff'
- '.mailmap'
- 'NOTICE.txt'
- 'LICENSE.txt'
workflow_dispatch:
inputs:
tmate:
description: Debug with tmate ssh session
type: boolean
default: false
required: true
jobs:
test:
runs-on: ${{ matrix.os }}
defaults: {run: {shell: 'bash -el {0}'}}
env:
COMPILER: gcc
BUILD_TYPE: Release
strategy:
matrix:
include:
- cxx-ver: 9
flags: -devel -armadillo -boost -fftw3 +hdf5 -swig
os: ubuntu-22.04
- cxx-ver: 9
flags: -devel -armadillo -boost +fftw3 +hdf5 +swig
os: ubuntu-22.04
#- cxx-ver: 9
# flags: -devel -armadillo +boost -fftw3 +hdf5 -swig
# os: ubuntu-latest
- cxx-ver: 9
flags: -devel -armadillo -boost -fftw3 +hdf5 -swig +gtest
os: ubuntu-22.04
- cxx-ver: 11
flags: +devel +armadillo -boost -fftw3 +hdf5 -swig -root
os: ubuntu-22.04
- cxx-ver: 11
flags: -devel +armadillo -boost -fftw3 +hdf5 -swig -root
os: ubuntu-22.04
fail-fast: false # don't terminate matrix if one job fails
steps:
- uses: actions/checkout@v6
- if: contains(matrix.os, fromJSON('["ubuntu","macos"]'))
name: increase disk space
run: sudo .github/workflows/GHA_increase_disk_space.sh
- uses: conda-incubator/setup-miniconda@v4
with:
auto-activate: true
activate-environment: ""
channels: conda-forge,defaults
mamba-version: "*"
- id: deps
name: install dependencies
working-directory: docker
run: |
conda env update -n base -f requirements.yml
echo "Python_ROOT_DIR=$CONDA_PREFIX" >> $GITHUB_ENV
echo "Python3_ROOT_DIR=$CONDA_PREFIX" >> $GITHUB_ENV
sudo ./raw-ubuntu.sh
sudo ./build_system-ubuntu.sh
sudo ./build_essential-ubuntu.sh
sudo ./build_gadgetron-ubuntu.sh
- name: optionally install ROOT
run: |
sh -ex
if [[ " ${{ matrix.flags }} " =~ " -root " ]]; then
# Install ROOT (warning: currently only valid on Ubuntu)
ROOT_file=root_v6.28.12.Linux-ubuntu20-x86_64-gcc9.4.tar.gz
wget https://root.cern/download/"$ROOT_file"
tar -xzf "$ROOT_file"
rm "$ROOT_file"
source root/bin/thisroot.sh
echo ROOT_DIR="$ROOTSYS/cmake" >> $GITHUB_ENV
echo ROOTSYS="$ROOTSYS" >> $GITHUB_ENV
echo
# work-around problem with problem with Vdt for ROOT version pre-6.30.04 as per https://github.com/root-project/root/pull/14178
echo Vdt_ROOT="$ROOTSYS" >> $GITHUB_ENV
# thisroot modifies the following
case ${{matrix.os}} in
(ubuntu*)
echo LD_LIBRARY_PATH="${CMAKE_INSTALL_PREFIX}/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo PATH="$PATH" >> $GITHUB_ENV
;;
(macOS*) # future-proof
echo DYLD_FALLBACK_LIBRARY_PATH="${CMAKE_INSTALL_PREFIX}/lib:$DYLD_FALLBACK_LIBRARY_PATH" >> $GITHUB_ENV
echo PATH="$PATH" >> $GITHUB_ENV
;;
(windows*) # future-proof
echo PATH="${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/bin:$PATH" >> $GITHUB_ENV
;;
esac
fi
- uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os }}-${{ env.COMPILER }}-${{ matrix.cxx-ver }}-${{ env.BUILD_TYPE }}-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
${{ matrix.os }}-${{ env.COMPILER }}-${{ matrix.cxx-ver }}-${{ env.BUILD_TYPE }}-${{ github.ref_name }}
${{ matrix.os }}-${{ env.COMPILER }}-${{ matrix.cxx-ver }}-${{ env.BUILD_TYPE }}
append-timestamp: false
- name: export CC CXX
run: |
set -ex
if test '${{ env.COMPILER }}' = clang; then
CC=clang
CXX=clang++
elif test '${{ env.COMPILER }}' = gcc; then
CC=gcc
CXX=g++
fi
if test -n '${{ matrix.cxx-ver }}'; then
CC=${CC}-${{ matrix.cxx-ver }}
CXX=${CXX}-${{ matrix.cxx-ver }}
sudo apt install -yq ${CXX} ${CC}
fi
# make available to jobs below
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
- name: cmake -S .
env:
CMAKE_BUILD_TYPE: ${{ env.BUILD_TYPE }}
run: |
set -ex
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
export superbuild=`pwd`
BUILD_FLAGS="-DCMAKE_INSTALL_PREFIX=~/install -DPYVER=3 -DUSE_SYSTEM_RocksDB:BOOL=OFF -DBUILD_TESTING_Gadgetron:BOOL=ON -DSTIR_DISABLE_HDF5:BOOL=ON -DUSE_ITK:BOOL=ON -DBUILD_CIL:BOOL=ON -DBUILD_siemens_to_ismrmrd:BOOL=ON"
[[ " ${{ matrix.flags }} " =~ " +armadillo " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_Armadillo:BOOL=OFF"
[[ " ${{ matrix.flags }} " =~ " -armadillo " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_Armadillo:BOOL=ON"
[[ " ${{ matrix.flags }} " =~ " +boost " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_Boost:BOOL=OFF"
[[ " ${{ matrix.flags }} " =~ " -boost " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_Boost:BOOL=ON"
[[ " ${{ matrix.flags }} " =~ " +fftw3 " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_FFTW3:BOOL=OFF"
[[ " ${{ matrix.flags }} " =~ " -fftw3 " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_FFTW3:BOOL=ON"
[[ " ${{ matrix.flags }} " =~ " +hdf5 " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_HDF5:BOOL=OFF"
[[ " ${{ matrix.flags }} " =~ " -hdf5 " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_HDF5:BOOL=ON"
[[ " ${{ matrix.flags }} " =~ " +swig " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_SWIG:BOOL=OFF"
[[ " ${{ matrix.flags }} " =~ " -swig " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_SWIG:BOOL=ON"
[[ " ${{ matrix.flags }} " =~ " +gtest " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_GTest:BOOL=OFF"
[[ " ${{ matrix.flags }} " =~ " -gtest " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_SYSTEM_GTest:BOOL=ON"
# note: SIRF needs CMP0074 with older versions of pre-built ROOT (see above)
[[ " ${{ matrix.flags }} " =~ " -root " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DUSE_ROOT:BOOL=ON -DUSE_SYSTEM_ROOT:BOOL=ON -DSIRF_EXTRA_CMAKE_ARGS=-DCMAKE_POLICY_DEFAULT_CMP0074=NEW"
[[ " ${{ matrix.flags }} " =~ " +devel " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DDEVEL_BUILD:BOOL=ON"
[[ " ${{ matrix.flags }} " =~ " -devel " ]] && BUILD_FLAGS="${BUILD_FLAGS} -DDEVEL_BUILD:BOOL=OFF"
cmake -G Ninja -S ${GITHUB_WORKSPACE} -B ./build ${BUILD_FLAGS}
- run: cmake --build ./build
# tmate ssh debugging
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.tmate == 'true'
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
- if: failure()
name: Upload build log files for debugging
uses: actions/upload-artifact@v7
with:
name: logs-${{ matrix.cxx-ver }}-${{ matrix.flags }}-${{ matrix.os }}
path: ${{ github.workspace }}/build/**/*.log
retention-days: 7
- name: pip install torch
run: pip install torch --index-url https://download.pytorch.org/whl/cpu
- name: ctest
run: ./docker/ctest_sirf.sh