This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
229 lines (210 loc) · 7.91 KB
/
macOS.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
name: 🍎 macOS
# Triggers the workflow on push or pull request events
on: [push, pull_request]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
# Skip homebrew cleanup to avoid issues with removal of packages
HOMEBREW_NO_INSTALL_CLEANUP: 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: macos-11
strategy:
# Do not abort all jobs upon first failure
fail-fast: false
matrix:
include:
# The following plugins have been disabled due to problems:
# Yamlcpp fails to compile on macOS with GCC due to problems with the macOS SDK
# it does not make sense to test the xfconf plugin on macOS as xfce is very uncommon on macOS
- name: GCC 11
CC: gcc-11
CXX: g++-11
PLUGINS: ALL;-xerces;-yamlcpp;-ansible;-xfconf
BINDINGS: ALL;-rust
- name: Clang
CC: clang
CXX: clang++
ENABLE_LOGGER: ON
TOOLS: NODEP
PLUGINS: ALL;-xfconf
BINDINGS: ALL;-rust
- name: Clang ASAN
CC: clang
CXX: clang++
ASAN_OPTIONS: detect_leaks=1
ENABLE_ASAN: ON
TOOLS: kdb
PLUGINS: ALL;-xfconf
BINDINGS: ALL;-rust
#- name: MMap
# KDB_DEFAULT_STORAGE: mmapstorage
# KDB_DB_FILE: default.mmap
# KDB_DB_INIT: elektra.mmap
# PLUGINS: ALL
# BINDINGS: ALL;-rust
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
PLUGINS: ${{ matrix.PLUGINS }}
BINDINGS: ${{ matrix.BINDINGS }}
TOOLS: ${{ matrix.TOOLS }}
ENABLE_LOGGER: ${{ matrix.ENABLE_LOGGER }}
ENABLE_ASAN: ${{ matrix.ENABLE_ASAN }}
ASAN_OPTIONS: ${{ matrix.ASAN_OPTIONS }}
KDB_DEFAULT_STORAGE: ${{ matrix.KDB_DEFAULT_STORAGE }}
KDB_DB_FILE: ${{ matrix.KDB_DB_FILE }}
KDB_DB_INIT: ${{ matrix.KDB_DB_INIT }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Dependencies
run: |
set -ex
brew config
brew update
# homebrew fails to upgrade python due to unlinking failure
# (cf. https://github.com/actions/setup-python/issues/577 )
rm -f /usr/local/bin/2to3
rm -f /usr/local/bin/idle3
rm -f /usr/local/bin/pydoc3
rm -f /usr/local/bin/python3
rm -f /usr/local/bin/python3-config
rm -f /usr/local/bin/2to3-3.11
rm -f /usr/local/bin/idle3.11
rm -f /usr/local/bin/pydoc3.11
rm -f /usr/local/bin/python3.11
rm -f /usr/local/bin/python3.11-config
rm -f /usr/local/lib/libtcl8.6.dylib
rm -f /usr/local/lib/libtk8.6.dylib
rm -f /usr/local/bin/go
rm -f /usr/local/bin/gofmt
brew upgrade
brew install augeas \
antlr \
antlr4-cpp-runtime \
bison \
clang-format \
dbus \
discount \
doxygen \
flex \
glib \
gpgme \
gradle \
graphviz \
libev \
libgcrypt \
libgit2 \
libuv \
lua \
moreutils \
ninja \
npm \
openssl \
pkg-config \
qt \
shfmt \
swig \
tree \
xerces-c \
yajl \
yaml-cpp \
zeromq
if [ "$CC" = 'clang' ]; then
brew install --cask oclint
fi
brew install --cask adoptopenjdk
# 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'
- name: Setup Build Environment
run: |
# Install Ruby gems
export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"
gem install ronn-ng -v 0.10.1.pre3
gem install test-unit --no-document
# Install Python packages
pip2 install cheetah # Required by kdb-gen
pip3 install cmakelang[yaml]==0.6.13
# Install JavaScript packages
npm install dredd --global
npm install --global [email protected]
brew tap homebrew/services
brew update # Work around for [Homebrew Services issue 206](https://github.com/Homebrew/homebrew-services/issues/206)
brew postinstall dbus
echo $DBUS_LAUNCHD_SESSION_BUS_SOCKET
launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET
cmake -E make_directory ${{runner.workspace}}/libelektra/build
export JAVA_HOME=$(/usr/libexec/java_home -v 16)
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo "$JAVA_HOME/bin" >> $GITHUB_PATH
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/libelektra/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
if [ "$CC" = 'clang' ]; then
# Use latest version of LLVM to translate Elektra
export CC="$(brew --prefix llvm@15)/bin/clang" CXX="$(brew --prefix llvm@15)/bin/clang++"
export LDFLAGS="-L$(brew --prefix llvm@15)/lib"
export CPPFLAGS="-I$(brew --prefix llvm@15)/include"
export PATH="$(brew --prefix llvm@15)/bin:$PATH"
fi
SYSTEM_DIR="$PWD/kdbsystem"
CMAKE_OPT+=(
-GNinja
-DPLUGINS="${PLUGINS:-ALL}"
-DBINDINGS="${BINDINGS:-ALL}"
-DTOOLS="${TOOLS:-NODEP}"
-DBUILD_FULL="${BUILD_FULL:-OFF}"
-DBUILD_SHARED="${BUILD_SHARED:-ON}"
-DENABLE_ASAN="${ENABLE_ASAN:-OFF}"
-DCOMMON_FLAGS="${COMMON_FLAGS--Werror}"
-DENABLE_LOGGER="${ENABLE_LOGGER:-OFF}"
-DENABLE_DEBUG=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DKDB_DB_SYSTEM="$SYSTEM_DIR"
-DKDB_DEFAULT_STORAGE="${KDB_DEFAULT_STORAGE:-dump}"
-DKDB_DB_FILE="${KDB_DB_FILE:-default.ecf}"
-DKDB_DB_INIT="${KDB_DB_INIT:-elektra.ecf}"
)
printf '—— CMake Config ——\n'
for option in "${CMAKE_OPT[@]}"; do printf '%s\n' "$option"; done
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE ${CMAKE_OPT[@]}
- name: Build
working-directory: ${{runner.workspace}}/libelektra/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build .
- name: Install
working-directory: ${{runner.workspace}}/libelektra/build
shell: bash
run: output="$(cmake --build . --target install 2>&1)" || printf '%s' "$output"
- name: Test
working-directory: ${{runner.workspace}}/libelektra/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
if [ "$ENABLE_ASAN" = 'ON' ]; then
KDB=""
elif [ "$BUILD_FULL" = 'ON' ]; then
KDB=kdb-full
else
KDB=kdb
fi
env BUILD_DIR="$PWD" AUTO_RERUN_TESTS="testmod_dbus" KDB="$KDB" sh "$GITHUB_WORKSPACE/scripts/dev/ci_run_tests.sh"