Add params #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test | |
on: | |
push: | |
# branches: ["master"] | |
pull_request: | |
env: | |
PCAPPLUSPLUS_LATEST_VERSION: 24.09 | |
# BUILD_DIR: build | |
jobs: | |
build-and-test: | |
strategy: | |
matrix: | |
include: | |
- run-on-os: ubuntu-latest | |
target: x86_64 | |
api-version: 35 | |
# - run-on-os: ubuntu-20.04 | |
# target: x86 | |
# api-version: 30 | |
# - run-on-os: macos-15 | |
# target: arm64-v8a | |
# cmake_configure: "-DCMAKE_OSX_ARCHITECTURES=arm64" | |
# api-version: 30 | |
# - run-on-os: macos-15 | |
# target: x86_64 | |
# cmake_configure: "-DCMAKE_OSX_ARCHITECTURES=x86_64" | |
# api-version: 30 | |
runs-on: ${{ matrix.run-on-os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
submodules: true | |
- name: Download PcapPlusPlus | |
uses: robinraju/release-downloader@v1 | |
with: | |
repository: "seladb/PcapPlusPlus" | |
tag: "v$PCAPPLUSPLUS_LATEST_VERSION" | |
fileName: "pcapplusplus-$PCAPPLUSPLUS_LATEST_VERSION-android.tar.gz" | |
out-file-path: "app/libs" | |
tarBall: true | |
extract: true | |
- name: Rename PcapPlusPlus directory | |
run: mv $GITHUB_WORKSPACE/app/libs/pcapplusplus-$PCAPPLUSPLUS_LATEST_VERSION-android $GITHUB_WORKSPACE/app/libs/pcapplusplus | |
# - name: Checkout lipbcap for Android | |
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # main | |
# with: | |
# repository: seladb/libpcap-android | |
# path: ./libpcap-android | |
# - name: Configure PcapPlusPlus | |
# run: | | |
# LIBPCAP_PATH=$(pwd)/libpcap-android | |
# cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" -DANDROID_PLATFORM="${{ matrix.api-version}}" -DANDROID_ABI="${{ matrix.target }}" -DPCAP_INCLUDE_DIR="${LIBPCAP_PATH}/include/" -DPCAP_LIBRARY="${LIBPCAP_PATH}/${{ matrix.target }}/${{ matrix.api-version}}/libpcap.a" -S . -B "$BUILD_DIR" | |
# | |
# - name: Build PcapPlusPlus | |
# run: cmake --build "$BUILD_DIR" -j | |
# | |
# - name: Checkout ToyVpn-PcapPlusPlus | |
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # master | |
# with: | |
# repository: seladb/ToyVpn-PcapPlusPlus | |
# path: ./ToyVpn-PcapPlusPlus | |
# submodules: true | |
# | |
# - name: Install locally PcapPlusPlus | |
# # CMake install library in $prefix/lib ToyVpn want $prefix/$target/$api-version | |
# run: | | |
# TOYVPN_PCAPPLUSPLUS="./ToyVpn-PcapPlusPlus/app/libs/pcapplusplus" | |
# PCAPPLUSPLUS_LIBS_PATH="$TOYVPN_PCAPPLUSPLUS/${{ matrix.target }}/${{ matrix.api-version }}" | |
# PCAPPLUSPLUS_INCLUDE_PATH="$TOYVPN_PCAPPLUSPLUS/include" | |
# cmake -DPCAPPP_BUILD_COVERAGE=OFF -S . -B "$BUILD_DIR" | |
# cmake --build "$BUILD_DIR" -j | |
# cmake --install "$BUILD_DIR" --prefix ${TOYVPN_PCAPPLUSPLUS} | |
# mkdir -p ${PCAPPLUSPLUS_LIBS_PATH} ${PCAPPLUSPLUS_INCLUDE_PATH} | |
# mv ${TOYVPN_PCAPPLUSPLUS}/lib/*.a ${PCAPPLUSPLUS_LIBS_PATH}/ | |
# mv ${TOYVPN_PCAPPLUSPLUS}/include/pcapplusplus/*.h ${PCAPPLUSPLUS_INCLUDE_PATH}/ | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: "17" | |
distribution: "zulu" | |
cache: "gradle" | |
- name: Change wrapper permissions | |
run: chmod +x ./gradlew | |
- name: Build gradle project and run tests | |
run: ./gradlew build | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Run instrumentation tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-version }} | |
arch: ${{ matrix.target }} | |
script: ./gradlew -is connectedCheck | |
# ./gradlew assembleDebug | |
# - name: Build ToyVpn-PcapPlusPlus | |
# working-directory: ./ToyVpn-PcapPlusPlus | |
# run: | | |
# NDK_VERSION=$(echo "$ANDROID_NDK" | awk -F'/' '{print $NF}') | |
# sed -i.bak "s|abiFilters.*$|abiFilters '${{ matrix.target }}'|g" app/build.gradle | |
# if [[ "${{ matrix.run-on-os }}" == "macos"* ]]; then | |
# sed -i.bak "/defaultConfig {/a\\ | |
# ndkVersion \"$NDK_VERSION\" | |
# " app/build.gradle | |
# else | |
# sed -i "/defaultConfig {/a\\ ndkVersion \"$NDK_VERSION\"" app/build.gradle | |
# fi | |
# chmod +x gradlew | |
# ./gradlew assembleDebug |