Skip to content

feat: add Windows platform support with ETW, inline hooking, and Npcap #254

feat: add Windows platform support with ETW, inline hooking, and Npcap

feat: add Windows platform support with ETW, inline hooking, and Npcap #254

Workflow file for this run

name: Android E2E Tests
on:
pull_request:
branches: [ master, v2, v1 ]
push:
branches: [ master, v2, v1 ]
workflow_dispatch:
permissions:
contents: read
issues: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
android-e2e-tests:
runs-on: ubuntu-latest
name: Android E2E Tests
strategy:
matrix:
api-level: [35] # Android 15
target: [google_apis]
arch: [x86_64] # Use x86_64 for emulator (host arch matches)
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: 'recursive'
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.12'
- name: Install Required Tools
run: |
sudo apt-get update
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 flex bison linux-tools-common linux-tools-generic gcc libssl-dev linux-source libpulse0 xvfb libxcb-cursor0 libxkbcommon-x11-0
for tool in "clang" "llc" "llvm-strip"
do
sudo rm -f /usr/bin/$tool
sudo ln -s /usr/bin/$tool-14 /usr/bin/$tool
done
cd /usr/src
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
sudo tar -xf $source_file
cd $source_dir
test -f .config || sudo make oldconfig
shell: bash
- uses: actions/checkout@v6
with:
submodules: 'recursive'
fetch-depth: 0
- name: Build ecapture for Android
run: |
# Build for x86_64 (for emulator testing)
ANDROID=1 make clean
ANDROID=1 make env
echo "Building ecapture for Android (x86_64)..."
CROSS_ARCH=amd64 ANDROID=1 make nocore -j$(nproc)
# Verify binary
if [ ! -f bin/ecapture ]; then
echo "❌ Failed to build ecapture binary"
exit 1
fi
echo "=== Binary Info ==="
ls -lh bin/ecapture
file bin/ecapture
# Verify x86_64 architecture
if ! file bin/ecapture | grep -q "x86-64\|x86_64"; then
echo "❌ Binary is not x86_64"
exit 1
fi
echo "✓ ecapture built successfully for Android x86_64"
- name: Build Go test client for Android
run: |
cd test/e2e
echo "Building Go HTTPS client for Android..."
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o android/go_https_client_android go_https_client.go
if [ -f android/go_https_client_android ]; then
echo "✓ Go client built successfully"
ls -lh android/go_https_client_android
file android/go_https_client_android
else
echo "⚠️ Go client build failed (tests will use curl)"
fi
- name: Start Xvfb for headless display
run: |
echo "Starting Xvfb virtual display..."
sudo Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
echo "DISPLAY=:99" >> $GITHUB_ENV
sleep 2
echo "✓ Xvfb started on display :99"
- name: Enable KVM group permissions
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: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.arch }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
force-avd-creation: false
ram-size: 4096M
disk-size: 8192M
emulator-options: -no-window -no-snapshot-save -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: echo "Generated AVD snapshot for caching."
- name: Run Android E2E Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
force-avd-creation: false
ram-size: 4096M
disk-size: 8192M
emulator-options: -no-snapshot-save -noaudio -no-boot-anim -camera-back none -writable-system
disable-animations: true
script: |
echo "=== Android Emulator Info ==="
adb devices
adb shell getprop ro.build.version.release
adb shell getprop ro.build.version.sdk
adb shell uname -a
echo "=== Getting root access ==="
adb root
sleep 5
adb wait-for-device
echo "=== Checking root ==="
adb shell id
echo "=== Setting SELinux to permissive ==="
adb shell setenforce 0 || true
adb shell getenforce
echo "=== Setup environment ==="
bash test/e2e/android/setup_android_env.sh || true
echo "=== Checking ecapture startup (diagnostic) ==="
adb push bin/ecapture /data/local/tmp/ecapture
adb shell chmod 755 /data/local/tmp/ecapture
echo "--- Verifying eBPF / ecapture can start (3s sample) ---"
adb shell "setsid nohup /data/local/tmp/ecapture tls -m text > /data/local/tmp/ecapture_startup.log 2>&1 < /dev/null &"
sleep 3
adb shell "ps -A | grep ecapture || echo '(no ecapture process found)'"
adb shell "cat /data/local/tmp/ecapture_startup.log 2>/dev/null || echo '(no startup log)'"
adb shell "ps -A | grep ecapture | awk '{print \$2}' | while read p; do kill -9 \$p; done 2>/dev/null || true"
echo "--- ecapture diagnostic complete ---"
bash test/e2e/android/run_android_e2e_tests.sh
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: android-e2e-test-logs
path: /tmp/ecapture_android_*
retention-days: 7