diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1a08fc9bce..e74900d500 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -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 @@ -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: @@ -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: | @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 4480207351..980b2baf96 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -26,6 +26,8 @@ jobs: strategy: matrix: include: + - image: ubuntu2404 + config-zstd: OFF - image: ubuntu2204 config-zstd: OFF - image: ubuntu2204-icpx