Skip to content

Commit

Permalink
Merge pull request #12 from egecetin/attestation
Browse files Browse the repository at this point in the history
Attestation update
  • Loading branch information
egecetin authored Aug 25, 2024
2 parents ba4fe72 + c69aad1 commit a6d4cda
Show file tree
Hide file tree
Showing 198 changed files with 37,622 additions and 34,404 deletions.
113 changes: 65 additions & 48 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ env:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
Expand All @@ -32,6 +36,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 +57,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 All @@ -95,7 +95,10 @@ jobs:
id: ccache-restore
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ env.CCACHE_DIR }}
path: |
${{ env.CCACHE_DIR }}
!*.gcda
!*.gcno
key: ${{ matrix.image }}-ccache-${{ github.run_id }}
restore-keys: |
${{ matrix.image }}-ccache
Expand All @@ -106,18 +109,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 @@ -133,20 +141,21 @@ jobs:
- name: Test Tutorials
run: cd build_examples/tutorials_bin && ./Tutorial-HelloWorld

# - name: Create Cobertura Report
# run: |
# ${{ matrix.python }} -m pip install gcovr
# gcovr -v -r . ${{ matrix.additional-gcov-flags }} $GCOVR_FLAGS -o coverage.xml

# - name: Upload Coverage Results
# uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
# with:
# files: ./coverage.xml
# flags: ${{ matrix.image }},unittest
# fail_ci_if_error: false
# verbose: true
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Create Cobertura Report
run: |
. ./venv/bin/activate
python3 -m pip install gcovr
gcovr -v -r . ${{ matrix.additional-gcov-flags }} $GCOVR_FLAGS -o coverage.xml
- name: Upload Coverage Results
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: ./coverage.xml
flags: ${{ matrix.image }},unittest
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Save Ccache
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
Expand Down Expand Up @@ -340,19 +349,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 All @@ -378,16 +391,16 @@ jobs:
python3 -m pip install gcovr
gcovr -v -r . $GCOVR_FLAGS -o coverage.xml
# - name: Upload Coverage Results
# uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
# if: ${{ matrix.host-arch == matrix.arch }}
# with:
# files: ./coverage.xml
# flags: ${{ matrix.os-version }},unittest
# fail_ci_if_error: false
# verbose: true
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Coverage Results
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
if: ${{ matrix.host-arch == matrix.arch }}
with:
files: ./coverage.xml
flags: ${{ matrix.os-version }},unittest
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Save Ccache
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
Expand Down Expand Up @@ -468,7 +481,7 @@ jobs:
run: gcovr -v -g -k -r . $env:GCOVR_FLAGS.split() -o coverage.xml

- name: Upload Coverage Results
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: ./coverage.xml
flags: ${{ matrix.sys }},unittest
Expand Down Expand Up @@ -559,7 +572,7 @@ jobs:
python -m pytest --root-path=../../Dist/examples_bin
- name: Upload Coverage Results
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: ./Tests/Pcap++Test/Pcap++Coverage.xml,./Tests/Packet++Test/Packet++Coverage.xml
flags: ${{ matrix.os }},unittest,${{ matrix.pcap_lib }}
Expand Down Expand Up @@ -602,7 +615,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 @@ -706,10 +718,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 All @@ -718,7 +735,7 @@ jobs:
gcovr -v -r . $GCOVR_FLAGS -o coverage.xml
- name: Upload Coverage Results
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: ./coverage.xml
flags: xdp,unittest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
Fuzzing:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
doxygen:
runs-on: ubuntu-latest
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
strategy:
matrix:
include:
- image: ubuntu2404
config-zstd: OFF
- image: ubuntu2204
config-zstd: OFF
- image: ubuntu2204-icpx
Expand Down Expand Up @@ -69,7 +71,6 @@ jobs:
run: cmake --build "$BUILD_DIR" --target package

- name: Generate artifact attestation
id: attestation
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-path: "${{ env.BUILD_DIR }}/*.tar.gz,${{ env.BUILD_DIR }}/*.deb,${{ env.BUILD_DIR }}/*.rpm"
Expand Down Expand Up @@ -112,7 +113,6 @@ jobs:
cmake --build "$BUILD_DIR" --target package
- name: Generate artifact attestation
id: attestation
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-path: "${{ env.BUILD_DIR }}/*.tar.gz"
Expand All @@ -127,14 +127,14 @@ jobs:
artifacts: "${{ env.BUILD_DIR }}/*.tar.gz"

macos:
runs-on: macos-12
runs-on: macos-14
permissions:
contents: write
attestations: write
id-token: write
strategy:
matrix:
xcode-version: [14.2.0, 13.4.1]
xcode-version: [15.4, 14.3.1]
arch: [x86_64, arm64]

steps:
Expand All @@ -156,7 +156,6 @@ jobs:
run: cmake --build "$BUILD_DIR" --target package

- name: Generate artifact attestation
id: attestation
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-path: "${{ env.BUILD_DIR }}/*.tar.gz,${{ env.BUILD_DIR }}/*.pkg"
Expand Down Expand Up @@ -227,7 +226,6 @@ jobs:
run: cmake --build "$BUILD_DIR" --target package

- name: Generate artifact attestation
id: attestation
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-path: "${{ env.BUILD_DIR }}/*.zip"
Expand Down Expand Up @@ -277,7 +275,6 @@ jobs:
run: cmake --build "$env:BUILD_DIR" --config ${{ matrix.configuration }} --target package

- name: Generate artifact attestation
id: attestation
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-path: "${{ env.BUILD_DIR }}/*.zip"
Expand Down Expand Up @@ -368,7 +365,6 @@ jobs:
tar cvf "${PACKAGE_DIR}.tar.gz" "${PACKAGE_DIR}"
- name: Generate artifact attestation
id: attestation
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-path: "${{ env.PACKAGE_DIR }}.tar.gz"
Expand Down
16 changes: 13 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-shebang-scripts-are-executable
- id: check-merge-conflict
- id: check-symlinks
- id: end-of-file-fixer
- id: forbid-submodules
- id: mixed-line-ending
args: ['--fix=lf']
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
Expand All @@ -23,8 +29,8 @@ repos:
rev: v1.3.5
hooks:
- id: clang-format
args: ["--style=file"] # Use the .clang-format file for configuration
files: ^(Common\+\+|Tests|Examples)/.*\.(cpp|h)$
args: ["--style=file", "-i"] # Use the .clang-format file for configuration and apply all fixes
files: ^(Common\+\+|Packet\+\+|Pcap\+\+|Tests|Examples)/.*\.(cpp|h)$
- id: cppcheck
args: ["--std=c++11", "--language=c++", "--suppressions-list=cppcheckSuppressions.txt", "--inline-suppr", "--force"]
- repo: https://github.com/codespell-project/codespell
Expand All @@ -38,3 +44,7 @@ repos:
- id: typos
args: ['--config=typos-config.toml']
pass_filenames: false
- repo: https://github.com/lovesegfault/beautysh
rev: v6.2.1
hooks:
- id: beautysh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ typedef struct _light_pcapng_file_info {
size_t user_app_desc_size;
size_t interface_block_count;
uint16_t link_types[MAX_SUPPORTED_INTERFACE_BLOCKS];
double timestamp_resolution[MAX_SUPPORTED_INTERFACE_BLOCKS];
uint64_t timestamp_ticks_per_second[MAX_SUPPORTED_INTERFACE_BLOCKS]; // PCPP patch

} light_pcapng_file_info;

Expand Down
Loading

0 comments on commit a6d4cda

Please sign in to comment.