Skip to content

Commit

Permalink
chore: fix package build for conan2 (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoparente authored Jan 13, 2025
1 parent 7f90a05 commit 1cd7926
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 40 deletions.
14 changes: 5 additions & 9 deletions .github/actions/build-cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
FROM debian:bullseye-slim
FROM debian:bookworm-slim

LABEL author="Everton Haise Taques <[email protected]>"
LABEL maintainer="Orb Community"
LABEL version="1.0.0"

ENV BUILD_DEPS "g++ cmake make git pkgconf jq python3-pip python3-setuptools ca-certificates libasan6 zip curl python wget"
ENV BUILD_DEPS "g++ cmake make git pkgconf jq python3 python3-pip python3-setuptools ca-certificates libasan6 zip curl wget"

COPY ./entrypoint.sh /entrypoint.sh

Expand All @@ -13,9 +9,9 @@ RUN mkdir -p /pktvisor-src
WORKDIR /pktvisor-src

RUN apt-get update && \
apt-get upgrade --yes --force-yes && \
apt-get install --yes --force-yes --no-install-recommends ${BUILD_DEPS} && \
pip3 install conan --force-reinstall
apt-get upgrade --yes && \
apt-get install --yes --no-install-recommends ${BUILD_DEPS} && \
pip3 install conan --force-reinstall --break-system-packages

RUN chmod +x /entrypoint.sh

Expand Down
28 changes: 11 additions & 17 deletions .github/actions/build-cpp/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,28 @@ function build() {
cp -rf /github/workspace/cmake/ /pktvisor-src/cmake/
cp -rf /github/workspace/CMakeLists.txt /pktvisor-src/
cp -rf /github/workspace/conanfile.py /pktvisor-src/
mkdir /tmp/build
cd /tmp/build
cp -rf /pktvisor-src/build/conan_home/ .
chmod -R 777 /tmp/build/conan_home/
conan profile new --detect default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan config set general.revisions_enabled=1
PKG_CONFIG_PATH=/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=$INPUT_BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake -DASAN=$INPUT_ASAN /pktvisor-src
cd /pktvisor-src/build/
conan profile detect -f
PKG_CONFIG_PATH=/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=$INPUT_BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake -DASAN=$INPUT_ASAN ..
make all -j 4
}

function move() {
echo "========================= Compacting binary and copying ========================="
cd /tmp/build
cp -rf /tmp/build/bin/pktvisord /github/workspace/
strip -s /tmp/build/bin/crashpad_handler
cp -rf /tmp/build/bin/crashpad_handler /github/workspace/
cp -rf /tmp/build/bin/pktvisor-reader /github/workspace/
cp -rf /tmp/build/VERSION /github/workspace/
chmod -R 777 /tmp/build/conan_home/
cp -rf /tmp/build/conan_home/ /github/workspace/build/
cd /pktvisor-src/build/
cp -rf /pktvisor-src/build/bin/pktvisord /github/workspace/
strip -s /pktvisor-src/build/bin/crashpad_handler
cp -rf /pktvisor-src/build/bin/crashpad_handler /github/workspace/
cp -rf /pktvisor-src/build/bin/pktvisor-reader /github/workspace/
cp -rf /pktvisor-src/build/VERSION /github/workspace/
cp -rf /pktvisor-src/build/p/ /github/workspace/build/
cp -rf /pktvisor-src/golang/pkg/client/version.go /github/workspace/version.go
cp -rf /pktvisor-src/src/tests/fixtures/pktvisor-port-service-names.csv /github/workspace/custom-iana.csv
}

function publishToBugsplat() {
echo "========================= Publishing symbol to bugsplat ========================="
cd /tmp/build
cd /pktvisor-src/build/
if [ "$INPUT_BUGSPLAT" == "true" ]; then
wget https://github.com/orb-community/CrashpadTools/raw/main/linux/dump_syms
chmod a+x ./dump_syms
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-

Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-

Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-

Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-

Expand Down Expand Up @@ -403,7 +403,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-arm64-

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-

Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-

Expand Down Expand Up @@ -281,7 +281,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-arm64-

Expand Down Expand Up @@ -400,7 +400,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-

Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Setup Conan Cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/build/conan_home/
path: ${{github.workspace}}/build/p/
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
restore-keys: conan-${{ runner.os }}-

Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
run: echo ${{ env.BRANCH_NAME }}

- name: Get VERSION
run: echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV
run: echo "VERSION=`cat ${{github.workspace}}/VERSION`" >> $GITHUB_ENV

- name: Debug version
run: echo ${{ env.VERSION }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-ql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
# build and run tests
sudo make all test
#remove conan files
rm -rf conan_home/
rm -rf p/
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand All @@ -87,7 +87,7 @@ jobs:
uses: advanced-security/filter-sarif@v1
with:
patterns: |
-pktvisor/build/conan_home/**/*
-pktvisor/build/p/**/*
input: sarif-results/cpp.sarif
output: sarif-results/cpp.sarif

Expand Down

0 comments on commit 1cd7926

Please sign in to comment.