-
Notifications
You must be signed in to change notification settings - Fork 236
167 lines (133 loc) · 4.4 KB
/
ci.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: CI
on:
push:
tags:
- v*
branches:
- master
pull_request:
jobs:
build-ebpf-exporter-x86_64:
name: Build ebpf_exporter (x86_64)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch with tags to have the build version attached
- name: Build libbpf and ebpf_exporter
run: |
docker buildx build --progress plain --tag ebpf_exporter:builder --target builder .
id=$(docker create ebpf_exporter:builder)
docker cp $id:/build/ebpf_exporter/ebpf_exporter ebpf_exporter.x86_64
docker cp $id:/build/libbpf.tar.gz libbpf.x86_64.tar.gz
- name: Upload libbpf.tar.gz
uses: actions/upload-artifact@v3
with:
name: libbpf.x86_64.tar.gz
path: libbpf.x86_64.tar.gz
- name: Upload ebpf_exporter
uses: actions/upload-artifact@v3
with:
name: ebpf_exporter.x86_64
path: ebpf_exporter.x86_64
build-ebpf-exporter-aarch64:
name: Build ebpf_exporter (aarch64 emulated, be patient)
runs-on: ubuntu-22.04
steps:
- uses: dbhi/qus/action@main
with:
targets: aarch64
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch with tags to have the build version attached
- name: Build ebpf_exporter
run: |
docker buildx build --progress plain --tag ebpf_exporter:builder --target builder --platform linux/arm64 .
id=$(docker create ebpf_exporter:builder)
docker cp $id:/build/ebpf_exporter/ebpf_exporter ebpf_exporter.aarch64
docker cp $id:/build/libbpf.tar.gz libbpf.aarch64.tar.gz
- name: Upload libbpf.tar.gz
uses: actions/upload-artifact@v3
with:
name: libbpf.aarch64.tar.gz
path: libbpf.aarch64.tar.gz
- name: Upload ebpf_exporter
uses: actions/upload-artifact@v3
with:
name: ebpf_exporter.aarch64
path: ebpf_exporter.aarch64
test-ebpf-exporter-x86_64:
name: Test ebpf_exporter (x86_64)
needs: build-ebpf-exporter-x86_64
runs-on: ubuntu-22.04
steps:
- uses: actions/setup-go@v3
with:
go-version: ^1.20
- uses: actions/checkout@v3
- name: Download libbpf.tar.gz
uses: actions/download-artifact@v3
with:
name: libbpf.x86_64.tar.gz
- name: Install libbpf
run: sudo tar -C / -xvvf libbpf.x86_64.tar.gz
- name: Install libelf-dev
run: sudo apt-get install -y libelf-dev
- name: Build
run: make build
- name: Test
run: make test
lint-ebpf-exporter-x86_64:
name: Lint ebpf_exporter (x86_64)
needs: build-ebpf-exporter-x86_64
runs-on: ubuntu-22.04
steps:
- uses: actions/setup-go@v3
with:
go-version: ^1.20
- uses: actions/checkout@v3
- name: Download libbpf.tar.gz
uses: actions/download-artifact@v3
with:
name: libbpf.x86_64.tar.gz
- name: Install libbpf
run: sudo tar -C / -xvvf libbpf.x86_64.tar.gz
- name: Install libelf-dev
run: sudo apt-get install -y libelf-dev
- name: Check vendored dependencies
run: go mod verify
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
env:
CGO_LDFLAGS: "-l bpf"
build-examples-x86_64:
name: Build examples (x86_64)
needs: build-ebpf-exporter-x86_64
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Download libbpf.tar.gz
uses: actions/download-artifact@v3
with:
name: libbpf.x86_64.tar.gz
- name: Install libbpf
run: sudo tar -C / -xvvf libbpf.x86_64.tar.gz
- name: Install libelf-dev
run: sudo apt-get install -y libelf-dev
- name: Install clang
run: sudo apt-get install -y clang
- name: Build benchmark bpf probes
run: make -j $(nproc) -C benchmark build
- name: Build example bpf probes
run: make -j $(nproc) -C examples build
clang-format:
name: Run clang-format check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install clang-format
run: sudo apt-get install -y clang-format make
- name: Run clang-format check
run: make clang-format-check