You've already forked android-client
mirror of
https://github.com/netbirdio/android-client.git
synced 2026-05-22 17:10:49 -07:00
029585a971
* Add network connectivity stress test for VPN resilience Instrumented test that simulates real-world network disruptions (WiFi/mobile switching, airplane mode, flapping, long outages) and verifies VPN recovery via ping. Auto-detects real device vs emulator and uses appropriate network control strategy for each. * Fix review findings: resource leak, version bump, markdown lint - Use try-with-resources in sendEmulatorConsoleCommand to prevent socket leak - Bump testRules version from 1.6.1 to 1.7.0 - Add language specifier to fenced code block in README * Fix review findings: restore in finally, label mismatch, readUntilOK error handling - Always call disruption.restore in finally block to prevent stale network state - Fix EMU latency label from 5s to 10s to match actual delay value - Make readUntilOK propagate IOException and detect KO/EOF failures * Exclude NetworkConnectivityStressTest from CI This test requires a configured VPN and real network interfaces, so it cannot run on the CI emulator. Run it manually on a real device.
137 lines
3.6 KiB
YAML
137 lines
3.6 KiB
YAML
name: build debug
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-debug:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
apk_path: ${{ steps.build.outputs.apk_path }}
|
|
bundle_path: ${{ steps.build.outputs.bundle_path }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Get short Git hash
|
|
id: version
|
|
run: |
|
|
SHORT_GIT_SHA=$(git rev-parse --short HEAD)
|
|
echo "version_name=ci-${SHORT_GIT_SHA}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build Android
|
|
id: build
|
|
uses: ./.github/actions/build-android
|
|
with:
|
|
version_name: ${{ steps.version.outputs.version_name }}
|
|
build_type: debug
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: debug-artifacts-${{ steps.version.outputs.version_name }}
|
|
path: |
|
|
${{ steps.build.outputs.apk_path }}
|
|
${{ steps.build.outputs.bundle_path }}
|
|
retention-days: 3
|
|
|
|
- name: Upload AAR artifact for tests
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: netbird-aar
|
|
path: ${{ steps.build.outputs.aar_path }}
|
|
retention-days: 1
|
|
|
|
unit-tests:
|
|
needs: build-debug
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: "17"
|
|
distribution: "adopt"
|
|
cache: "gradle"
|
|
|
|
- name: Download AAR artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: netbird-aar
|
|
path: gomobile
|
|
|
|
- name: Run unit tests
|
|
run: ./gradlew test --no-daemon
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: unit-test-results
|
|
path: |
|
|
app/build/reports/tests/
|
|
tool/build/reports/tests/
|
|
retention-days: 3
|
|
|
|
instrumented-tests:
|
|
needs: build-debug
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: "17"
|
|
distribution: "adopt"
|
|
cache: "gradle"
|
|
|
|
- name: Download AAR artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: netbird-aar
|
|
path: gomobile
|
|
|
|
- name: Enable KVM group perms
|
|
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 instrumented tests
|
|
uses: reactivecircus/android-emulator-runner@v2
|
|
with:
|
|
api-level: 30
|
|
target: google_apis
|
|
arch: x86_64
|
|
profile: pixel_3a
|
|
disk-size: 4096M
|
|
heap-size: 512M
|
|
disable-animations: true
|
|
script: ./gradlew connectedDebugAndroidTest --no-daemon -Pandroid.testInstrumentationRunnerArguments.notClass=io.netbird.client.NetworkConnectivityStressTest
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: instrumented-test-results
|
|
path: |
|
|
app/build/reports/androidTests/
|
|
tool/build/reports/androidTests/
|
|
retention-days: 3
|