-
Notifications
You must be signed in to change notification settings - Fork 15
180 lines (165 loc) · 5.34 KB
/
build-test.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
name: Build and ctest and recon_test_pack CI
on:
push:
branches:
- master
paths-ignore:
- 'appveyor.yml'
- 'azure-pipelines.yml'
- 'CITATION.cff'
- '**/*.md'
- '**/*.html'
- '**/*.htm'
- '**/*.tex'
pull_request:
branches:
- master
paths-ignore:
- 'appveyor.yml'
- 'azure-pipelines.yml'
- 'CITATION.cff'
- '**/*.md'
- '**/*.html'
- '**/*.htm'
- '**/*.tex'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
compiler: gcc
compiler_version: 9
BUILD_TYPE: "Release"
- os: ubuntu-latest
compiler: gcc
compiler_version: 9
BUILD_TYPE: "Debug"
- os: ubuntu-latest
compiler: gcc
compiler_version: 12
BUILD_TYPE: "Release"
- os: ubuntu-latest
compiler: clang
BUILD_TYPE: "Release"
# let's run all of them, as opposed to aborting when one fails
fail-fast: false
name: ${{ matrix.os }}-${{ matrix.compiler }}${{ matrix.compiler_version }}-${{ matrix.BUILD_TYPE }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: set_compiler_variables
shell: bash
run: |
set -ex
if test 'XX${{ matrix.compiler }}' = 'XXclang'; then
CC="clang"
CXX="clang++"
elif test 'XX${{ matrix.compiler }}' = 'XXgcc'; then
CC="gcc"
CXX="g++"
fi
if test 'XX${{ matrix.compiler_version }}' != 'XX'; then
CC=${CC}-${{ matrix.compiler_version }}
CXX=${CXX}-${{ matrix.compiler_version }}
fi
if test 'XX${{ matrix.os }}' = 'XXmacOS-latest'; then
if test 'XX${{ matrix.compiler }}' = 'XXclang'; then
brew install llvm@${{ matrix.compiler_version }}
if test XX${HOMEBREW_PREFIX} = XX; then
HOMEBREW_PREFIX=/usr/local
fi
LDFLAGS="-L$HOMEBREW_PREFIX/opt/llvm/lib/c++ -Wl,-rpath,$HOMEBREW_PREFIX/opt/llvm/lib/c++"
# make available to jobs below
echo LDFLAGS="$LDFLAGS" >> $GITHUB_ENV
CC="$HOMEBREW_PREFIX/opt/llvm/bin/clang"
CXX="$HOMEBREW_PREFIX/opt/llvm/bin/clang++"
fi
fi
export CC CXX
# make available to jobs below
echo CC="$CC" >> $GITHUB_ENV
echo CXX="$CXX" >> $GITHUB_ENV
- name: install_dependencies
shell: bash
run: |
set -ex
# We will install some external dependencies here
CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install
case ${{matrix.os}} in
(ubuntu*)
sudo apt update
# install compiler
if test 'XX${{ matrix.compiler }}' = 'XXclang'; then
# package is called clang, need libomp-dev for OpenMP support
sudo apt install $CC libomp-dev
else
sudo apt install $CXX
fi
# other dependencies
# note: v5 is distributed without the REVIEW module
sudo apt install libinsighttoolkit4-dev
;;
(macOS*)
brew install itk
;;
esac
echo PYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" >> $GITHUB_ENV
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os }}-${{ matrix.compiler }}${{ matrix.compiler_version }}-${{ matrix.BUILD_TYPE }}
- name: configure
shell: bash
env:
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
BUILD_FLAGS: ${{ matrix.BUILD_FLAGS }}
run: |
set -ex
cmake --version
if test "XX$CC" != "XX"; then
$CC --version
$CXX --version
fi
CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install
# make available to jobs below
echo CMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" >> $GITHUB_ENV
EXTRA_BUILD_FLAGS="-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
echo "cmake flags $BUILD_FLAGS $EXTRA_BUILD_FLAGS"
mkdir build
cd build
cmake -S .. ${BUILD_FLAGS} ${EXTRA_BUILD_FLAGS}
- name: build
shell: bash
env:
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
run: |
cd ${GITHUB_WORKSPACE}/build;
cmake --build . -j 2 --config ${BUILD_TYPE}} --target install
- name: ctest
shell: bash
env:
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
run: |
set -vx
cd ${GITHUB_WORKSPACE}/build
ctest --output-on-failure -C ${BUILD_TYPE}
- name: Upload ctest log files for debugging
uses: actions/upload-artifact@v4
if: failure()
with:
name: ctest_log_files-${{ matrix.os }}-${{ matrix.compiler }}${{ matrix.compiler_version }}-${{ matrix.BUILD_TYPE }}
path: |
${{ github.workspace }}/build/**/*.log
retention-days: 7
- name: CPack
shell: bash
env:
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
run: |
set -vx
cd ${GITHUB_WORKSPACE}/build
cpack
# outputs PETPVC-1.*.*.sh, .tar.gz and .tar.Z