Skip to content

Providing DEB #1831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
63 changes: 63 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,66 @@ jobs:
allowUpdates: true
updateOnlyUnreleased: true
artifacts: "${{ env.PACKAGE_DIR }}.tar.gz"

build-deb:
runs-on: ubuntu-latest
container: seladb/ubuntu2404
permissions:
contents: write
attestations: write
id-token: write
env:
BUILD_DIR: Dist
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Build project
run: |
mkdir -p "${{ env.BUILD_DIR }}"
cd "${{ env.BUILD_DIR }}"
cmake ..
make -j$(nproc)
make install DESTDIR=$PWD/install-root

- name: Create DEB control file
run: |
cd "${{ env.BUILD_DIR }}/install-root"
mkdir -p DEBIAN
VERSION="${{ github.event.release.tag_name }}"
if [ -z "$VERSION" ]; then VERSION="${GITHUB_REF_NAME:-0.0.0-dev}"; fi
cat <<EOF | tee DEBIAN/control
Package: pcapplusplus
Version: $VERSION
Section: libs
Architecture: amd64
Maintainer: PcapPlusPlus Team <pcapplusplus@gmail.com>
Description: PcapPlusPlus - C++ library for packet parsing and crafting
EOF

- name: Build DEB package
run: |
cd "${{ env.BUILD_DIR }}"
dpkg-deb --build install-root pcapplusplus_${{ github.ref_name }}_amd64.deb

- name: Test DEB install
run: |
apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb
echo '#include <PcapLiveDeviceList.h>
#include <iostream>
int main() {
auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList();
std::cout << "Found " << devList.size() << " devices\n";
return 0;
}' > test.cpp
g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++
./test

- name: Upload DEB to release
if: github.ref_type == 'tag'
uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0
with:
draft: true
allowUpdates: true
updateOnlyUnreleased: true
artifacts: "${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb"
Loading