forked from libprima/prima
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.cirrus.yml
More file actions
201 lines (164 loc) · 7.2 KB
/
.cirrus.yml
File metadata and controls
201 lines (164 loc) · 7.2 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
task:
name: "Cirrus tests"
# Circus CI will shut down on Monday, June 1, 2026. See https://cirruslabs.org/ for details.
#
# Status as of 20260226:
#
# - All tests pass on Debian and Fedora, including both AMD64 and ARM64.
#
# - The tests pass on AMD64 FreeBSD. However, cmake_test_script with LLVM 22 needs the following:
# export LDFLAGS="-Wl,-z,execstack"
# Otherwise, the error message is like
# "ld: error: CMakeFiles/primac.dir/uobyqa_c.f90.o: requires an executable stack, but -z execstack is not specified"
# In contrast, cmake_test_script passes on Linux with gcc with
# export LDFLAGS="-Wl,-z,noexecstack"
# if FFLAGS contains --ftrampoline-impl=heap.
# This means that an executable stack is not generated on Linux with gcc, but is generated on FreeBSD with LLVM. Why?
#
# - cmake_test_script fails on AMD64 Alpine when testing example_SOLVER_c and SOLVER_data_c.
# The error message is like
# ```
# Program received signal SIGABRT, Aborted.
# __restore_sigs (set=set@entry=0x7fffffffd8a0) at ./arch/x86_64/syscall_arch.h:40
# warning: 40 ./arch/x86_64/syscall_arch.h: No such file or directory
# ```
# On the other hand, the test works fine on ARM64 Alpine.
#
# Perform the task only if the folders or files specified below are changed
# See https://cirrus-ci.org/guide/writing-tasks/#conditional-task-execution
## skip: the task will be created / triggered, but its execution will be skipped, and it will be marked as successful.
##skip: "!changesInclude('.cirrus.yml', 'fortran/**', 'c/**', 'python/**')"
## only_if: the task will not be created / triggered.
##only_if: "changesInclude('.cirrus.yml', 'CMakeLists.txt', 'fortran/**', 'c/**', 'python/**')"
timeout_in: 120m # There is a hard limit of 2 hours for free tasks.
matrix: # We test the platforms not available on GitHub Actions.
- name: AMD64 Debian
container:
image: debian:latest
- name: ARM64 Debian
arm_container:
image: debian:latest
- name: AMD64 Fedora
container:
image: fedora:latest
- name: ARM64 Fedora
arm_container:
image: fedora:latest
- name: AMD64 Alpine
container:
image: alpine:latest
- name: ARM64 Alpine
arm_container:
image: alpine:latest
- name: AMD64 FreeBSD
freebsd_instance:
#image_family: freebsd-16-0-snap # INVALID_ARGUMENT: Snap images are not supported due to boot stability.
image_family: freebsd-15-0-amd64-ufs
architecture: amd64
# The following seems not available as of 20260222. See
# https://github.com/cirruslabs/cirrus-ci-docs/issues/906
# https://cirrus-ci.com/task/6720657520590848
# - name: ARM64 FreeBSD
# freebsd_instance:
# image_family: freebsd-14-0
# architecture: arm64
dependencies_script: |
set -euo pipefail
echo "MK=make" >> $CIRRUS_ENV
uname -a
cat /etc/os-release || true
if [ "$(uname)" = FreeBSD ] ; then
pkg update && pkg upgrade -y && pkg install -y bash gcc git cmake devel/gmake devel/gdb llvm-devel
echo "MK=gmake" >> $CIRRUS_ENV
export PATH=/usr/local/llvm-devel/bin:$PATH
echo "PATH=$PATH" >> $CIRRUS_ENV
type clang && clang --version
type flang && flang --version
elif grep -qi "fedora" /etc/os-release ; then
dnf upgrade -y && dnf install -y gcc git make cmake gfortran gdb libasan libubsan
elif grep -qi "alpine" /etc/os-release ; then
apk update && apk upgrade && apk add musl-dev gcc git make cmake gfortran gdb bash musl-dbg
else
apt update && apt upgrade -y && apt install -y gcc git make cmake gfortran gdb
fi
type gcc && gcc --version
type gfortran && gfortran --version
type cmake && cmake --version
type gdb && gdb --version
fortran_example_script: |
ROOT_DIR=$(git rev-parse --show-toplevel)
for SOLVER in uobyqa newuoa bobyqa lincoa cobyla ; do
cd $ROOT_DIR/fortran/examples/$SOLVER
export EXAMPLE_NUM=1 && $MK gtest
export EXAMPLE_NUM=2 && $MK gtest
if type flang &> /dev/null ; then
export EXAMPLE_NUM=1 && $MK ftest
export EXAMPLE_NUM=2 && $MK ftest
fi
done
cmake_test_script: |
if [ "$(uname -m)" = x86_64 ] && grep -qi "alpine" /etc/os-release ; then
echo "WARNING: CMake test is skipped on AMD64 Alpine." >&2
echo "The current CMake test fails on AMD64 Alpine; should investigate the issue and fix it." >&2
exit 0
fi
ROOT_DIR=$(git rev-parse --show-toplevel)
cd $ROOT_DIR
if [ "$(uname)" = FreeBSD ] ; then
# See https://github.com/libprima/prima/issues/275 for why we use clang and flang on FreeBSD,
# and gcc and gfortran on Linux.
export CC=clang
export CFLAGS="-Wall -Werror"
export FC=flang
export FFLAGS="-Werror -fimplicit-none -pedantic"
export LDFLAGS="-Wl,-z,execstack" # Executable stack is necessary. This is needed as of LLVM 22
else
export CC=gcc
export CFLAGS="-Wall -Wextra -Wpedantic -Werror"
export FC=gfortran
export FFLAGS="-Wall -Wextra -Wpedantic -Werror -fimplicit-none -ftrampoline-impl=heap -frecursive -fcheck=all -fstack-check -Wno-function-elimination"
export LDFLAGS="-Wl,-z,noexecstack" # No executable stack is needed. This is possible with gcc 14+
fi
$FC --version
$CC --version
cmake --version
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=. -LAH -DCMAKE_C_FLAGS="${CFLAGS}" -DCMAKE_Fortran_FLAGS="${FFLAGS}" .
cmake --build . --target install
cmake --build . --target tests
ctest --output-on-failure -V -E stress
fortran_test_script: |
ROOT_DIR=$(git rev-parse --show-toplevel)
cd $ROOT_DIR/fortran/tests
# Decide the solver to test by $(date + %N)
NS=$(date +%N)
NS=${NS#"${NS%%[!0]*}"} # Strip leading zeros, or the shell will interpret the number as octal and fail if it contains digits 8 or 9.
SOLVER_NUM=$((${NS:-0} % 5)) # Use 0 if completely empty
if [ $SOLVER_NUM -eq 0 ] ; then
SOLVER=uobyqa
elif [ $SOLVER_NUM -eq 1 ] ; then
SOLVER=newuoa
elif [ $SOLVER_NUM -eq 2 ] ; then
SOLVER=bobyqa
elif [ $SOLVER_NUM -eq 3 ] ; then
SOLVER=lincoa
else
SOLVER=cobyla
fi
echo $SOLVER_NUM $SOLVER
# Decide the integer kind to test by $(date +%N)
NS=$(date +%N)
NS=${NS#"${NS%%[!0]*}"} # Strip leading zeros, or the shell will interpret the number as octal and fail if it contains digits 8 or 9.
IK=$((2**((${NS:-0} % 3) + 1))) # Use 0 if completely empty
echo $IK
# Decide the real kind to test by $(date +%N)
NS=$(date +%N)
NS=${NS#"${NS%%[!0]*}"} # Strip leading zeros, or the shell will interpret the number as octal and fail if it contains digits 8 or 9.
RK=$((2**((${NS:-0} % 3) + 2))) # Use 0 if completely empty
echo $RK
$MK clean && $MK gtest_i${IK}_r${RK}_d1_tst.$SOLVER
if type flang &> /dev/null ; then
RK=$((2**((${NS:-0} % 2) + 2))) # Use 0 if completely empty; LLVM flang does not support RK=16 as of LLVM 22.1.0
echo $RK
$MK clean && $MK ftest_i${IK}_r${RK}_d1_tst.$SOLVER
fi
on_failure: