Skip to content

Commit

Permalink
Overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
philrz committed Jan 3, 2024
1 parent 040c194 commit fa0178d
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 1 deletion.
113 changes: 113 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Build Zeek

on:
pull_request:
push:
branches:
- master
tags:
- v*brim*
workflow_dispatch:

permissions:
contents: write

jobs:
release:
strategy:
matrix:
platform: [macos-12, ubuntu-20.04, windows-2019]
runs-on: ${{ matrix.platform }}

steps:
- name: Checkout build-zeek
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.21

- name: Checkout zeek
uses: actions/checkout@v3
with:
repository: zeek/zeek
ref: v6.0.2
fetch-depth: 1
submodules: recursive
path: zeek-src

- name: Build zeekrunner (Windows)
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

- name: Build Zeek (Windows)
if: startsWith(matrix.platform, 'windows-')
run: |
choco install -y --no-progress conan --version=1.58.0
choco install -y --no-progress winflexbison3
call refreshenv
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
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 --build .
cmake.exe --install .
cd
shell: cmd

- name: Install dependencies (Linux)
if: startsWith(matrix.platform, 'ubuntu-')
run: sudo apt-get -y install cmake make gcc g++ flex libfl-dev bison libpcap-dev libssl-dev python3 python3-dev python3-setuptools swig zlib1g-dev zip libmaxminddb-dev

- name: Install dependencies (macOS)
if: startsWith(matrix.platform, 'macos-')
run: brew install 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
./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
make -j${{ steps.cpu-cores.outputs.count }}
sudo make install
sudo strip /usr/local/zeek/bin/zeek
- name: Finish packaging artifact
run: ./build.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
2 changes: 1 addition & 1 deletion release.sh → build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ for d in base policy site builtin-plugins; do
cp -R /usr/local/zeek/share/zeek/$d zeek/share/zeek/
done

$zip -r zeek-$RELEASE_TAG.$(go env GOOS)-$(go env GOARCH).zip zeek
$zip -r zeek-$(git describe --always --tags).$(go env GOOS)-$(go env GOARCH).zip zeek

0 comments on commit fa0178d

Please sign in to comment.