1+ name : Build and ctest and recon_test_pack CI
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ paths-ignore :
8+ - ' .appveyor.yml'
9+ - ' CITATION.cff'
10+ - ' **/*.md'
11+ - ' **/*.html'
12+ - ' **/*.htm'
13+ - ' **/*.tex'
14+
15+ pull_request :
16+ branches :
17+ - master
18+ paths-ignore :
19+ - ' .appveyor.yml'
20+ - ' CITATION.cff'
21+ - ' **/*.md'
22+ - ' **/*.html'
23+ - ' **/*.htm'
24+ - ' **/*.tex'
25+
26+ jobs :
27+ build :
28+
29+ runs-on : ${{ matrix.os }}
30+ strategy :
31+ matrix :
32+ include :
33+ - os : ubuntu-latest
34+ compiler : gcc
35+ compiler_version : 9
36+ BUILD_TYPE : " Release"
37+ - os : ubuntu-latest
38+ compiler : gcc
39+ compiler_version : 9
40+ BUILD_TYPE : " Debug"
41+ - os : ubuntu-latest
42+ compiler : gcc
43+ compiler_version : 13
44+ BUILD_TYPE : " Release"
45+ - os : ubuntu-latest
46+ compiler : clang
47+ BUILD_TYPE : " Release"
48+
49+ # let's run all of them, as opposed to aborting when one fails
50+ fail-fast : false
51+
52+ name : ${{ matrix.os }}-${{ matrix.compiler }}${{ matrix.compiler_version }}-${{ matrix.BUILD_TYPE }}
53+
54+ steps :
55+ - uses : actions/checkout@v4
56+ with :
57+ submodules : recursive
58+
59+ - name : set_compiler_variables
60+ shell : bash
61+ run : |
62+ set -ex
63+ if test 'XX${{ matrix.compiler }}' = 'XXclang'; then
64+ CC="clang"
65+ CXX="clang++"
66+ elif test 'XX${{ matrix.compiler }}' = 'XXgcc'; then
67+ CC="gcc"
68+ CXX="g++"
69+ fi
70+ if test 'XX${{ matrix.compiler_version }}' != 'XX'; then
71+ CC=${CC}-${{ matrix.compiler_version }}
72+ CXX=${CXX}-${{ matrix.compiler_version }}
73+ fi
74+ if test 'XX${{ matrix.os }}' = 'XXmacOS-latest'; then
75+ if test 'XX${{ matrix.compiler }}' = 'XXclang'; then
76+ brew install llvm@${{ matrix.compiler_version }}
77+ if test XX${HOMEBREW_PREFIX} = XX; then
78+ HOMEBREW_PREFIX=/usr/local
79+ fi
80+ LDFLAGS="-L$HOMEBREW_PREFIX/opt/llvm/lib/c++ -Wl,-rpath,$HOMEBREW_PREFIX/opt/llvm/lib/c++"
81+ # make available to jobs below
82+ echo LDFLAGS="$LDFLAGS" >> $GITHUB_ENV
83+ CC="$HOMEBREW_PREFIX/opt/llvm/bin/clang"
84+ CXX="$HOMEBREW_PREFIX/opt/llvm/bin/clang++"
85+ fi
86+ fi
87+ export CC CXX
88+ # make available to jobs below
89+ echo CC="$CC" >> $GITHUB_ENV
90+ echo CXX="$CXX" >> $GITHUB_ENV
91+
92+ - name : install_dependencies
93+ shell : bash
94+ run : |
95+ set -ex
96+ # We will install some external dependencies here
97+ CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install
98+ case ${{matrix.os}} in
99+ (ubuntu*)
100+ sudo apt update
101+ # install compiler
102+ if test 'XX${{ matrix.compiler }}' = 'XXclang'; then
103+ # package is called clang, need libomp-dev for OpenMP support
104+ sudo apt install $CC libomp-dev
105+ else
106+ sudo apt install $CXX
107+ fi
108+ # other dependencies
109+ sudo apt install libinsighttoolkit5-dev
110+ (macOS*)
111+ brew install itk
112+ ;;
113+ esac
114+ echo PYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" >> $GITHUB_ENV
115+
116+ - name : ccache
117+ uses : hendrikmuhs/ccache-action@v1
118+ with :
119+ key : ${{ matrix.os }}-${{ matrix.compiler }}${{ matrix.compiler_version }}-${{ matrix.BUILD_TYPE }}
120+
121+ - name : configure
122+ shell : bash
123+ env :
124+ BUILD_TYPE : ${{ matrix.BUILD_TYPE }}
125+ BUILD_FLAGS : ${{ matrix.BUILD_FLAGS }}
126+ run : |
127+ set -ex
128+ cmake --version
129+ if test "XX$CC" != "XX"; then
130+ $CC --version
131+ $CXX --version
132+ fi
133+ CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install
134+ # make available to jobs below
135+ echo CMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" >> $GITHUB_ENV
136+ EXTRA_BUILD_FLAGS="-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
137+ echo "cmake flags $BUILD_FLAGS $EXTRA_BUILD_FLAGS"
138+ mkdir build
139+ cd build
140+ cmake -S .. ${BUILD_FLAGS} ${EXTRA_BUILD_FLAGS}
141+
142+ - name : build
143+ shell : bash
144+ env :
145+ BUILD_TYPE : ${{ matrix.BUILD_TYPE }}
146+ run : |
147+ cd ${GITHUB_WORKSPACE}/build;
148+ cmake --build . -j 2 --config ${BUILD_TYPE}} --target install
149+
150+ - name : ctest
151+ shell : bash
152+ env :
153+ BUILD_TYPE : ${{ matrix.BUILD_TYPE }}
154+ run : |
155+ set -vx
156+ cd ${GITHUB_WORKSPACE}/build
157+ ctest --output-on-failure -C ${BUILD_TYPE}
158+
159+ - name : Upload ctest log files for debugging
160+ uses : actions/upload-artifact@v4
161+ if : failure()
162+ with :
163+ name : ctest_log_files-${{ matrix.os }}-${{ matrix.compiler }}${{ matrix.compiler_version }}-${{ matrix.BUILD_TYPE }}
164+ path : |
165+ ${{ github.workspace }}/build/**/*.log
166+ retention-days : 7
167+
168+ - name : CPack
169+ shell : bash
170+ env :
171+ BUILD_TYPE : ${{ matrix.BUILD_TYPE }}
172+ run : |
173+ set -vx
174+ cd ${GITHUB_WORKSPACE}/build
175+ cpack
176+
0 commit comments