Skip to content
Open
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
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