forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
342 lines (311 loc) · 11.5 KB
/
.cirrus.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
env:
BUILD_DIR: build
container:
memory: 12
cpu: 4
# We store common commands here, so we can reference them in the build jobs below.
commands:
- &print_cmake_options |
printf '—— CMake Config ——\n'
for option; do printf '%s\n' "$option"; done
- &generate | # We need to specify the source directory (`.`) explicitly for Alpine linux (`🔗 Check`).
cmake "$@" -G Ninja -B "$BUILD_DIR" .
- &build cmake --build "$BUILD_DIR"
- &install output="$(cmake --build "$BUILD_DIR" --target install 2>&1)" || printf '%s' "$output"
- &run_tests | # Run tests
if [ "$ENABLE_ASAN" = 'ON' ]; then
cmake --build "$BUILD_DIR" --target run_nocheckshell
else
[ "$BUILD_FULL" = 'ON' ] && KDB=kdb-full || KDB=kdb
# While the command `|| false` is in theory unnecessary, somehow the whole `if`-statement always reports success,
# if we do not add the alternative `false`.
cmake --build "$BUILD_DIR" --target run_all && "$KDB" run_all || false
fi
bsd_task:
matrix:
- name: 😈 FreeBSD 11
freebsd_instance:
image_family: freebsd-11-4
- name: 😈 FreeBSD 12
freebsd_instance:
image_family: freebsd-12-2
- name: 😈 ASAN
freebsd_instance:
image_family: freebsd-12-2
env:
ENABLE_ASAN: ON
install_script:
- >
pkg install -y
bison
cmake
flex
git
libgit2
llvm11
ninja
yajl
yaml-cpp
script:
- > # We use `-std=c11`, since the header `math.h` on FreeBSD requires C11 features
set --
-DCMAKE_C_COMPILER=clang11
-DCMAKE_CXX_COMPILER=clang++11
-DBINDINGS='ALL;-io_glib'
-DINSTALL_SYSTEM_FILES=ON
-DCMAKE_SKIP_INSTALL_RPATH=ON
-DCOMMON_FLAGS=-Werror
-DC_STD=-std=c11
-DENABLE_ASAN="${ENABLE_ASAN:-OFF}"
-DPLUGINS='ALL'
-DTARGET_PLUGIN_FOLDER=''
- *print_cmake_options
- *generate
- *build
- *install
tests_script:
# Work around stalled process plugin and library problems on FreeBSD: https://issues.libelektra.org/2323
- sudo mount -t fdescfs fdesc /dev/fd
- *run_tests
mac_task:
env:
INSTALL_DIR: install
HOMEBREW_NO_INSTALL_CLEANUP: 1
matrix:
- name: 🍎 Clang
osx_instance:
image: big-sur-xcode
env:
ENABLE_LOGGER: ON
TOOLS: ALL;web
PLUGINS: ALL;-curlget;-augeas
# The curlget tests fail: https://github.com/ElektraInitiative/libelektra/issues/3382
# The augeas tests fail: https://github.com/ElektraInitiative/libelektra/issues/3743
- name: 🍎 Clang ASAN
osx_instance:
image: big-sur-xcode
env:
ASAN_OPTIONS: 'detect_leaks=1'
BINDINGS: cpp
ENABLE_ASAN: ON
TOOLS: kdb
PLUGINS: ALL;-curlget;-augeas
# The curlget tests fail: https://github.com/ElektraInitiative/libelektra/issues/3382
# The augeas tests fail: https://github.com/ElektraInitiative/libelektra/issues/3743
- name: 🍎 FULL
osx_instance:
image: big-sur-xcode
env:
BUILD_FULL: ON
BUILD_SHARED: OFF
PLUGINS: ALL;-curlget # The curlget tests fail: https://github.com/ElektraInitiative/libelektra/issues/3382
- name: 🍎 MMap
osx_instance:
image: big-sur-xcode
env:
KDB_DEFAULT_STORAGE: mmapstorage
KDB_DB_FILE: default.mmap
KDB_DB_INIT: elektra.mmap
PLUGINS: ALL;-curlget;-augeas
# The curlget tests fail: https://github.com/ElektraInitiative/libelektra/issues/3382
# The augeas tests fail: https://github.com/ElektraInitiative/libelektra/issues/3743
install_script:
- | # Install Homebrew formulas
brew update
brew config
brew install openjdk
brew install antlr
brew install antlr4-cpp-runtime
brew install augeas
brew install bison
brew install boost
brew install clang-format
brew install dbus
brew upgrade dbus
brew install discount
brew install doxygen
brew install flex
brew install glib
brew install go
brew install gpgme
brew install graphviz
brew install libev
brew install libgcrypt
brew install libgit2
brew install libuv
brew install llvm
brew install lua
brew install maven
brew install moreutils
brew install ninja
brew install oclint/formulae/oclint
brew install npm
brew install openssl
brew install pkg-config
brew install qt
brew install shfmt
brew install swig
brew install tree
brew install xerces-c
brew install yajl
brew install yaml-cpp
brew install zeromq
- > # Try to install `checkbashisms` (The file server that hosts the package is unfortunately quite unreliable.)
brew install checkbashisms || >&2 printf 'Warning: Unable to install `checkbashims`\n'
- | # Start D-Bus session bus
brew tap homebrew/services
brew update # Work around for [Homebrew Services issue 206](https://github.com/Homebrew/homebrew-services/issues/206)
brew postinstall dbus
brew services restart dbus # Workaround for dbus socket issues on cirrus
export DBUS_LAUNCHD_SESSION_BUS_SOCKET=$(find /private/tmp/com.apple.launchd*/unix_domain_listener | xargs ls -Art | tail -n1) # workaround for cirrus
launchctl setenv DBUS_LAUNCHD_SESSION_BUS_SOCKET $DBUS_LAUNCHD_SESSION_BUS_SOCKET
echo $DBUS_LAUNCHD_SESSION_BUS_SOCKET
launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET
- | # Install Python
brew install python@3.8 || brew upgrade python@3.8
export PATH="/usr/local/opt/python@3.8/bin:$PATH"
- | # Install Python packages
pip3 install cmake-format[yaml]==0.6.3
- | # Install Ruby (We use the Homebrew version of Ruby to install gems, since compiling `ronn` fails with the macOs version of Ruby.)
brew install ruby
export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"
- | # Install Ruby gems
sudo gem install ronn test-unit --no-document
- | # Install JavaScript packages
npm install dredd --global
npm install --global prettier@1.19.1
script:
- | # Use latest version of LLVM to translate Elektra
export CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
export PATH="/usr/local/opt/llvm/bin:$PATH"
- >
set --
-DBINDINGS="${BINDINGS:-ALL}"
-DBUILD_FULL="${BUILD_FULL:-OFF}"
-DBUILD_SHARED="${BUILD_SHARED:-ON}"
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_INSTALL_PREFIX="$CIRRUS_WORKING_DIR/$INSTALL_DIR"
-DCOMMON_FLAGS="${COMMON_FLAGS:--Werror}"
-DENABLE_ASAN="${ENABLE_ASAN:-OFF}"
-DENABLE_LOGGER="${ENABLE_LOGGER:-OFF}"
-DENABLE_DEBUG=ON
-DKDB_DB_FILE="${KDB_DB_FILE:-default.ecf}"
-DKDB_DB_INIT="${KDB_DB_INIT:-elektra.ecf}"
-DKDB_DB_SYSTEM="$CIRRUS_WORKING_DIR/system"
-DKDB_DEFAULT_STORAGE="${KDB_DEFAULT_STORAGE:-dump}"
-DPLUGINS="${PLUGINS:-ALL}"
-DTOOLS="${TOOLS:-ALL}"
- *print_cmake_options
- *generate
- *build
- *install
tests_script:
# Remove files produced by `ronn`, since `testscr_check_formatting` only checks the formatting, if the stating area is clean
- git checkout .
- export PATH=$PATH:"$CIRRUS_WORKING_DIR/$INSTALL_DIR/bin:/usr/local/opt/llvm/bin"
- *run_tests
- | # Uninstall Elektra
output="$(cmake --build "$BUILD_DIR" --target uninstall 2>&1)" || printf '%s' "$output"
- | # Make sure uninstalling removes all files
if find "$INSTALL_DIR" -name '*' -not -name "$INSTALL_DIR" | grep -Eqv '^.$'; then
printf 'The command `cmake --build "%s" --target uninstall` did not uninstall all files:\n' "$BUILD_DIR"
tree "$INSTALL_DIR"
printf '. Please add the files shown above to `ElektraUninstall.cmake`.\n'
false
fi
linux_task:
matrix:
- name: 🐧 Fedora
container:
dockerfile: scripts/docker/cirrus/fedora/Dockerfile
script:
- >
set --
-DBUILD_FULL=ON
-DBUILD_SHARED=ON
-DBUILD_STATIC=ON
-DENABLE_LOGGER=ON
-DENABLE_DEBUG=ON
-DBINDINGS='ALL'
-DPLUGINS='ALL'
-DTOOLS='ALL'
-DKDB_DB_SYSTEM="$CIRRUS_WORKING_DIR/system"
-DCMAKE_INSTALL_PREFIX="$CIRRUS_WORKING_DIR/install"
- *print_cmake_options
- *generate
- *build
- *install
tests_script:
- export PATH=$PATH:"$CIRRUS_WORKING_DIR/install/bin"
- export LUA_CPATH="${CIRRUS_WORKING_DIR}/install/lib/lua/5.2/?.so;"
- *run_tests
link_task:
matrix:
- name: 🔗 Check
container:
dockerfile: scripts/docker/cirrus/arch/Dockerfile
clone_script: |
if [ -z "$CIRRUS_PR" ]; then
git clone --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git \
$CIRRUS_WORKING_DIR
git reset --hard $CIRRUS_CHANGE_IN_REPO
else
git clone https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
git config user.email "nobody@example.com"
git config user.name "nobody"
git merge --no-commit --no-ff $CIRRUS_CHANGE_IN_REPO
fi
script:
- >
set --
-DBUILD_FULL=OFF
-DBUILD_SHARED=OFF
-DBUILD_STATIC=OFF
-DBUILD_TESTING=OFF
- *generate
- cmake --build "$BUILD_DIR" 2>&1 | grep 'warning: invalid link' > broken_links.txt || true
- scripts/link-checker build/external-links.txt 2>> broken_links.txt > /dev/null
tests_script:
- |
if test -s broken_links.txt; then
printf >&2 'Broken Links:\n'
printf >&2 '—————————————\n'
cat >&2 broken_links.txt
printf >&2 '—————————————\n'
false
fi
docu_task:
matrix:
- name: 📚 Check
container:
dockerfile: scripts/docker/cirrus/arch/Dockerfile
script:
- >
set --
-DBUILD_PDF=ON
-DPLUGINS='dump;list;resolver_fm_hpu_b;spec;sync;yajl'
-DTOOLS='ALL;web;website'
- *generate
- *build
tests_script:
- |
git_diff_output="$(git diff -p 2>&1)"
if [ -n "$git_diff_output" ]; then
printf >&2 -- 'It looks like you modified a source file of a man page, but did not commit the updated man page.\n'
printf >&2 -- 'Please either:\n\n'
printf >&2 -- '- build the man pages with `ronn` and commit the result, or\n'
printf >&2 -- '- use the `patch` command after this message to update the man pages.\n\n'
printf >&2 -- 'For the second option, please\n\n'
printf >&2 -- '1. copy the lines between the long dashes (`—`), and\n'
printf >&2 -- '2. store them in a file called `man.patch` **in the root of the repository**.\n\n'
printf >&2 -- 'After that use the command:\n\n'
printf >&2 -- '\tcat man.patch | patch -p1\n\n'
printf >&2 -- 'to apply the changes.\n'
printf >&2 -- '\n\n————————————————————————————————————————————————————————————\n\n'
printf >&2 -- '%s' "$git_diff_output"
printf >&2 -- '\n\n————————————————————————————————————————————————————————————\n\n'
false
fi