diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 36c57f9e9..7a1e7c030 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,6 +1,6 @@ name: Android CI -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] concurrency: group: build-${{ github.event.pull_request.number || github.ref }} @@ -10,22 +10,19 @@ jobs: build: name: Run tests and generate APK runs-on: ubuntu-latest - strategy: - matrix: - api-level: [23] - steps: - - uses: actions/checkout@v2.4.0 + - name: Checkout code + uses: actions/checkout@v3 - name: Set up JDK - uses: actions/setup-java@v2.5.0 + uses: actions/setup-java@v3 with: - distribution: "temurin" - java-version: 8 + distribution: 'temurin' + java-version: '17' - name: Cache packages id: cache-packages - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 with: path: | ~/.gradle/caches @@ -33,49 +30,66 @@ jobs: key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} restore-keys: gradle-packages-${{ runner.os }} + - name: Access test login credentials + run: | + echo "TEST_USER_NAME=${{ secrets.TEST_USER_NAME }}" >> local.properties + echo "TEST_USER_PASSWORD=${{ secrets.TEST_USER_PASSWORD }}" >> local.properties + - name: AVD cache - uses: actions/cache@v2 + if: github.event_name != 'pull_request' + uses: actions/cache@v3 id: avd-cache with: path: | ~/.android/avd/* ~/.android/adb* - key: avd-${{ matrix.api-level }} + key: avd-tablet-api-24 - name: Create AVD and generate snapshot for caching - if: steps.avd-cache.outputs.cache-hit != 'true' + if: steps.avd-cache.outputs.cache-hit != 'true' && github.event_name != 'pull_request' uses: reactivecircus/android-emulator-runner@v2 with: - api-level: ${{ matrix.api-level }} + api-level: 24 force-avd-creation: false emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: false + disable-animations: true script: echo "Generated AVD snapshot for caching." - name: Run Instrumentation tests + if: github.event_name != 'pull_request' uses: reactivecircus/android-emulator-runner@v2 with: - api-level: ${{ matrix.api-level }} + api-level: 24 force-avd-creation: false emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true - profile: Nexus 6 - script: ./gradlew connectedBetaDebugAndroidTest --stacktrace + profile: Nexus 10 + script: | + adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0 + adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0 + adb emu geo fix 37.422131 -122.084801 + ./gradlew connectedBetaDebugAndroidTest --stacktrace - - name: Run Unit tests + - name: Run Unit tests with unified coverage + if: github.event_name != 'pull_request' + run: ./gradlew -Pcoverage testBetaDebugUnitTestUnifiedCoverage --stacktrace + + - name: Run Unit tests without unified coverage + if: github.event_name == 'pull_request' run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage --stacktrace - name: Upload Test Report to Codecov + if: github.event_name != 'pull_request' run: | curl -Os https://uploader.codecov.io/latest/linux/codecov chmod +x codecov - ./codecov -f "app/build/reports/jacoco/testBetaDebugUnitTestCoverage/testBetaDebugUnitTestCoverage.xml" -Z + ./codecov -f "app/build/reports/jacoco/testBetaDebugUnitTestUnifiedCoverage/testBetaDebugUnitTestUnifiedCoverage.xml" -Z - name: Generate betaDebug APK run: bash ./gradlew assembleBetaDebug --stacktrace - name: Upload betaDebug APK - uses: actions/upload-artifact@v2.3.1 + uses: actions/upload-artifact@v3 with: name: betaDebugAPK path: app/build/outputs/apk/beta/debug/app-*.apk @@ -84,7 +98,7 @@ jobs: run: bash ./gradlew assembleProdDebug --stacktrace - name: Upload prodDebug APK - uses: actions/upload-artifact@v2.3.1 + uses: actions/upload-artifact@v3 with: name: prodDebugAPK path: app/build/outputs/apk/prod/debug/app-*.apk diff --git a/.gitignore b/.gitignore index 418e4c380..e54ea2551 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,7 @@ app/src/main/jniLibs #https://docs.opencv.org/3.3.0/ /libraries/opencv/javadoc/ captures/* + +# Test and other output +app/jacoco.exec +app/CommonsContributions \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index f277755ba..5c297a65e 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -39,21 +39,18 @@