-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (110 loc) · 4.26 KB
/
release.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
name: Build/release Zeek
on:
pull_request:
push:
branches:
- main
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: v7.0.0
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
- 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.9.0/libmaxminddb-1.9.0.tar.gz | tar xzvf -
mkdir libmaxminddb-1.9.0\build
cd libmaxminddb-1.9.0\build
cmake ..
cmake --build .
cmake --build . --target install
shell: cmd
- uses: actions/cache@v3
with:
path: ${{runner.temp}}/.ccache
key: ${{ runner.os }}-ccache
- name: Build Zeek (Windows)
if: startsWith(matrix.platform, 'windows-')
run: |
choco install -y --no-progress winflexbison3
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
mkdir zeek-src\build
cd zeek-src\build
cmake.exe .. -DCMAKE_BUILD_TYPE=release -DVCPKG_TARGET_TRIPLET="x64-windows-static" -DENABLE_ZEEK_UNIT_TESTS=yes -DCMAKE_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
env:
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: bash
- 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/upload-release-action@2.7.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: zeek-*.zip
file_glob: true
tag: ${{ github.ref }}
overwrite: true