Skip to content

Const all the things #1420

Const all the things

Const all the things #1420

Workflow file for this run

---
name: CPP CI
"on":
pull_request:
paths-ignore:
- '**.md'
- 'Dockerfile'
concurrency:
# Cancel any CI/CD workflow currently in progress for the same PR.
# Allow running concurrently with any other commits.
group: build-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build_ubuntu:
strategy:
matrix:
configurations: [Debug, Release]
target: [tests, library]
runs-on: ubuntu-latest
env:
# Configuration type to build. For documentation on how build matrices work, see
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: ${{matrix.configurations}}
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install libboost-dev libboost-filesystem-dev libboost-program-options-dev
- name: Install test dependencies
if: ${{matrix.target == 'tests'}}
run: |
sudo apt install libyaml-cpp-dev valgrind
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build
run: |
mkdir build
if [ "${{matrix.target}}" = "library" ]; then
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_CONFIGURATION}} -DVERIFIER_ENABLE_TESTS=OFF
else
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_CONFIGURATION}} -DVERIFIER_ENABLE_TESTS=ON
fi
cmake --build build -j $(nproc)
- name: Run unit tests
if: ${{matrix.target == 'tests'}}
run: ./tests -d yes
- name: Test for memory leaks
if: ${{matrix.target == 'tests'}}
# Any memory leaks will cause the test to fail
# This BPF program was chosen because it is the largest one in the repo
run: valgrind --leak-check=full --errors-for-leak-kinds=all --show-leak-kinds=all --error-exitcode=1 ./check ebpf-samples/cilium/bpf_xdp_snat_linux_v1.o 2/1
build_windows:
strategy:
matrix:
configurations: [Debug, Release]
target: [tests, library]
runs-on: windows-2022
env:
# Configuration type to build. For documentation on how build matrices work, see
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: ${{matrix.configurations}}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build
run: |
mkdir build
if ("${{matrix.target}}" -eq "library") {
cmake -B build -DVERIFIER_ENABLE_TESTS=OFF
} else {
cmake -B build -DVERIFIER_ENABLE_TESTS=ON
}
cmake --build build -j $(nproc) --config ${{env.BUILD_CONFIGURATION}}
- name: Run unit tests
if: ${{matrix.target == 'tests'}}
run: ./${{env.BUILD_CONFIGURATION}}/tests -d yes