diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..2967959 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,59 @@ +name: Android + +on: + push: + branches: [main] + paths: + - "Android/**" + - ".github/workflows/android.yml" + pull_request: + paths: + - "Android/**" + - ".github/workflows/android.yml" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: android-${{ github.ref }} + cancel-in-progress: true + +jobs: + unit-tests: + name: Unit tests + runs-on: ubuntu-latest + timeout-minutes: 30 + defaults: + run: + working-directory: Android + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + + # Caches Gradle and validates the wrapper JAR checksum. + - uses: gradle/actions/setup-gradle@v4 + + # :glasses pins an NDK and CMake that the runner image doesn't ship; AGP resolves + # them at configuration time even when no native task runs. + - name: Install NDK and CMake + run: | + SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" + yes | "$SDKMANAGER" --licenses > /dev/null + "$SDKMANAGER" --install "ndk;30.0.14904198" "cmake;4.1.2" > /dev/null + + # The VITURE SDK (glasses/src/main/jniLibs, cpp/include) is not in the repo, so CI + # runs JVM unit tests only — no native build, no APK. + - name: Run unit tests + run: sh ./gradlew testDebugUnitTest --console=plain + + - name: Upload test reports + if: failure() + uses: actions/upload-artifact@v4 + with: + name: unit-test-reports + path: Android/**/build/reports/tests/