Skip to content

Commit

Permalink
Fix CI/CD for updated bpf_conformance (vbpf#346)
Browse files Browse the repository at this point in the history
The updated bpf_conformance requires a new(er) version of libbpf than is
available on github runners. With this change, we build our own version
of libbpf from source so that we are using a new(er) version of the
library with all the necessary features.

Signed-off-by: Will Hawkins <[email protected]>
  • Loading branch information
hawkinsw authored Sep 15, 2023
1 parent f4e91d7 commit c3116aa
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 27 deletions.
24 changes: 24 additions & 0 deletions .github/scripts/build-libbpf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/bash
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: MIT

git clone https://github.com/libbpf/libbpf.git
if [ $? -ne 0 ]; then
echo "Could not clone the libbpf repository."
exit 1
fi

# Jump in to the src directory to do the actual build.
cd libbpf/src

make
if [ $? -ne 0 ]; then
echo "Could not build libbpf source."
exit 1
fi

# Now that the build was successful, install the library (shared
# object and header files) in a spot where FindLibBpf.cmake can
# find it when it is being built.
sudo PREFIX=/usr LIBDIR=/usr/lib/x86_64-linux-gnu/ make install
exit 0
40 changes: 20 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,46 +167,46 @@ jobs:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: RelWithDebInfo
upload_packages: true

linux_release_arm64:
uses: ./.github/workflows/posix.yml
with:
arch: arm64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: RelWithDebInfo

linux_release_scan_build:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: RelWithDebInfo
scan_build: true

linux_release_scan_build_no_retpolines:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: RelWithDebInfo
disable_retpolines: true

linux_release_coverage:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: RelWithDebInfo
enable_coverage: true

linux_release_coverage_no_retpolines:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: RelWithDebInfo
enable_coverage: true
disable_retpolines: true
Expand All @@ -215,23 +215,23 @@ jobs:
uses: ./.github/workflows/posix.yml
with:
arch: arm64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: RelWithDebInfo
enable_coverage: true

linux_release_sanitizers:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: RelWithDebInfo
enable_sanitizers: true

linux_release_sanitizers_no_retpolines:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: RelWithDebInfo
enable_sanitizers: true
disable_retpolines: true
Expand All @@ -241,46 +241,46 @@ jobs:
# uses: ./.github/workflows/posix.yml
# with:
# arch: arm64
# platform: ubuntu-20.04
# platform: ubuntu-latest
# build_type: RelWithDebInfo
# enable_sanitizers: true

linux_debug:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: Debug

linux_debug_no_retpolines:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: Debug
disable_retpolines: true

linux_debug_arm64:
uses: ./.github/workflows/posix.yml
with:
arch: arm64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: Debug
upload_packages: true

linux_debug_coverage:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: Debug
enable_coverage: true

linux_debug_coverage_no_retpolines:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: Debug
enable_coverage: true
disable_retpolines: true
Expand All @@ -289,23 +289,23 @@ jobs:
uses: ./.github/workflows/posix.yml
with:
arch: arm64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: Debug
enable_coverage: true

linux_debug_sanitizers:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: Debug
enable_sanitizers: true

linux_debug_sanitizers_no_retpolines:
uses: ./.github/workflows/posix.yml
with:
arch: x86_64
platform: ubuntu-20.04
platform: ubuntu-latest
build_type: Debug
enable_sanitizers: true
disable_retpolines: true
Expand All @@ -315,7 +315,7 @@ jobs:
# uses: ./.github/workflows/posix.yml
# with:
# arch: arm64
# platform: ubuntu-20.04
# platform: ubuntu-latest
# build_type: Debug
# enable_sanitizers: true

Expand All @@ -330,7 +330,7 @@ jobs:
- linux_release_arm64_coverage
- linux_debug_arm64_coverage

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/[email protected]
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
ccache
- name: Install system dependencies (Linux)
if: inputs.platform == 'ubuntu-20.04'
if: inputs.platform == 'ubuntu-latest'
run: |
sudo apt-get update
Expand All @@ -98,7 +98,7 @@ jobs:
libboost-dev \
libboost-program-options-dev \
libboost-filesystem-dev \
libbpf-dev
libelf-dev
if [[ "${{ inputs.scan_build }}" == "true" ]] ; then
sudo apt-get install -y \
Expand All @@ -112,6 +112,11 @@ jobs:
qemu-user
fi
- name: Build/install libbpf From Source
if: inputs.platform == 'ubuntu-latest'
run: ./.github/scripts/build-libbpf.sh
shell: bash

- name: Install system dependencies (macOS)
if: inputs.platform == 'macos-11'
run: |
Expand Down Expand Up @@ -231,7 +236,7 @@ jobs:
--target install
- name: Generate the DEB package
if: inputs.platform == 'ubuntu-20.04'
if: inputs.platform == 'ubuntu-latest'
run: |
cmake \
-S . \
Expand All @@ -244,7 +249,7 @@ jobs:
--target package
- name: Generate the RPM package
if: inputs.platform == 'ubuntu-20.04'
if: inputs.platform == 'ubuntu-latest'
run: |
cmake \
-S . \
Expand Down Expand Up @@ -277,23 +282,23 @@ jobs:
echo "REL_TGZ_PACKAGE_PATH=$(ls build/*.tar.gz)" >> $GITHUB_OUTPUT
- name: Upload the DEB package
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-20.04'
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-latest'
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: linux_deb_package
path: ${{ steps.package_locations.outputs.REL_DEB_PACKAGE_PATH }}
retention-days: 5

- name: Upload the RPM package
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-20.04'
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-latest'
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: linux_rpm_package
path: ${{ steps.package_locations.outputs.REL_RPM_PACKAGE_PATH }}
retention-days: 5

- name: Upload the Linux TGZ package
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-20.04'
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-latest'
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: linux_tgz_package
Expand Down

0 comments on commit c3116aa

Please sign in to comment.