-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into Add-utility-to-determine-if-ip-is-local-exte…
…rnal
- Loading branch information
Showing
25 changed files
with
386 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: Build | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build | ||
shell: bash | ||
run: cmake --build --preset conan-${{ env.LOWERCASE_BUILD_TYPE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Install requirements | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install requirements | ||
shell: bash | ||
run: | | ||
sudo apt-get install -y libelf-dev | ||
sudo apt-get install -y clang | ||
pip install cmake==3.23.3 | ||
pip install conan==2.0 | ||
conan profile detect | ||
conan install . --build=missing -s build_type=${{ env.CAPITALISED_BUILD_TYPE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Set environment variables | ||
|
||
inputs: | ||
build-type: | ||
description: Release or Debug | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set environment variables | ||
shell: bash | ||
run: | | ||
buildType=${{ inputs.build-type }} | ||
printf "CAPITALISED_BUILD_TYPE=%s\n" "${buildType}" >> $GITHUB_ENV | ||
printf "LOWERCASE_BUILD_TYPE=%s\n" "${buildType,,}" >> $GITHUB_ENV | ||
newestTag="$(git describe --tags --abbrev=0)" | ||
artifactVersionWithTimestamp="${newestTag}"-"$(date +%Y%m%d_%H%M%S)" | ||
printf "GITHUB_OCI_REGISTRY_ARTIFACT_VERSION=%s\n" "${artifactVersionWithTimestamp}" >> $GITHUB_ENV | ||
printf "RELEASE_PATH=%s\n" "${{ github.workspace }}/build/Release" >> $GITHUB_ENV | ||
printf "ARTIFACT_PATH=%s\n" "${{ github.workspace }}/artifact" >> $GITHUB_ENV | ||
repositoryName="$(printf "%s" "${{ github.repository }}" | sed -e "s/^${{ github.repository_owner }}\///")" | ||
lowercaseRepositoryName="${repositoryName,,}" | ||
printf "LOWERCASE_REPOSITORY_NAME=%s\n" "${lowercaseRepositoryName}" >> $GITHUB_ENV | ||
githubOCIRegistryAddress=ghcr.io/${{ github.repository_owner }}/"${lowercaseRepositoryName}" | ||
printf "GITHUB_OCI_REGISTRY_ADDRESS=%s\n" "${githubOCIRegistryAddress}" >> $GITHUB_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: Test | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Test | ||
shell: bash | ||
run: ctest --preset conan-${{ env.LOWERCASE_BUILD_TYPE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: Update packages | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Update packages | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get upgrade -y |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Build and test Debug | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
|
||
jobs: | ||
build-and-test-debug: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code of the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Update packages | ||
uses: ./.github/actions/update-packages | ||
|
||
- name: Set environment variables | ||
uses: ./.github/actions/set-environment-variables | ||
with: | ||
build-type: Debug | ||
|
||
- name: Set environment variables | ||
uses: ./.github/actions/set-environment-variables | ||
with: | ||
build-type: Debug | ||
|
||
- name: Install requirements | ||
uses: ./.github/actions/install-requirements | ||
|
||
- name: Configure | ||
shell: bash | ||
run: cmake --preset conan-${{ env.LOWERCASE_BUILD_TYPE }} -DBUILD_TESTS=ON | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Test | ||
uses: ./.github/actions/test |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Build, test and publish Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-test-and-publish-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code of the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Update packages | ||
uses: ./.github/actions/update-packages | ||
|
||
- name: Set environment variables | ||
uses: ./.github/actions/set-environment-variables | ||
with: | ||
build-type: Release | ||
|
||
- name: Install requirements | ||
uses: ./.github/actions/install-requirements | ||
|
||
- name: Configure | ||
shell: bash | ||
run: cmake --preset conan-${{ env.LOWERCASE_BUILD_TYPE }} -DBUILD_TESTS=ON | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Test | ||
uses: ./.github/actions/test | ||
|
||
- name: Create artifact directory | ||
run: mkdir ${{ env.ARTIFACT_PATH }} | ||
|
||
- name: Move license to artifact directory | ||
run: mv ${{ github.workspace }}/LICENSE ${{ env.ARTIFACT_PATH }}/LICENSE | ||
|
||
- name: Move protobuf model to artifact directory | ||
run: mv ${{ env.RELEASE_PATH }}/libebpfdiscoveryproto/proto/ebpfdiscoveryproto ${{ env.ARTIFACT_PATH }}/ebpfdiscoveryproto | ||
|
||
- name: Move binaries to artifact directory | ||
run: mv ${{ env.RELEASE_PATH }}/bin ${{ env.ARTIFACT_PATH }}/bin | ||
|
||
- name: Remove test binaries from artifact directory | ||
run: find ${{ env.ARTIFACT_PATH }}/* -name 'test*' -exec rm {} \; | ||
|
||
- name: Zip artifact directory contents | ||
run: | | ||
cd ${{ env.ARTIFACT_PATH }} | ||
zip -r ${{ env.GITHUB_OCI_REGISTRY_ARTIFACT_VERSION }}.zip . | ||
- name: Login to GitHub OCI registry | ||
run: printf "%s" ${{ secrets.GITHUB_TOKEN }} | oras login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Publish zip to GitHub OCI registry | ||
run: | | ||
cd ${{ env.ARTIFACT_PATH }} | ||
oras push ${{ env.GITHUB_OCI_REGISTRY_ADDRESS }}:${{ env.GITHUB_OCI_REGISTRY_ARTIFACT_VERSION }} ${{ env.GITHUB_OCI_REGISTRY_ARTIFACT_VERSION }}.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ | |
**/vmlinux.h | ||
/compile_commands.json | ||
/.cache | ||
|
||
!/.github/actions/build |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
set(BPF_C_FLAGS ${BPF_C_FLAGS} -I${PROJECT_SOURCE_DIR}/libebpfdiscoveryshared/headers) | ||
set(TARGET ebpfdiscoveryskel) | ||
|
||
set(BPF_C_FLAGS ${BPF_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/src -I${PROJECT_SOURCE_DIR}/libebpfdiscoveryshared/headers) | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | ||
find_package(BpfObject REQUIRED) | ||
bpf_object(ebpfdiscoveryskel src/discovery.bpf.c) | ||
bpf_object(${TARGET} src/discovery.bpf.c) | ||
|
||
if(BUILD_BPF_TESTS) | ||
set(TEST_SKEL_TARGET ebpfdiscoverytestskel) | ||
set(BPF_C_FLAGS ${BPF_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/test) | ||
bpf_object(${TEST_SKEL_TARGET} testbpf/discoveryTest.bpf.c) | ||
|
||
list(APPEND TEST_SOURCES test/DataFunctionsTest.cpp) | ||
set(TEST_TARGET test${TARGET}) | ||
|
||
add_executable(${TEST_TARGET} ${TEST_SOURCES}) | ||
target_link_libraries(${TEST_TARGET} GTest::gtest_main ${TEST_SKEL_TARGET}) | ||
gtest_discover_tests(${TEST_TARGET}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.