Skip to content

Commit

Permalink
support ubuntu 24 in CI (#1486)
Browse files Browse the repository at this point in the history
* support ubuntu24

* test

* update

* update

* try

* test

* try

* test

* use bash for linux

* test

* test

* try

* try

* replace netifaces by psutil

* Update ci/run_tests/requirements.txt

* temporarily disable other tests

* test

* format code

* test

* Revert "temporarily disable other tests"

This reverts commit 5f80c36.

* try activate venv for pre-commit

* Revert "try activate venv for pre-commit"

This reverts commit 7b18e8b.

* python3

* try

* add "Prepare environment for tests" step

* fix

* fix

* add a comment

---------

Co-authored-by: zhengfeihe <hezhengfei1999@gmail.com>
  • Loading branch information
tigercosmos and zhengfeihe authored Aug 19, 2024
1 parent c845b40 commit 9d175ca
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 21 deletions.
52 changes: 31 additions & 21 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
apk update && apk add cppcheck python3-dev
python3 -m pip install cmake-format clang-format==18.1.6
# TODO: investigate how to run pre-commit with `venv`
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

- name: CMake format
Expand All @@ -52,29 +53,24 @@ jobs:
container: seladb/${{ matrix.image }}
strategy:
matrix:
include:
include: # Check the images at https://github.com/seladb/PcapPlusPlus-DockerImages
- image: ubuntu2404
config-zstd: OFF
- image: ubuntu2204
python: python3
config-zstd: OFF
- image: ubuntu2204-icpx
python: python3
config-zstd: OFF
additional-flags: -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx
additional-gcov-flags: --gcov-executable "llvm-cov gcov"
- image: ubuntu2004
python: python3
config-zstd: OFF
- image: rhel94
python: python3
config-zstd: OFF
- image: ubuntu2004-zstd
python: python3
config-zstd: ON
- image: fedora39
python: python3
config-zstd: OFF
- image: alpine317
python: python3
config-zstd: OFF

steps:
Expand Down Expand Up @@ -109,18 +105,23 @@ jobs:
- name: Build PcapPlusPlus
run: cmake --build "$BUILD_DIR" -j

- name: Prepare environment for tests
run: |
python3 -m venv ./venv
. ./venv/bin/activate
python3 -m pip install -r ci/run_tests/requirements.txt
- name: Test PcapPlusPlus
run: |
${{ matrix.python }} -m pip install -U pip
${{ matrix.python }} -m pip install -r ci/run_tests/requirements.txt
${{ matrix.python }} ci/run_tests/run_tests.py --interface eth0 ${{ matrix.test-flags }}
. ./venv/bin/activate
python3 ci/run_tests/run_tests.py --interface eth0 ${{ matrix.test-flags }}
- name: Test Examples
run: |
. ./venv/bin/activate
cd Tests/ExamplesTest
${{ matrix.python }} -m pip install -U pip
${{ matrix.python }} -m pip install -r requirements.txt
${{ matrix.python }} -m pytest --interface eth0 --root-path=../../Dist/examples_bin
python3 -m pip install -r requirements.txt
python3 -m pytest --interface eth0 --root-path=../../Dist/examples_bin
- name: Check installation
run: |
Expand All @@ -138,7 +139,8 @@ jobs:

- name: Create Cobertura Report
run: |
${{ matrix.python }} -m pip install gcovr
. ./venv/bin/activate
python3 -m pip install gcovr
gcovr -v -r . ${{ matrix.additional-gcov-flags }} $GCOVR_FLAGS -o coverage.xml
- name: Upload Coverage Results
Expand Down Expand Up @@ -343,19 +345,23 @@ jobs:
- name: Check architecture
run: lipo $BUILD_DIR/Pcap++/libPcap++.a -verify_arch ${{ matrix.arch }}

- name: Prepare environment for tests
run: |
python -m venv ./venv
. ./venv/bin/activate
python -m pip install -r ci/run_tests/requirements.txt
- name: Test PcapPlusPlus
# We can't run cross compiled binaries
if: ${{ matrix.host-arch == matrix.arch }}
run: |
python -m pip install -U pip
python -m pip install -r ci/run_tests/requirements.txt
. ./venv/bin/activate
python ci/run_tests/run_tests.py --interface en0
- name: Test Examples
if: ${{ matrix.host-arch == matrix.arch }}
run: |
cd Tests/ExamplesTest
python -m pip install -U pip
python -m pip install -r requirements.txt
python -m pytest --interface en0 --use-sudo --root-path=../../Dist/examples_bin
Expand Down Expand Up @@ -605,7 +611,6 @@ jobs:
echo "Testing PcapPlusPlus examples"
cd Tests/ExamplesTest
python3 -m ensurepip
python3 -m pip install -r requirements.txt
python3 -m pytest --interface "$interface_name" --root-path=../../Dist/examples_bin
Expand Down Expand Up @@ -709,10 +714,15 @@ jobs:
- name: Build PcapPlusPlus
run: cmake --build $BUILD_DIR -j

- name: Test PcapPlusPlus
- name: Prepare environment for tests
run: |
python -m pip install -U pip
python -m venv ./venv
. ./venv/bin/activate
python -m pip install -r ci/run_tests/requirements.txt
- name: Test PcapPlusPlus
run: |
. ./venv/bin/activate
python ci/run_tests/run_tests.py --interface eth0 --use-sudo --pcap-test-args="-t xdp"
- name: Create Cobertura Report
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
strategy:
matrix:
include:
- image: ubuntu2404
config-zstd: OFF
- image: ubuntu2204
config-zstd: OFF
- image: ubuntu2204-icpx
Expand Down

0 comments on commit 9d175ca

Please sign in to comment.