forked from syslog-ng/syslog-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (160 loc) · 7.14 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
name: macOS
on:
pull_request:
push:
schedule:
- cron: '00 21 * * *'
jobs:
general:
strategy:
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners
# 13 - X86_64
# 14 or latest - Arm64 M1
version: [13, 14]
build-tool: [ autotools, cmake ]
compiler: [ {cpp: clang++, c: clang}, {cpp: g++, c: gcc} ]
exclude:
- version: 14
compiler: {cpp: clang++, c: clang}
# FIXME: temp exclude of failed linking again with cmake + g++ against GRPC dependenncies
- compiler: {cpp: g++, c: gcc}
build-tool: cmake
fail-fast: false
runs-on: macOS-${{ matrix.version }}
steps:
- name: Checkout syslog-ng source
uses: actions/checkout@v4
- name: Set xcode version
if: matrix.version == 14
run: |
sudo xcode-select -s /Applications/Xcode_15.2.app
- name: Unlinking preinstalled Python (workaround)
# The python@3 brew package has to be installed and linked system-wide (it's a dependency of glib and syslog-ng)
# The macos-13 GitHub runner has Python preinstalled as a pkg, this prevents linking the python@3
# brew package, even when linking is forced. `brew "python@3", link: true, force: true`
# also, brew cannot update the links even these cretated by itself for an earlier python version
run : |
find /usr/local/bin/ -lname "*Python.framework*" -delete
- name: Install dependencies
run: |
brew update --auto-update
brew bundle --force --file=contrib/Brewfile
OS_NAME=$([[ ${{ matrix.version }} -eq 13 ]] && echo "Ventura" || echo "Sonoma")
MACPORTS_PKG_NAME=MacPorts-2.10.1-${{ matrix.version }}-${OS_NAME}.pkg
MACPORTS_URL=https://github.com/macports/macports-base/releases/download/v2.10.1/${MACPORTS_PKG_NAME}
wget ${MACPORTS_URL}
sudo installer -pkg ./${MACPORTS_PKG_NAME} -target /
sudo /opt/local/bin/port install libesmtp
- name: Set ENV variables
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
run: |
. .github/workflows/gh-tools.sh
HOMEBREW_PREFIX="$(brew --prefix)"
MACPORTS_PREFIX=/opt/local
SYSLOG_NG_INSTALL_DIR="${HOME}/install/syslog-ng"
PYTHONUSERBASE="${HOME}/python_packages"
THREADS="$(sysctl -n hw.physicalcpu)"
WARNING_FLAGS="-Wno-unused-command-line-argument" # FIXME: -Werror must be re-added
CFLAGS="-I${HOMEBREW_PREFIX}/include/ -I${MACPORTS_PREFIX}/include ${WARNING_FLAGS}"
CXXFLAGS="${CFLAGS}"
# FIXME: explicit -std=gnu++17 is needed for
# - autotools to detect proper c++ version support with clang
# - correct compiling with the latest homebrew GRPC dependant packages, like absl, etc.
if [ ${{ matrix.build-tool }} = autotools ] && [ $CC = clang ]; then
CXXFLAGS="${CFLAGS} -std=gnu++17"
fi
LDFLAGS="-L${HOMEBREW_PREFIX}/lib -L${MACPORTS_PREFIX}/lib"
CONFIGURE_FLAGS="
`[ $CC = clang ] && echo '--enable-force-gnu99' || true`
--enable-extra-warnings
--enable-debug
--prefix=${SYSLOG_NG_INSTALL_DIR}
--enable-tests
--enable-all-modules
--with-python=3
--with-ivykis=system
--with-systemd-journal=no
--disable-java
--disable-java-modules
"
# -DIVYKIS_SOURCE=internal is switched to system temporally as of https://github.com/buytenh/ivykis/pulls
CMAKE_CONFIGURE_FLAGS="
`[ $CC = clang ] && echo '-DENABLE_FORCE_GNU99=ON' || true`
-DSUMMARY_LEVEL=1
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=${SYSLOG_NG_INSTALL_DIR}
-DBUILD_TESTING=ON
-DPYTHON_VERSION=3
-DIVYKIS_SOURCE=system
-DENABLE_JOURNALD=OFF
-DENABLE_JAVA=OFF
-DENABLE_JAVA_MODULES=OFF
"
PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/openssl@3/lib/pkgconfig:${HOMEBREW_PREFIX}/opt/net-snmp/lib/pkgconfig:${HOMEBREW_PREFIX}/lib/pkgconfig:${MACPORTS_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}"
PATH="${HOMEBREW_PREFIX}/opt/bison/bin:${HOMEBREW_PREFIX}/opt/libnet/bin:${HOMEBREW_PREFIX}/opt/net-snmp/bin:${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:${PYTHONUSERBASE}/bin:${MACPORTS_PREFIX}/bin:${MACPORTS_PREFIX}/sbin:${PATH}"
gh_export HOMEBREW_PREFIX MACPORTS_PREFIX SYSLOG_NG_INSTALL_DIR PYTHONUSERBASE CC CXX PKG_CONFIG_PATH THREADS CONFIGURE_FLAGS CFLAGS CXXFLAGS LDFLAGS CMAKE_CONFIGURE_FLAGS PATH
gh_path "${PATH}"
env | sort
#cat "${GITHUB_ENV}" | sort
- name: Set gcc and g++ symlinks
run: |
if [ $CC = gcc ]; then
ln -s "${HOMEBREW_PREFIX}/bin/gcc-14" "${HOMEBREW_PREFIX}/bin/gcc"
ln -s "${HOMEBREW_PREFIX}/bin/g++-14" "${HOMEBREW_PREFIX}/bin/g++"
fi
echo "ARCH: " $(arch)
echo "xcode:" $(xcode-select -p)
echo "gcc:" $(which gcc; gcc --version)
echo "g++:" $(which g++; g++ --version)
echo "clang:" $(which clang; clang --version)
- name: autogen.sh
if: matrix.build-tool == 'autotools'
run: |
./autogen.sh
- name: configure
if: matrix.build-tool == 'autotools'
run: |
./configure ${CONFIGURE_FLAGS}
- name: cmake configure
if: matrix.build-tool == 'cmake'
run: |
cmake --install-prefix "${SYSLOG_NG_INSTALL_DIR}" -B build . ${CMAKE_CONFIGURE_FLAGS}
- name: cmake install
if: matrix.build-tool == 'cmake'
run: |
cmake --build ./build -j ${THREADS} --target install
"${SYSLOG_NG_INSTALL_DIR}/sbin/syslog-ng" -V
- name: cmake check
# FIXME: Some of our checks still do not run correctly on silicon yet (and probably never will)
if: matrix.build-tool == 'cmake' && matrix.version != 14
run: |
cmake --build ./build -j ${THREADS} --target check
- name: make install
if: matrix.build-tool == 'autotools'
run: |
set -e
make --keep-going install -j ${THREADS} || \
{ \
S=$?; \
make V=1; \
return $S; \
}
"${SYSLOG_NG_INSTALL_DIR}/sbin/syslog-ng" -V
- name: make check
# FIXME: Some of our checks still do not run correctly on silicon yet (and probably never will)
if: matrix.build-tool == 'autotools' && matrix.version != 14
run: |
set -e
make --keep-going check -j ${THREADS} || \
{ \
S=$?; \
echo "Output of first test invocation:"; \
find . -name test-suite.log | xargs cat; \
make V=1 check; \
echo "Output of second test invocation:"; \
find . -name test-suite.log | xargs cat; \
return $S; \
}