Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
146 changes: 70 additions & 76 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,61 @@ on:
pull_request:

jobs:
build-and-test:
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# We need this to cache the .so files in /usr/local/lib...
- name: Give tar root permissions
run: sudo chmod u+s /bin/tar

# We'll use the commit hash as the key for caching wireshark's repo
- name: Get wireshark commit hash
id: get-wireshark-hash
- name: Install Wireshark 4.4 from PPA
run: |
echo "hash=$(git submodule status epan-sys/wireshark | awk '{print $1;}')" >> $GITHUB_OUTPUT

- name: Cache wireshark source
uses: actions/cache@v3
id: cache-wireshark
sudo add-apt-repository ppa:wireshark-dev/stable -y
sudo apt-get update
sudo apt-get install -y \
build-essential cmake ninja-build pkg-config \
libwireshark-dev libwiretap-dev libwsutil-dev \
libglib2.0-dev libgcrypt20-dev libpcap-dev tshark
- name: Install MSRV toolchain
uses: actions-rs/toolchain@v1
with:
path: epan-sys/wireshark
key: ${{ runner.os }}-wireshark-source-${{ steps.get-wireshark-hash.outputs.hash }}

- name: Cache libwireshark.so
uses: actions/cache@v3
id: cache-libwireshark
toolchain: "1.85"
override: true
- name: Check on MSRV
uses: actions-rs/cargo@v1
with:
path: |
/usr/local/lib/libwireshark.so*
/usr/local/lib/libwiretap.so*
/usr/local/lib/libwsutil.so*
/usr/local/lib/pkgconfig/wireshark.pc
key: ${{ runner.os }}-wireshark-dylib-${{ steps.get-wireshark-hash.outputs.hash }}

- name: Checkout wireshark
if: steps.cache-wireshark.outputs.cache-hit != 'true'
run: git submodule update --init --recursive ./epan-sys/wireshark

- name: Set up wireshark dependencies
run: sudo bash ./epan-sys/wireshark/tools/debian-setup.sh
command: check
args: --all-targets

- name: Install ninja
if: steps.cache-libwireshark.outputs.cache-hit != 'true'
run: sudo apt-get install -y ninja-build
build-and-test:
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Build and install wireshark
if: steps.cache-libwireshark.outputs.cache-hit != 'true'
- name: Install Wireshark 4.4 from PPA
run: |
cd ./epan-sys/wireshark && \
mkdir -p build && \
cd build && \
cmake -G Ninja \
-DBUILD_androiddump=OFF \
-DBUILD_capinfos=OFF \
-DBUILD_captype=OFF \
-DBUILD_ciscodump=OFF \
-DBUILD_corbaidl2wrs=OFF \
-DBUILD_dcerpcidl2wrs=OFF \
-DBUILD_dftest=OFF \
-DBUILD_dpauxmon=OFF \
-DBUILD_dumpcap=OFF \
-DBUILD_editcap=OFF \
-DBUILD_etwdump=OFF \
-DBUILD_logray=OFF \
-DBUILD_mergecap=OFF \
-DBUILD_randpkt=OFF \
-DBUILD_randpktdump=OFF \
-DBUILD_rawshark=OFF \
-DBUILD_reordercap=OFF \
-DBUILD_sshdump=OFF \
-DBUILD_text2pcap=OFF \
-DBUILD_tfshark=OFF \
-DBUILD_tshark=OFF \
-DBUILD_wifidump=OFF \
-DBUILD_wireshark=OFF \
-DBUILD_xxx2deb=OFF \
.. && \
ninja libwireshark.so && \
sudo ninja install

- name: Check libwireshark.so
sudo add-apt-repository ppa:wireshark-dev/stable -y
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
pkg-config \
libwireshark-dev \
libwiretap-dev \
libwsutil-dev \
libglib2.0-dev \
libgcrypt20-dev \
libpcap-dev \
tshark

- name: Verify wireshark installation
run: |
ls /usr/local/lib | grep libwireshark.so* && \
pkg-config --libs wireshark
pkg-config --exists wireshark && echo "pkg-config: OK" || echo "pkg-config: Not found"
pkg-config --modversion wireshark 2>/dev/null || echo "Version not available via pkg-config"
tshark --version | head -1

- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -113,9 +85,31 @@ jobs:
command: build
args: --all-targets

- name: Run tests
- name: Run unit tests
uses: actions-rs/cargo@v1
with:
command: test
args: --lib

- name: Run integration tests
uses: actions-rs/cargo@v1
env:
LD_LIBRARY_PATH: /usr/local/lib
with:
command: test
args: --test integration_test

- name: Build examples
uses: actions-rs/cargo@v1
with:
command: build
args: --examples

- name: Verify plugin artifacts
run: |
ls -la target/debug/examples/ || echo "No examples built"
if [ -f target/debug/examples/libbuilder.so ]; then
echo "Plugin built successfully"
file target/debug/examples/libbuilder.so
ldd target/debug/examples/libbuilder.so || echo "ldd failed (expected if libs not in path)"
else
echo "Plugin not found"
fi
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[workspace]
members = ["epan-sys", "wsdf"]
resolver = "2"

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wireshark4)', 'cfg(wireshark44)', 'cfg(wireshark46)'] }
Loading
Loading