-
Notifications
You must be signed in to change notification settings - Fork 328
178 lines (161 loc) · 6.47 KB
/
build-macos-homebrew.yaml
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
name: build-macos-homebrew
on:
workflow_dispatch:
push:
paths-ignore:
- '**.nix'
- 'flake.lock'
pull_request:
paths-ignore:
- '**.nix'
- 'flake.lock'
concurrency: ci-macos-homebrew-${{ github.ref }}
jobs:
macos-homebrew:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} (${{ matrix.openmp }} OpenMP)
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
os: [macos-14]
openmp: [without]
# Building with OpenMP causes some test failures on macOS on Apple
# Silicon.
# The affected tests currently are: H1BasisEvaluation and
# SD_H1BasisEvaluation.
# For the time being, disable building with OpenMP in CI on Apple
# Silicon.
# OpenMP is also needed as a transitional build dependency of the
# SuiteSparse package from Homebrew.
# FIXME: Consider building with OpenMP again when this (potentially
# upstream) issue has been fixed.
include:
- os: macos-13
openmp: with
steps:
- name: get CPU information
run: |
sysctl hw
sysctl machdep
- name: checkout repository
uses: actions/checkout@v4
- name: install dependencies
# Homebrew's Python conflicts with the Python that comes pre-installed
# on the GitHub runners. Some of the dependencies depend on different
# versions of Homebrew's Python. Enforce using the ones from Homebrew
# to avoid errors on updates.
# See: https://github.com/orgs/Homebrew/discussions/3928
# It looks like "gfortran" isn't working correctly unless "gcc" is
# re-installed.
run: |
brew update
brew install --overwrite [email protected] [email protected]
brew reinstall gcc
brew install \
cmake openblas open-mpi \
${{ matrix.openmp == 'with' && 'libomp suitesparse' || '' }} \
qwt vtk opencascade
echo "HOMEBREW_PREFIX=$(brew --prefix)" >> $GITHUB_ENV
- name: configure
env:
LDFLAGS: ${{ matrix.openmp == 'with' && format('-L{0}/opt/libomp/lib -lomp', env.HOMEBREW_PREFIX) || '' }}
# The tests `SD_H1BasisEvaluation` and `SD_LinearFormsAssembly` are
# failing on macos-13 (Intel CPU) at optimization level `-O3`.
# They are passing if ElmerFEM is built with optimization level `-O2`.
run: |
mkdir ${GITHUB_WORKSPACE}/build
cd ${GITHUB_WORKSPACE}/build
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.os == 'macos-13' && 'RelWithDebInfo' || 'Release' }} \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/usr" \
-DBLA_VENDOR="OpenBLAS" \
-DUSE_MACOS_PACKAGE_MANAGER=OFF \
-DCMAKE_PREFIX_PATH="$( [ "${{ matrix.openmp }}" == "with" ] && echo "${HOMEBREW_PREFIX}/opt/libomp;")${HOMEBREW_PREFIX}/opt/openblas;${HOMEBREW_PREFIX}/opt/qt;${HOMEBREW_PREFIX}/opt/qwt" \
${{ matrix.openmp == 'with'
&& '-DWITH_OpenMP=ON \
-DOpenMP_C_FLAGS="-Xclang -fopenmp -I${HOMEBREW_PREFIX}/opt/libomp/include" \
-DOpenMP_CXX_FLAGS="-Xclang -fopenmp -I${HOMEBREW_PREFIX}/opt/libomp/include" \
-DOpenMP_Fortran_FLAGS="-fopenmp -I${HOMEBREW_PREFIX}/opt/libomp/include"'
|| '-DWITH_OpenMP=OFF' }} \
-DWITH_LUA=ON \
-DWITH_MPI=ON \
-DMPI_TEST_MAXPROC=2 \
-DWITH_Zoltan=OFF \
-DWITH_Mumps=OFF \
-DWITH_CHOLMOD=${{ matrix.openmp == 'with' && 'ON' || 'OFF' }} \
-DWITH_ElmerIce=ON \
-DWITH_ELMERGUI=ON \
-DWITH_QT6=ON \
-DQWT_INCLUDE_DIR="${HOMEBREW_PREFIX}/opt/qwt/lib/qwt.framework/Headers" \
-DWITH_VTK=ON \
-DWITH_OCC=ON \
-DWITH_MATC=ON \
-DWITH_PARAVIEW=ON \
-DCREATE_PKGCONFIG_FILE=ON \
..
- name: build
run: |
cd ${GITHUB_WORKSPACE}/build
cmake --build . -j$(sysctl -n hw.logicalcpu)
- name: install
run: |
cd ${GITHUB_WORKSPACE}/build
cmake --install .
- name: check
id: run-ctest
timeout-minutes: 150
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cd ${GITHUB_WORKSPACE}/build
ctest . \
-LE slow \
-j$(sysctl -n hw.logicalcpu) \
--timeout 300
- name: re-run tests
if: always() && (steps.run-ctest.outcome == 'failure')
timeout-minutes: 60
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cd ${GITHUB_WORKSPACE}/build
# get names of failed tests and strip potential "_np*" suffix
failed_tests=($(ctest . -N --rerun-failed | grep -E "Test\s+#.*" | awk '{print $3}' | sed -e 's/_np[0-9]*$//g'))
# remove duplicate test names
unique_failed_tests=($(echo "${failed_tests[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))
for test in "${unique_failed_tests[@]}"; do
# check if test is from fem or ElmerIce
if [ -d fem/tests/${test} ]; then
test_root=fem/tests
else
test_root=elmerice/Tests
fi
echo "::group::Content of ${test_root}/${test}"
echo ---- Files ----
ls -Rl ${test_root}/${test}
if [ -f ${test_root}/${test}/test-stderr*.log ]; then
err_logs=($(ls ${test_root}/${test}/test-stderr*.log))
for err_log in "${err_logs[@]}"; do
echo ---- Content of ${err_log} ----
cat ${err_log}
done
fi
if [ -f ${test_root}/${test}/test-stdout*.log ]; then
out_logs=($(ls ${test_root}/${test}/test-stdout*.log))
for out_log in "${out_logs[@]}"; do
echo ---- Content of ${out_log} ----
cat ${out_log}
done
fi
echo "::endgroup::"
done
echo "::group::Re-run failing tests"
ctest --rerun-failed --output-on-failure --timeout 180 || true
echo "::endgroup::"
echo "::group::Log from these tests"
[ ! -f Testing/Temporary/LastTest.log ] || cat Testing/Temporary/LastTest.log
echo "::endgroup::"