forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
292 lines (261 loc) · 8.88 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
env:
BUILD_DIR: build
container:
memory: 12
bsd_task:
matrix:
- name: 😈 FreeBSD 11
freebsd_instance:
image: freebsd-11-2-release-amd64
- name: 😈 FreeBSD 12
freebsd_instance:
image: freebsd-12-0-release-amd64
- name: 😈 ASAN
freebsd_instance:
image: freebsd-12-0-release-amd64
env:
ENABLE_ASAN: ON
install_script:
- >
pkg install -y
bison
cmake
git
libgit2
ninja
yajl
yaml-cpp
script:
- &create_build_dir mkdir "$BUILD_DIR"
- > # We use `-std=c11`, since the header `math.h` on FreeBSD requires C11 features
set --
-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 |
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"
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 | # 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
mac_task:
env:
INSTALL_DIR: install
matrix:
- name: 🍎 Clang
osx_instance:
image: mojave-xcode-11.1
env:
ENABLE_LOGGER: ON
- name: 🍎 Clang ASAN
osx_instance:
image: mojave-xcode-11.1
env:
ASAN_OPTIONS: 'detect_leaks=1'
BINDINGS: cpp
ENABLE_ASAN: ON
TOOLS: kdb
- name: 🍎 FULL
osx_instance:
image: mojave-xcode-11.1
env:
BUILD_FULL: ON
BUILD_SHARED: OFF
- name: 🍎 MMap
osx_instance:
image: mojave-xcode-11.1
env:
KDB_DEFAULT_STORAGE: mmapstorage
KDB_DB_FILE: default.mmap
KDB_DB_INIT: elektra.mmap
install_script:
- > # Install Homebrew casks
brew cask install java oclint
- > # Install Homebrew formulas
brew install
antlr
antlr4-cpp-runtime
augeas
bison
boost
botan
cmake
dbus
discount
doxygen
glib
gpgme
graphviz
libev
libgcrypt
libgit2
libuv
llvm
lua
maven
moreutils
ninja
openssl
pkg-config
prettier
qt
shfmt
swig
tree
xerces-c
yajl
yaml-cpp
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 services start dbus
- | # Install Python
brew install python@2; brew link --overwrite python@2
brew install python || brew upgrade python
- | # Install Python packages
pip install cmake-format[yaml]==0.5.4
- | # 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@2.6
export PATH="/usr/local/opt/ruby@2.6/bin:/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"
- | # Install Ruby gems
sudo gem install ronn test-unit --no-document
script:
- > # Use latest version of LLVM to translate Elektra
export CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
- *create_build_dir
- >
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:
- *create_build_dir
- *generate
- *build
- *install
tests_script:
- *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:
- *create_build_dir
- >
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:
- *create_build_dir
- >
set --
-DBUILD_PDF=ON
-DPLUGINS='dump;list;resolver_fm_hpu_b;spec;sync;yajl'
-DTOOLS='ALL;web;website-frontend;website-backend'
- *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