Skip to content

Commit 3f8f409

Browse files
authored
Add daily tests workflow and respective badge (#2064)
* workflows: add test-daily.yaml and libbpfgo.sh * doc: add Tests (DAILY) badge to Readme.md
1 parent 3f78d22 commit 3f8f409

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

.github/workflows/test-daily.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Tests (DAILY)
2+
3+
on:
4+
workflow_dispatch: {}
5+
schedule:
6+
# Daily at 03:00
7+
- cron: '0 3 * * *'
8+
workflow_call:
9+
10+
env:
11+
GO_VERSION: "1.17"
12+
OPA_VERSION: "v0.41.0"
13+
14+
jobs:
15+
compile-tracee:
16+
name: Test Latest libbpfgo
17+
runs-on: ubuntu-20.04
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
with:
22+
submodules: true
23+
- name: Install Dependencies
24+
uses: ./.github/actions/build-dependencies
25+
with:
26+
go-version: ${{ env.GO_VERSION }}
27+
opa-version: ${{ env.OPA_VERSION }}
28+
- name: Compile Tracee
29+
run: |
30+
make test-upstream-libbpfgo

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,13 @@ test-rules: \
655655
#
656656
$(CMD_OPA) test $(REGO_SIGNATURES_DIR) --verbose
657657

658+
.PHONY: test-upstream-libbpfgo
659+
test-upstream-libbpfgo: \
660+
.checkver_$(CMD_GO) \
661+
$(OUTPUT_DIR)/libbpf/libbpf.a
662+
#
663+
./tests/libbpfgo.sh $(GO_ENV_EBPF)
664+
658665
#
659666
# code checkers (hidden from help on purpose)
660667
#

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![Test Signatures](https://github.com/aquasecurity/tracee/actions/workflows/test-signatures.yaml/badge.svg)](https://github.com/aquasecurity/tracee/actions/workflows/test-signatures.yaml)
88
[![Release Snapshot](https://github.com/aquasecurity/tracee/actions/workflows/release-snapshot.yaml/badge.svg)](https://github.com/aquasecurity/tracee/actions/workflows/release-snapshot.yaml)
99
[![OS Packages (DAILY)](https://github.com/aquasecurity/tracee/actions/workflows/test-os-packaging-daily.yaml/badge.svg)](https://github.com/aquasecurity/tracee/actions/workflows/test-os-packaging-daily.yaml)
10+
[![Tests (DAILY)](https://github.com/aquasecurity/tracee/actions/workflows/test-daily.yaml/badge.svg)](https://github.com/aquasecurity/tracee/actions/workflows/test-daily.yaml)
1011

1112
# Tracee: Runtime Security and Forensics using eBPF
1213

tests/libbpfgo.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
#
4+
# This test attempts to compile tracee using upstream libbpfgo.
5+
# It's run by github workflows inside action runners, just as
6+
# it can be run locally. In both cases it must be triggered by
7+
# 'make test-upstream-libbpfgo'.
8+
#
9+
10+
info() {
11+
echo -n "INFO: "
12+
echo "$@"
13+
}
14+
15+
error_exit() {
16+
echo -n "ERROR: "
17+
echo "$@"
18+
exit 1
19+
}
20+
21+
git_setup() {
22+
git add go.mod go.sum
23+
if ! go get github.com/aquasecurity/libbpfgo@main;
24+
then
25+
git restore --staged go.mod go.sum
26+
error_exit "could not go get libbpfgo@main"
27+
fi
28+
}
29+
30+
git_restore() {
31+
git checkout go.mod go.sum
32+
git restore --staged go.mod go.sum
33+
}
34+
35+
BASE_DIR="$(dirname "$(realpath "${0}")")"
36+
TRACEE_DIR="$(realpath "${BASE_DIR}"/..)"
37+
GO_ENV_EBPF=( "$@" )
38+
export "${GO_ENV_EBPF[@]}"
39+
40+
git_setup
41+
trap git_restore ERR
42+
43+
set -e
44+
STATIC=1 make -C "${TRACEE_DIR}"
45+
set +e
46+
47+
git_restore
48+
49+
info "SUCCESS"
50+
51+
exit 0

0 commit comments

Comments
 (0)