chore: upgrade to conan v2 #1356
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
name: Build-develop | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- develop | |
push: | |
branches: | |
- develop | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
CONAN_NON_INTERACTIVE: 1 | |
CONAN_REVISIONS_ENABLED: 1 | |
jobs: | |
unit-tests-mac: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Python Setup | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Get Conan | |
id: conan | |
uses: turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d #v1.2 | |
- name: Setup OSX Environment | |
run: echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> $GITHUB_ENV | |
- name: Setup Conan Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{github.workspace}}/build/conan_home/ | |
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} | |
restore-keys: conan-${{ runner.os }}- | |
- name: Detect Conan Profile | |
run: conan profile detect -f | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: PKG_CONFIG_PATH=${{github.workspace}}/local/lib/pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: cmake --build . --config $BUILD_TYPE -- -j 4 | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: ctest -C $BUILD_TYPE | |
unit-tests-linux: | |
runs-on: ubuntu-latest | |
outputs: | |
version_number: ${{ env.VERSION }} | |
commit_hash: ${{ env.COMMIT }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Get Conan | |
id: conan | |
uses: turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d #v1.2 | |
- name: Setup Conan Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{github.workspace}}/build/conan_home/ | |
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} | |
restore-keys: conan-${{ runner.os }}- | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: PKG_CONFIG_PATH=${{github.workspace}}/local/lib/pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake | |
- name: Get VERSION | |
id: build | |
run: | | |
echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV | |
echo "COMMIT=`git rev-parse --short HEAD`" >> $GITHUB_ENV | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: cmake --build . --config $BUILD_TYPE -- -j 4 | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: sudo ctest -C $BUILD_TYPE | |
build-win64: | |
runs-on: windows-2019 | |
outputs: | |
version_number: ${{ env.VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}\build | |
- name: Get Conan | |
id: conan | |
uses: turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d #v1.2 | |
- name: Setup Conan Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{github.workspace}}/build/conan_home/ | |
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} | |
restore-keys: conan-${{ runner.os }}- | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{github.workspace}}\build | |
run: PKG_CONFIG_PATH=${{github.workspace}}\local\lib\pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake | |
- name: Get VERSION | |
shell: pwsh | |
id: build | |
run: | | |
$text = Get-Content ${{github.workspace}}\build\VERSION -Raw | |
echo "VERSION=$text" >> $env:GITHUB_ENV | |
- name: Build | |
working-directory: ${{github.workspace}}\build | |
shell: bash | |
run: cmake --build . --config $BUILD_TYPE -- -m | |
# TODO: Fix unit tests for windows platform | |
#- name: Test | |
# working-directory: ${{github.workspace}}/build | |
# shell: bash | |
# # Execute tests defined by the CMake configuration. | |
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
# run: ctest -C $BUILD_TYPE | |
- name: Debug artifacts | |
shell: pwsh | |
run: | | |
Get-ChildItem -Force ${{github.workspace}} | |
Get-ChildItem -Force ${{github.workspace}}\build | |
Get-ChildItem -Force ${{github.workspace}}\build\bin | |
- name: Persist to workspace | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-build | |
path: | | |
${{github.workspace}}\build\bin\pktvisor-reader.exe | |
${{github.workspace}}\build\bin\pktvisord.exe | |
${{github.workspace}}\golang\pkg\client\version.go | |
retention-days: 1 | |
build-cli-win64: | |
needs: [ build-win64 ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Attach to workspace | |
uses: actions/download-artifact@v4 | |
with: | |
name: windows-build | |
- name: Debug artifacts | |
shell: bash | |
run: | | |
ls -lha | |
- name: Debug artifacts | |
shell: bash | |
run: | | |
ls -lha | |
mv src pktvisor-src | |
cp -rpf golang/pkg/client/version.go . | |
ls -lha | |
- name: Build pktvisor-cli | |
uses: ./.github/actions/build-go | |
with: | |
context: "." | |
goos: windows | |
file: "./Dockerfile" | |
- name: Debug artifacts | |
shell: bash | |
run: | | |
mv ./pktvisor-cli pktvisor-cli.exe | |
mv ./build/bin/pktvisord.exe ./pktvisord.exe | |
mv ./build/bin/pktvisor-reader.exe ./pktvisor-reader.exe | |
ls -lha | |
- name: compacting windows binary | |
run: | | |
zip pktvisor-win64.zip pktvisor-cli.exe pktvisor-reader.exe pktvisord.exe | |
ls -lha | |
package-amd64: | |
needs: [ unit-tests-linux ] | |
runs-on: ubuntu-latest | |
# if this is a push into one of our main branches (rather than just a pull request), we will also package | |
if: github.event_name != 'pull_request' | |
outputs: | |
version_number: ${{ env.VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Setup Conan Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{github.workspace}}/build/conan_home/ | |
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} | |
restore-keys: conan-${{ runner.os }}- | |
- name: Build pktvisord + push symbol to bugsplat.com | |
uses: ./.github/actions/build-cpp | |
with: | |
context: "." | |
build_type: "Release" | |
asan: "OFF" | |
bugsplat_key: ${{secrets.BUGSPLAT_KEY}} | |
bugsplat_symbol_url: ${{secrets.BUGSPLAT_SYMBOL_URL}} | |
bugsplat: "true" | |
file: "./Dockerfile" | |
- name: Build pktvisor-cli | |
uses: ./.github/actions/build-go | |
with: | |
context: "." | |
file: "./Dockerfile" | |
- name: Debug artifacts | |
run: ls -lha . | |
- name: Get VERSION | |
id: build | |
run: | | |
echo "VERSION=${{needs.unit-tests-linux.outputs.version_number}}" >> $GITHUB_ENV | |
- name: Generate ref tag (develop) | |
run: echo "REF_TAG=latest-develop" >> $GITHUB_ENV | |
- name: Debug ref tag | |
run: echo ${{ env.REF_TAG }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Replace token | |
run: | | |
sed -i -e "s/CP_TOKEN/${{ secrets.CRASHPAD_TOKEN }}/g" docker/run.sh | |
- name: Replace escape url | |
run: | | |
REPLACE=${{ secrets.BUGSPLAT_CP_URL }} | |
ESCAPED_REPLACE=$(printf '%s\n' "$REPLACE" | sed -e 's/[\/&]/\\&/g') | |
sed -i -e "s/CP_URL/$ESCAPED_REPLACE/g" docker/run.sh | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0 | |
- name: Build + push - pktvisor (multi-arch) | |
env: | |
IMAGE_NAME: netboxlabs/pktvisor | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: ./docker/Dockerfile.crashhandler | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
${{ env.IMAGE_NAME }}:${{ needs.unit-tests-linux.outputs.version_number }} | |
${{ env.IMAGE_NAME }}:${{ env.REF_TAG }} | |
outputs: type=docker,dest=/tmp/amd64.tar | |
build-app-image-x64: | |
needs: [ package-amd64 ] | |
runs-on: ubuntu-latest | |
#if: github.event_name != 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Get Conan | |
id: conan | |
uses: turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d #v1.2 | |
- name: Configure CMake to generate VERSION | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake | |
- name: Get VERSION | |
id: build | |
run: echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV | |
- name: Debug version | |
run: | | |
echo ${{ env.VERSION }} | |
- name: Generate ref tag (develop) | |
run: | | |
echo "REF_TAG=latest-develop" >> $GITHUB_ENV | |
- name: Prepare version file | |
run: | | |
cp -rpf golang/pkg/client/version.go . | |
- name: Build pktvisor-cli | |
uses: ./.github/actions/build-go | |
with: | |
context: "." | |
file: "./Dockerfile" | |
- name: Debug and Rename artifacts | |
run: | | |
ls -lha . | |
mv pktvisor-cli pktvisor-cli-linux-x86_64-${{ env.VERSION }} | |
- name: Upload pktvisor-cli artifact | |
env: | |
BINARY_NAME: pktvisor-cli-linux-x86_64-${{ env.VERSION }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.BINARY_NAME }} | |
path: ${{github.workspace}}/${{ env.BINARY_NAME }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build + push - pktvisor-prom-write | |
env: | |
IMAGE_NAME: netboxlabs/pktvisor-prom-write | |
working-directory: ${{github.workspace}}/centralized_collection/prometheus/docker-grafana-agent | |
run: | | |
docker build . --file Dockerfile --build-arg PKTVISOR_TAG=${{ env.REF_TAG }} --tag ${{ env.IMAGE_NAME }}:${{ env.VERSION }} --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }} | |
docker push -a ${{ env.IMAGE_NAME }} | |
- name: Generate AppImage | |
env: | |
IMAGE_NAME: netboxlabs/pktvisor | |
working-directory: ${{github.workspace}}/appimage | |
run: | | |
DEV_IMAGE="${{ env.IMAGE_NAME }}:${{ env.VERSION }}" DEV_MODE=t make pktvisor-x86_64.AppImage | |
mv pktvisor-x86_64.AppImage pktvisor-x86_64-${{ env.VERSION }}.AppImage | |
- name: Upload AppImage artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pktvisor-x86_64-${{ env.VERSION }}.AppImage | |
path: ${{github.workspace}}/appimage/pktvisor-x86_64-${{ env.VERSION }}.AppImage | |
package-arm64: | |
needs: [ unit-tests-linux ] | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
steps: | |
- name: cleanup #https://github.com/actions/checkout/issues/211 | |
run: | | |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Setup Conan Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{github.workspace}}/build/conan_home/ | |
key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} | |
restore-keys: conan-${{ runner.os }}-arm64- | |
- name: Build pktvisord + push symbol to bugsplat.com | |
uses: ./.github/actions/build-cpp | |
with: | |
context: "." | |
build_type: "Release" | |
asan: "OFF" | |
bugsplat_key: ${{secrets.BUGSPLAT_KEY}} | |
bugsplat_symbol_url: ${{secrets.BUGSPLAT_SYMBOL_URL}} | |
bugsplat: "false" | |
file: "./Dockerfile" | |
- name: Build pktvisor-cli | |
uses: ./.github/actions/build-go | |
with: | |
context: "." | |
file: "./Dockerfile" | |
goarch: "arm64" | |
- name: Debug artifacts | |
run: ls -lha . | |
- name: Generate ref tag (develop) | |
run: echo "REF_TAG=latest-develop" >> $GITHUB_ENV | |
- name: Debug ref tag | |
run: echo ${{ env.REF_TAG }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0 | |
- name: Replace token | |
run: | | |
sed -i -e "s/CP_TOKEN/${{ secrets.CRASHPAD_TOKEN }}/g" docker/run.sh | |
- name: Replace escape url | |
run: | | |
REPLACE=${{ secrets.BUGSPLAT_CP_URL }} | |
ESCAPED_REPLACE=$(printf '%s\n' "$REPLACE" | sed -e 's/[\/&]/\\&/g') | |
sed -i -e "s/CP_URL/$ESCAPED_REPLACE/g" docker/run.sh | |
- name: Build + push - pktvisor (multi-arch) | |
id: docker_build | |
env: | |
IMAGE_NAME: netboxlabs/pktvisor | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: ./docker/Dockerfile.crashhandler | |
platforms: linux/arm64 | |
push: true | |
tags: | | |
${{ env.IMAGE_NAME }}:${{ needs.unit-tests-linux.outputs.version_number }} | |
${{ env.IMAGE_NAME }}:${{ env.REF_TAG }} | |
outputs: type=docker,dest=/tmp/arm64.tar |