Files
android-client/.github/workflows/build-debug.yml
Zoltan Papp 1d40d8f095 Align the Android client with the iOS and desktop clients (#179)
Reworks the Android UI, and brings over features the desktop client already had.
2026-09-08 10:19:16 +02:00

150 lines
4.3 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: Read the daemon JDK version
id: jdk
shell: bash
run: echo "version=$(sed -n 's/^toolchainVersion=//p' gradle/gradle-daemon-jvm.properties)" >> "$GITHUB_OUTPUT"
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ steps.jdk.outputs.version }}
distribution: "temurin"
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: Read the daemon JDK version
id: jdk
shell: bash
run: echo "version=$(sed -n 's/^toolchainVersion=//p' gradle/gradle-daemon-jvm.properties)" >> "$GITHUB_OUTPUT"
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ steps.jdk.outputs.version }}
distribution: "temurin"
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
# The e2e package needs a setup key for a live account, which only the
# private mobile-e2e repo holds, so it is excluded here along with the
# long-running stress test.
script: ./gradlew connectedDebugAndroidTest --no-daemon -Pandroid.testInstrumentationRunnerArguments.notClass=io.netbird.client.NetworkConnectivityStressTest -Pandroid.testInstrumentationRunnerArguments.notPackage=io.netbird.client.e2e
- 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