• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: static LLVM build
2
3on:
4  pull_request:
5    paths:
6      - '.github/workflows/static-build.yaml'
7      - 'include/**'
8      - 'libbpf/**'
9      - 'src/**'
10  push:
11    branches:
12      - master
13
14concurrency:
15  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }}
16  cancel-in-progress: true
17
18jobs:
19  build:
20    runs-on: ubuntu-22.04
21    env:
22      LLVM_URL_PREFIX: https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.0
23      LLVM_PATH: clang+llvm-15.0.0-x86_64-linux-gnu-rhel-8.4
24
25    steps:
26      - name: Install dependencies
27        run: |
28          sudo apt-get update
29          sudo apt-get install -y libelf-dev
30
31      - name: Download and extract compiled LLVM release
32        run: |
33          curl -L -O "${{ env.LLVM_URL_PREFIX }}/${{ env.LLVM_PATH }}.tar.xz"
34          tar -xvf "${{ env.LLVM_PATH }}.tar.xz"
35
36      - name: Checkout bpftool
37        uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
38        with:
39          submodules: recursive
40          # Create a new directory to avoid wiping out LLVM on bpftool checkout
41          path: 'bpftool'
42
43      - name: Build bpftool (static build, default LLVM disassembler)
44        working-directory: 'bpftool'
45        run: |
46          EXTRA_CFLAGS=--static \
47              LLVM_CONFIG="${GITHUB_WORKSPACE}/${LLVM_PATH}/bin/llvm-config" \
48              LLVM_STRIP="${GITHUB_WORKSPACE}/${LLVM_PATH}/bin/llvm-strip" \
49              make -j -C src V=1
50
51      - name: Test bpftool binary
52        working-directory: 'bpftool'
53        run: |
54          ./src/bpftool 2>&1 | grep -q Usage
55          ./src/bpftool -p version | \
56              tee /dev/stderr | \
57              jq --exit-status ".features | .llvm"
58          ldd ./src/bpftool 2>&1 | \
59              tee /dev/stderr | \
60              grep -q 'not a dynamic executable'
61