forked from syslog-ng/syslog-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (122 loc) · 4.83 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
name: macOS
on:
pull_request:
push:
schedule:
- cron: '00 21 * * *'
jobs:
general:
runs-on: macOS-latest
strategy:
matrix:
build-tool: [autotools, cmake]
cc: [gcc, clang]
fail-fast: false
steps:
- name: Checkout syslog-ng source
uses: actions/checkout@v3
- 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-latest 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 --preinstall
brew bundle --file=contrib/Brewfile
- name: Set ENV variables
run: |
. .github/workflows/gh-tools.sh
HOMEBREW_PREFIX="$(brew --prefix)"
PYTHONUSERBASE="${HOME}/python_packages"
PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/openssl@3/lib/pkgconfig:${HOMEBREW_PREFIX}/opt/net-snmp/lib/pkgconfig:${PKG_CONFIG_PATH}"
CFLAGS="-I${HOMEBREW_PREFIX}/include/"
LDFLAGS="-L${HOMEBREW_PREFIX}/lib"
CC="${{ matrix.cc }}"
THREADS="$(sysctl -n hw.physicalcpu)"
CONFIGURE_FLAGS="
`[ $CC = clang ] && echo '--enable-force-gnu99' || true`
`[ $CC = gcc ] && echo '--enable-cpp' || true`
--prefix=${SYSLOG_NG_INSTALL_DIR}
--enable-all-modules
--enable-tests
--with-ivykis=system
--with-python=3
--with-systemd-journal=no
--disable-smtp
--disable-grpc
--disable-java
--disable-java-modules
--disable-mqtt
--disable-pacct
"
CMAKE_CONFIGURE_FLAGS="
`[ $CC = gcc ] && echo '-DENABLE_CPP=ON' || true`
-DCMAKE_BUILD_TYPE=Debug
-DSUMMARY_VERBOSE=ON
-DBUILD_TESTING=ON
-DIVYKIS_SOURCE=system
-DPYTHON_VERSION=3
-DENABLE_JOURNALD=OFF
-DENABLE_AFSMTP=OFF
-DENABLE_GRPC=OFF
-DENABLE_JAVA=OFF
-DENABLE_JAVA_MODULES=OFF
-DENABLE_MQTT=OFF
-DENABLE_PACCT=OFF
"
gh_export HOMEBREW_PREFIX PYTHONUSERBASE CC PKG_CONFIG_PATH THREADS CONFIGURE_FLAGS CFLAGS LDFLAGS CMAKE_CONFIGURE_FLAGS
gh_path "${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/opt/bison/bin:${HOMEBREW_PREFIX}/opt/libnet/bin:${PYTHONUSERBASE}/bin:${HOMEBREW_PREFIX}/opt/net-snmp/bin:${PATH}"
ln -s "${HOMEBREW_PREFIX}/bin/gcc-11" "${HOMEBREW_PREFIX}/bin/gcc"
ln -s "${HOMEBREW_PREFIX}/bin/g++-11" "${HOMEBREW_PREFIX}/bin/g++"
- 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: |
mkdir build
# If you know the valid syntax to provide the quoted string for -DCMAKE_C_FLAGS inplace in CMAKE_CONFIGURE_FLAGS above (in Set ENV variables step) instead of this hack, please contribute!
#
# TODO: -Wall must be replaced here with -Werror but now multiple warnings could occure in several modules that needs to be corrected first
#
cmake --install-prefix "${HOME}/install/syslog-ng" -B build . -DCMAKE_C_FLAGS="-Wall ${CFLAGS}" ${CMAKE_CONFIGURE_FLAGS}
- name: cmake install
if: matrix.build-tool == 'cmake'
run: |
cmake --build ./build -j ${THREADS} --target install
- name: cmake check
if: matrix.build-tool == 'cmake'
run: |
cmake --build ./build -j ${THREADS} --target check
- name: make
if: matrix.build-tool == 'autotools'
run: |
set -e
make --keep-going -j ${THREADS} || \
{ \
S=$?; \
make V=1; \
return $S; \
}
- name: make check
if: matrix.build-tool == 'autotools'
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; \
}