Skip to content

Commit

Permalink
Move doxygen to GitHub Actions (#1458)
Browse files Browse the repository at this point in the history
* Checkout docs repo

* Checkout docs repo

* Checkout docs repo

* Run doxygen

* Run doxygen

* Run doxygen

* Test if doxygen would fail

* Revert

* Prepare documentation

* Fix

* Fix

* Try `ref_name`

* fix

* fix

* fix

* fix

* Fix prepare documentation

* Fix prepare documentation

* Fix prepare documentation

* Upload documentation

* Upload documentation

* Upload documentation

* Upload documentation

* Upload documentation

* Revert changes

* Try to use Ubuntu 22.04

* - Cleanup
- Remove build documentation from Cirrus CI
- Temporary comment out the rest of Cirrus CI tasks

* Move to a new workflow

* Cleanup
  • Loading branch information
seladb authored Jun 23, 2024
1 parent e3128c6 commit 62fc719
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 94 deletions.
159 changes: 65 additions & 94 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,68 @@ env:
BUILD_DIR: "build"
GCOVR_FLAGS: "--gcov-ignore-parse-errors --exclude-throw-branches --filter Common --filter Pcap --filter Packet --xml"

task:
name: Test FreeBSD
freebsd_instance:
matrix:
image_family: freebsd-13-3
image_family: freebsd-14-0
install_script:
- pkg install -y bash cmake git gmake gsed libpcap tcpreplay
configure_script:
# Ensure user have access to network devices instead of giving super-user right
- chmod a+rw /dev/bpf*
- cmake -S . -B Dist
build_script:
- cmake --build Dist -j 2
test_pcapplusplus_script:
- ifconfig vtnet0 promisc
- python -m ensurepip
- python -m pip install -r ci/run_tests/requirements.txt
- python ci/run_tests/run_tests.py --interface vtnet0
test_examples_script:
- cd Tests/ExamplesTest
- python -m ensurepip
- python -m pip install -r requirements.txt
- python -m pytest --interface vtnet0 --root-path=../../Dist/examples_bin

task:
name: Test Zstd Linux
container:
image: seladb/ubuntu2004-zstd:latest
configure_script:
- cmake -DLIGHT_PCAPNG_ZSTD=ON -DPCAPPP_BUILD_COVERAGE=ON -S . -B Dist
build_script:
- cmake --build Dist -j 2
test_pcapplusplus_script:
- python3 -m pip install gcovr
- python3 -m pip install -r ci/run_tests/requirements.txt
- python3 ci/run_tests/run_tests.py --interface eth0
coverage_report_script:
- gcovr -v -r . $GCOVR_FLAGS -o coverage.xml
- curl -Os https://uploader.codecov.io/latest/linux/codecov
- chmod +x codecov
- ./codecov -v -f coverage.xml -F zstd -F ubuntu2004 -F unittest || true

task:
name: Test Zstd MacOS
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-xcode:14.1
configure_script:
- brew install zstd
# Ensure user have access to network devices instead of giving super-user right
- sudo chmod a+rw /dev/bpf*
- cmake -DLIGHT_PCAPNG_ZSTD=ON -DPCAPPP_BUILD_COVERAGE=ON -S . -B Dist
build_script:
- cmake --build Dist -j 2
install_tcpreplay_gcovr_script:
- brew install tcpreplay gcovr
test_pcapplusplus_script:
- python3 -m ensurepip
- python3 -m pip install -r ci/run_tests/requirements.txt
- python3 ci/run_tests/run_tests.py --interface en0 --pcap-test-args="-x TestPcapLiveDeviceSpecialCfg"
coverage_report_script:
- gcovr -v -r . $GCOVR_FLAGS -o coverage.xml
- curl -Os https://uploader.codecov.io/latest/macos/codecov
- chmod +x codecov
- ./codecov -v -f coverage.xml -F zstd -F macos-ventura -F unittest || true

task:
name: Build Doxygen Documentation
container:
image: seladb/ubuntu1804:latest
env:
- GITHUB_EMAIL: ENCRYPTED[ae4956ec74c9f329f7787cdfe3a6b5842870659275d0a9b513a0f6e64cd9c71cd2eb64219a9dc695f446fbd93c48fb04]
- GITHUB_TOKEN: ENCRYPTED[ab88249da2005c70f25f5910b08e907139f73bc0efb31a19b33f832e9e3bffe3cfc8e81932f21d7734c7aceca2a77188]
get_code_script:
- git clone https://github.com/PcapPlusPlus/pcapplusplus.github.io.git
configure_script:
- cmake -DPCAPPP_BUILD_EXAMPLES=OFF -DPCAPPP_BUILD_TESTS=OFF -B build -S .
build_script:
- cmake --build build -j 2
build_documentation_script:
- cd pcapplusplus.github.io/static/api-docs/next/doxygen
- doxygen Doxyfile-ci
upload_documentation_script: |
if [ "$CIRRUS_BRANCH" == "master" -a "$CIRRUS_REPO_OWNER" == "seladb" ]; then
find pcapplusplus.github.io/static/api-docs/next/ -maxdepth 1 -type f -exec rm {} \;
rm -rf pcapplusplus.github.io/static/api-docs/next/search/
mv pcapplusplus.github.io/static/api-docs/next/html/* pcapplusplus.github.io/static/api-docs/next/
cd pcapplusplus.github.io/static/api-docs/next/
git config user.name "seladb"
git config user.email "${GITHUB_EMAIL}"
git add .
git commit -m "Update API documentation for commit ${CIRRUS_CHANGE_IN_REPO}"
git push --quiet "https://${GITHUB_TOKEN}@github.com/PcapPlusPlus/pcapplusplus.github.io" master
fi
#task:
# name: Test FreeBSD
# freebsd_instance:
# matrix:
# image_family: freebsd-13-3
# image_family: freebsd-14-0
# install_script:
# - pkg install -y bash cmake git gmake gsed libpcap tcpreplay
# configure_script:
# # Ensure user have access to network devices instead of giving super-user right
# - chmod a+rw /dev/bpf*
# - cmake -S . -B Dist
# build_script:
# - cmake --build Dist -j 2
# test_pcapplusplus_script:
# - ifconfig vtnet0 promisc
# - python -m ensurepip
# - python -m pip install -r ci/run_tests/requirements.txt
# - python ci/run_tests/run_tests.py --interface vtnet0
# test_examples_script:
# - cd Tests/ExamplesTest
# - python -m ensurepip
# - python -m pip install -r requirements.txt
# - python -m pytest --interface vtnet0 --root-path=../../Dist/examples_bin
#
#task:
# name: Test Zstd Linux
# container:
# image: seladb/ubuntu2004-zstd:latest
# configure_script:
# - cmake -DLIGHT_PCAPNG_ZSTD=ON -DPCAPPP_BUILD_COVERAGE=ON -S . -B Dist
# build_script:
# - cmake --build Dist -j 2
# test_pcapplusplus_script:
# - python3 -m pip install gcovr
# - python3 -m pip install -r ci/run_tests/requirements.txt
# - python3 ci/run_tests/run_tests.py --interface eth0
# coverage_report_script:
# - gcovr -v -r . $GCOVR_FLAGS -o coverage.xml
# - curl -Os https://uploader.codecov.io/latest/linux/codecov
# - chmod +x codecov
# - ./codecov -v -f coverage.xml -F zstd -F ubuntu2004 -F unittest || true
#
#task:
# name: Test Zstd MacOS
# macos_instance:
# image: ghcr.io/cirruslabs/macos-ventura-xcode:14.1
# configure_script:
# - brew install zstd
# # Ensure user have access to network devices instead of giving super-user right
# - sudo chmod a+rw /dev/bpf*
# - cmake -DLIGHT_PCAPNG_ZSTD=ON -DPCAPPP_BUILD_COVERAGE=ON -S . -B Dist
# build_script:
# - cmake --build Dist -j 2
# install_tcpreplay_gcovr_script:
# - brew install tcpreplay gcovr
# test_pcapplusplus_script:
# - python3 -m ensurepip
# - python3 -m pip install -r ci/run_tests/requirements.txt
# - python3 ci/run_tests/run_tests.py --interface en0 --pcap-test-args="-x TestPcapLiveDeviceSpecialCfg"
# coverage_report_script:
# - gcovr -v -r . $GCOVR_FLAGS -o coverage.xml
# - curl -Os https://uploader.codecov.io/latest/macos/codecov
# - chmod +x codecov
# - ./codecov -v -f coverage.xml -F zstd -F macos-ventura -F unittest || true
48 changes: 48 additions & 0 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build doxygen
on:
push:
branches: ["master", "dev"]
pull_request:
branches: ["dev"]

permissions:
contents: read

jobs:
doxygen:
runs-on: ubuntu-latest
container: seladb/ubuntu2204:latest
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- name: Checkout docs repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: PcapPlusPlus/pcapplusplus.github.io
path: pcapplusplus.github.io

- name: Run doxygen
run: |
cd pcapplusplus.github.io/static/api-docs/next/doxygen
doxygen Doxyfile-ci
- name: Prepare documentation
if: github.ref_name == 'refs/heads/master'
run: |
cd pcapplusplus.github.io/static/api-docs/
find next/ -maxdepth 1 -type f -exec rm {} \;
rm -rf next/search/
mv next/html/* next/
- name: Upload documentation
if: github.ref_name == 'refs/heads/master'
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: pcapplusplus.github.io
destination-github-username: "PcapPlusPlus"
destination-repository-name: "pcapplusplus.github.io"
user-email: [email protected]
commit-message: Update API documentation for commit ORIGIN_COMMIT

0 comments on commit 62fc719

Please sign in to comment.