Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nwt committed Jan 11, 2024
1 parent 6db40ef commit 78e26e7
Showing 1 changed file with 4 additions and 66 deletions.
70 changes: 4 additions & 66 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
release:
strategy:
matrix:
platform: [macos-12, ubuntu-20.04, windows-2019]
platform: [windows-2019]
runs-on: ${{ matrix.platform }}

steps:
Expand All @@ -41,21 +41,6 @@ jobs:
if: startsWith(matrix.platform, 'windows-')
run: go build -o zeekrunner.exe zeekrunner.go

# Includes workaround from https://github.com/maxmind/libmaxminddb/pull/334
- name: Build libmaxminddb (Windows)
if: startsWith(matrix.platform, 'windows-')
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
curl -L https://github.com/maxmind/libmaxminddb/releases/download/1.8.0/libmaxminddb-1.8.0.tar.gz | tar xzvf -
mkdir libmaxminddb-1.8.0\build
cd libmaxminddb-1.8.0\build
cmake ..
cmake --build .
cmake --build . --target install
rename "C:\Program Files (x86)\maxminddb\include\maxminddb.h" maxminddb.h.bak
sed "/typedef ADDRESS_FAMILY sa_family_t/d" "C:\Program Files (x86)\maxminddb\include\maxminddb.h.bak" > "C:\Program Files (x86)\maxminddb\include\maxminddb.h"
shell: cmd

- uses: actions/cache@v3
with:
path: ${{runner.temp}}/.ccache
Expand All @@ -69,9 +54,11 @@ jobs:
choco install -y --no-progress ccache
call refreshenv
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
sed -i -e /\[requires]/a^
libmaxminddb/1.9.1 zeek-src\windows\conanfile_windows.txt
mkdir zeek-src\build
cd zeek-src\build
cmake.exe .. -DCMAKE_BUILD_TYPE=release -DENABLE_ZEEK_UNIT_TESTS=yes -D CMAKE_INSTALL_PREFIX="C:\Program Files\Git\usr\local\zeek" -DLibMMDB_INCLUDE_DIR="C:\Program Files (x86)\maxminddb\include" -DLibMMDB_LIBRARY="C:\Program Files (x86)\maxminddb\lib\maxminddb.lib" -G Ninja
cmake.exe .. -DCMAKE_BUILD_TYPE=release -DENABLE_ZEEK_UNIT_TESTS=yes -D CMAKE_INSTALL_PREFIX="C:\Program Files\Git\usr\local\zeek" -G Ninja
cmake.exe --build .
cmake.exe --install .
cd
Expand All @@ -80,52 +67,3 @@ jobs:
CCACHE_DIR: ${{runner.temp}}/.ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CMAKE_C_COMPILER_LAUNCHER: ccache

- name: Install dependencies (Linux)
if: startsWith(matrix.platform, 'ubuntu-')
run: |
sudo apt-get -y install ccache cmake make gcc g++ flex libfl-dev bison libpcap-dev libssl-dev python3 python3-dev python3-setuptools swig zlib1g-dev zip libmaxminddb-dev
# Removing shared objects to force static linking.
sudo find /usr/lib \( -name libpcap.so\* -o -name libmaxminddb.so\* \) -delete
- name: Install dependencies (macOS)
if: startsWith(matrix.platform, 'macos-')
run: brew install ccache cmake swig openssl bison flex libmaxminddb

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores

- name: Build Zeek (Linux/macOS)
if: "!startsWith(matrix.platform, 'windows-')"
run: |
cd zeek-src
[ $(uname) = Linux ] && linux_flags='-D ZLIB_USE_STATIC_LIBS=TRUE'
./configure --binary-package --enable-static-broker --enable-static-binpac --disable-spicy --disable-af-packet --disable-zeekctl --disable-python --disable-broker-tests --disable-auxtools --disable-archiver --osx-min-version=12 -D OPENSSL_USE_STATIC_LIBS=TRUE $linux_flags
make -j${{ steps.cpu-cores.outputs.count }}
sudo make install
sudo strip /usr/local/zeek/bin/zeek
env:
CCACHE_DIR: ${{runner.temp}}/.ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CMAKE_C_COMPILER_LAUNCHER: ccache

- name: Finish packaging artifact
run: ./release.sh
shell: sh

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}
path: zeek-*.zip

- name: Publish artifact as release
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: zeek-*.zip
file_glob: true
tag: ${{ github.ref }}
overwrite: true

0 comments on commit 78e26e7

Please sign in to comment.