-
Notifications
You must be signed in to change notification settings - Fork 74
96 lines (85 loc) · 3.15 KB
/
build.yaml
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
name: build
on:
pull_request:
paths:
- '.github/workflows/build.yaml'
- 'docs/**'
- 'include/**'
- 'libbpf/**'
- 'src/**'
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
env:
FEATURES: .llvm and .skeletons
steps:
- name: Checkout repository
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: true
- name: Use clang-12 and not clang-11 for older Ubuntu
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get remove -y clang-11 llvm-11
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 50
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libbfd-dev libcap-dev libelf-dev libiberty-dev python3-docutils
# clang/LLVM are already installed, but we're missing some aliases.
CLANG_VERSION="$(echo '__clang_major__' | clang -E - | tail -n 1)"
sudo update-alternatives \
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-"${CLANG_VERSION}" 50 \
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-"${CLANG_VERSION}" \
--slave /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-"${CLANG_VERSION}"
echo "CLANG_VERSION=${CLANG_VERSION}" >> "${GITHUB_ENV}"
- name: Build bpftool (default LLVM disassembler)
run: |
make -j -C src V=1
./src/bpftool 2>&1 | grep -q Usage
./src/bpftool -p version | \
tee /dev/stderr | \
jq --exit-status ".features | ${FEATURES}"
- name: Build bpftool, with clang
run: |
make -C src clean
LLVM=1 make -j -C src V=1
./src/bpftool 2>&1 | grep -q Usage
./src/bpftool -p version | \
tee /dev/stderr | \
jq --exit-status ".features | ${FEATURES}"
- name: Build bpftool, with fallback to libbfd disassembler
run: |
sudo apt-get remove -y llvm-"${CLANG_VERSION}"-dev
make -C src clean
make -j -C src V=1
./src/bpftool 2>&1 | grep -q Usage
./src/bpftool -p version | \
tee /dev/stderr | \
jq --exit-status ".features | .libbfd and (.llvm | not)"
- name: Build bpftool, with libbfd, static build
run: |
make -C src clean
EXTRA_CFLAGS=--static make -j -C src V=1
./src/bpftool 2>&1 | grep -q Usage
./src/bpftool -p version | \
tee /dev/stderr | \
jq --exit-status ".features | .libbfd and (.llvm | not)"
ldd ./src/bpftool 2>&1 | \
tee /dev/stderr | \
grep -q 'not a dynamic executable'
- name: Build bpftool's documentation
run: |
make -j -C docs
grep -q '.TH "\?BPFTOOL"\? 8' ./docs/bpftool.8