-
Notifications
You must be signed in to change notification settings - Fork 18
179 lines (177 loc) · 7.62 KB
/
c-cpp.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
name: native
on:
push:
branches: [master]
paths-ignore:
- 'docker/Dockerfile'
- 'docker/*yml'
- '**.md'
- 'VirtualBox/**'
- '.github/workflows/*docker*'
- 'CITATION.cff'
- '.mailmap'
- 'NOTICE.txt'
- 'LICENSE.txt'
pull_request:
branches: [master]
paths-ignore:
- 'docker/Dockerfile'
- '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:
build-test:
runs-on: ${{ matrix.os }}
defaults: {run: {shell: 'bash -el {0}'}}
env:
COMPILER: gcc
BUILD_TYPE: Release
strategy:
matrix:
include:
- os: ubuntu-latest
compiler_version: 9
EXTRA_BUILD_FLAGS: "-DUSE_ITK=ON -DBUILD_CIL=ON -DUSE_SYSTEM_Armadillo=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DBUILD_siemens_to_ismrmrd=ON -DUSE_SYSTEM_SWIG=ON"
DEVEL_BUILD: "OFF"
- os: ubuntu-latest
compiler_version: 9
EXTRA_BUILD_FLAGS: "-DUSE_ITK=ON -DBUILD_CIL=ON -DUSE_SYSTEM_Armadillo=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=OFF -DUSE_SYSTEM_HDF5=OFF -DBUILD_siemens_to_ismrmrd=ON -DUSE_SYSTEM_SWIG=OFF"
DEVEL_BUILD: "OFF"
#- os: ubuntu-latest
# compiler_version: 9
# EXTRA_BUILD_FLAGS: "-DUSE_ITK=ON -DBUILD_CIL=ON -DUSE_SYSTEM_Armadillo=ON -DUSE_SYSTEM_Boost=OFF -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DBUILD_siemens_to_ismrmrd=ON -DUSE_SYSTEM_SWIG=ON"
# DEVEL_BUILD: "OFF"
- os: ubuntu-latest
compiler_version: 9
EXTRA_BUILD_FLAGS: "-DUSE_ITK=ON -DBUILD_CIL=ON -DUSE_SYSTEM_Armadillo=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DBUILD_siemens_to_ismrmrd=ON -DUSE_SYSTEM_SWIG=ON -DUSE_SYSTEM_GTest=OFF"
DEVEL_BUILD: "OFF"
- os: ubuntu-latest
compiler_version: 11
EXTRA_BUILD_FLAGS: "-DUSE_ITK=ON -DBUILD_CIL=ON -DUSE_SYSTEM_Armadillo=OFF -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DBUILD_siemens_to_ismrmrd=ON -DUSE_SYSTEM_SWIG=ON -DUSE_ROOT:BOOL=ON -DUSE_SYSTEM_ROOT=ON -DSIRF_EXTRA_CMAKE_ARGS=-DCMAKE_POLICY_DEFAULT_CMP0074=NEW" # note: SIRF needs CMP0074 with older versions of pre-built ROOT (see below)
DEVEL_BUILD: "ON"
- os: ubuntu-latest
compiler_version: 11
EXTRA_BUILD_FLAGS: "-DUSE_ITK=ON -DBUILD_CIL=ON -DUSE_SYSTEM_Armadillo=OFF -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DBUILD_siemens_to_ismrmrd=ON -DUSE_SYSTEM_SWIG=ON -DUSE_ROOT:BOOL=ON -DUSE_SYSTEM_ROOT=ON -DSIRF_EXTRA_CMAKE_ARGS=-DCMAKE_POLICY_DEFAULT_CMP0074=NEW" # note: SIRF needs CMP0074 with older versions of pre-built ROOT (see below)
DEVEL_BUILD: "OFF"
fail-fast: false # don't terminate matrix if one job fails
steps:
- uses: actions/checkout@v4
- if: contains(matrix.os, fromJSON('["ubuntu","macos"]'))
name: increase disk space
run: sudo .github/workflows/GHA_increase_disk_space.sh
- id: deps
name: install dependencies
working-directory: docker
run: |
sudo ./raw-ubuntu.sh
sudo ./build_system-ubuntu.sh
sudo ./build_essential-ubuntu.sh
sudo ./build_gadgetron-ubuntu.sh
sudo ./build_python-ubuntu.sh
echo "python-version=$(python3 --version | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: optionally install ROOT
env:
EXTRA_BUILD_FLAGS: ${{ matrix.EXTRA_BUILD_FLAGS }}
run: |
sh -ex
if expr match "${EXTRA_BUILD_FLAGS}" ".*-DUSE_SYSTEM_ROOT=ON.*" >/dev/null
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: actions/setup-python@v5
with:
python-version: '${{ steps.deps.outputs.python-version }}'
cache: pip
- name: pip install
working-directory: docker
run: PYTHON_EXECUTABLE=python3 PYTHON_INSTALL_DIR="$HOME/virtualenv" ./user_python-ubuntu.sh
- uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os }}-${{ env.COMPILER }}-${{ matrix.compiler_version }}-${{ env.BUILD_TYPE }}-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
${{ matrix.os }}-${{ env.COMPILER }}-${{ matrix.compiler_version }}-${{ env.BUILD_TYPE }}-${{ github.ref_name }}
${{ matrix.os }}-${{ env.COMPILER }}-${{ matrix.compiler_version }}-${{ 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.compiler_version }}'; then
CC=${CC}-${{ matrix.compiler_version }}
CXX=${CXX}-${{ matrix.compiler_version }}
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:
EXTRA_BUILD_FLAGS: ${{ matrix.EXTRA_BUILD_FLAGS }}
CMAKE_BUILD_TYPE: ${{ env.BUILD_TYPE }}
DEVEL_BUILD: "-DDEVEL_BUILD=${{ matrix.DEVEL_BUILD }}"
run: |
set -ex
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
export superbuild=`pwd`
export BUILD_FLAGS="-DCMAKE_INSTALL_PREFIX=~/install -DPYVER=3 -DUSE_SYSTEM_RocksDB=OFF -DBUILD_TESTING_Gadgetron:BOOL=ON"
source ~/virtualenv/bin/activate
cmake -S ${GITHUB_WORKSPACE} -B ./build ${BUILD_FLAGS} ${EXTRA_BUILD_FLAGS} ${DEVEL_BUILD};
- name: cmake --build
run: |
source ~/virtualenv/bin/activate
cmake --build ./build -j 2
# 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@v4
with:
name: build_log_files-${{ matrix.os }}-${{ env.COMPILER }}${{ matrix.compiler_version }}-${{ env.BUILD_TYPE }}-DEVEL=${{ matrix.DEVEL_BUILD }}
path: ${{ github.workspace }}/build/**/*.log
retention-days: 7
- name: ctest
run: ./docker/ctest_sirf.sh