-
Notifications
You must be signed in to change notification settings - Fork 159
/
commands.yml
126 lines (105 loc) · 4.84 KB
/
commands.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
# ________ ____ __ __ ______
# \___ // __ \| | \/ ___/
# / /\ ___/| | /\___ \
# /_____ \\___ >____//____ >
# \/ \/ \/
# Build System
# v0.8.4
#
# default language
language: bash
# globals for all commands
globals:
# NETCAP version
VERSION: 0.3.9
# command data
commands:
build:
description: build netcap binary
dependencies:
- clean
buildNumber: true
exec: |
echo "[INFO] generating netcap binary v${VERSION}"
go build -ldflags "-X github.com/dreadl0ck/netcap.Version=v${VERSION}" -o bin/netcap -i github.com/dreadl0ck/netcap/cmd
build-all-linux-docker:
description: build all framework binaries for linux inside a docker container
help: used to compile for linux on macOS because cross compilation is a pain with CGO
dependencies:
- clean
version-bump:
description: bump framework version and add git version tag
exec: |
read -p "[WARNING] This will bump the version to $VERSION, as configured in the zeus/commands.yml. Are you sure? Hit [Enter] to proceed"
git add .
git commit -m "version bump to v${VERSION}"
git push
echo "[INFO] version bumped to v${VERSION}"
release:
description: release a new version, bundle and publish on github
dependencies:
- gen-version
- check-version
exec: goreleaser release --rm-dist
release-test:
description: test run to release a new version
dependencies:
- gen-version
- check-version
exec: goreleaser release --rm-dist --skip-publish --skip-validate #--debug
check-version:
description: checks wheter the version from the latest git tag matches the one set here
exec: |
if [[ $(git describe --abbrev=0) != "v${VERSION}" ]]; then
echo "[ERROR] latest git tag does not match version $VERSION"
exit 1
fi
clean:
description: clean up to prepare for build
exec: rm -rf bin/*
install:
description: install netcap and netlabel to $PATH
buildNumber: true
help: Installs the applications to the default system location
dependencies:
- "netcap"
- "netlabel"
- "server"
- "sensor"
exec: echo done
netcap:
description: install to $PATH
buildNumber: true
help: Install the application to the default system location
exec: go build -ldflags "-X github.com/dreadl0ck/netcap.Version=v${VERSION}" -o $(go env GOPATH)/bin/netcap -i github.com/dreadl0ck/netcap/cmd
netlabel:
description: install to $PATH
buildNumber: true
help: Install the netlabel application to the default system location
exec: go build -ldflags "-X github.com/dreadl0ck/netcap.Version=v${VERSION}" -o $(go env GOPATH)/bin/netlabel -i github.com/dreadl0ck/netcap/label/cmd
install-race:
description: install a netcap build with race detection enabled
buildNumber: true
help: Install the race build to the default system location
exec: go build -ldflags "-X github.com/dreadl0ck/netcap.Version=v${VERSION}-race" -race -o $(go env GOPATH)/bin/netcap -i github.com/dreadl0ck/netcap/cmd
cloc:
description: count lines of code for the project
exec: cloc --exclude-ext pb.go,py,rb cmd sensor server label types utils collector encoder netcap.go reader.go utils.go
gen-proto:
description: generate protocol buffers
help: proto compiler must be installed
exec: protoc --gogofaster_out=types/. --ruby_out=types/ --python_out=types/ netcap.proto
sensor:
description: install to $PATH
help: Install the netcap sensor to the default system location
exec: go build -ldflags "-X github.com/dreadl0ck/netcap.Version=v${VERSION}" -o $(go env GOPATH)/bin/netcap-sensor -i github.com/dreadl0ck/netcap/sensor
server:
description: install to $PATH
help: Install the netcap server to the default system location
exec: go build -ldflags "-X github.com/dreadl0ck/netcap.Version=v${VERSION}" -o $(go env GOPATH)/bin/netcap-server -i github.com/dreadl0ck/netcap/server
# the version defined in the globals section will be set via ldflags on each build
# to ensure the correct version is also set for installation via go get
# a version.go file is generated on each release with the corresponding version number
gen-version:
description: generate the version.go file
exec: echo -e "// This file was generated. Do not edit.\npackage netcap\n\n// Netcap version.\nvar Version = \"v${VERSION}\"" > version.go