-
-
Notifications
You must be signed in to change notification settings - Fork 40
124 lines (102 loc) · 3.24 KB
/
test.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
name: Test
on:
workflow_dispatch:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
with:
go-version: '1.21'
- name: Set up deps
run: |
sudo apt-get install -y gcc flex bison make libelf-dev
- name: Build
run: make build
- name: Test
run: make test
- name: Store executable
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: ptcpdump
path: ptcpdump
e2e-test:
runs-on: ubuntu-latest
name: e2e-test
needs: build
strategy:
fail-fast: false
matrix:
kernel: [ '5.4-v0.3', '5.10-v0.3', '5.15-v0.3', '6.3-main', 'bpf-next-20231030.012704' ]
timeout-minutes: 10
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: Retrieve stored ptcpdump executable
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: ptcpdump
path: ptcpdump
- name: Provision LVH VMs
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
test-name: ptcpdump-test
image-version: ${{ matrix.kernel }}
host-mount: ./
dns-resolver: '1.1.1.1'
install-dependencies: 'true'
cmd: |
chmod +x /host/ptcpdump/ptcpdump
- name: Test base
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
provision: 'false'
dns-resolver: '1.1.1.1'
cmd: |
set -ex
uname -a
cat /etc/issue
bash /host/testdata/test_base.sh /host/ptcpdump/ptcpdump
- name: Test filter by process name
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
provision: 'false'
dns-resolver: '1.1.1.1'
cmd: |
set -ex
uname -a
cat /etc/issue
bash /host/testdata/test_pname_filter.sh /host/ptcpdump/ptcpdump
- name: Test filter by process id
uses: cilium/[email protected]
with:
provision: 'false'
dns-resolver: '1.1.1.1'
cmd: |
set -ex
uname -a
cat /etc/issue
bash /host/testdata/test_pid_filter.sh /host/ptcpdump/ptcpdump
releaser-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
with:
go-version: 1.21
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5
with:
distribution: goreleaser
version: latest
args: release --snapshot --clean --skip=publish
env:
WORKDIR: ${{ github.workspace }}