name: Android CI on: [push, pull_request] concurrency: group: build-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: build: name: Build APK and Run Unit Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.4.0 - name: Set up JDK uses: actions/setup-java@v2.5.0 with: distribution: "temurin" java-version: 8 - name: Cache packages id: cache-packages uses: actions/cache@v2.1.7 with: path: | ~/.gradle/caches ~/.gradle/wrapper key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} restore-keys: gradle-packages-${{ runner.os }} - name: Build with Gradle and run Unit Tests run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage --stacktrace - name: Upload Test Report to Codecov run: | curl -Os https://uploader.codecov.io/latest/linux/codecov chmod +x codecov ./codecov -f "app/build/reports/jacoco/testBetaDebugUnitTestCoverage/testBetaDebugUnitTestCoverage.xml" -Z - name: Generate betaDebug APK run: bash ./gradlew assembleBetaDebug --stacktrace - name: Upload betaDebug APK uses: actions/upload-artifact@v2.3.1 with: name: betaDebugAPK path: app/build/outputs/apk/beta/debug/app-*.apk - name: Generate prodDebug APK run: bash ./gradlew assembleProdDebug --stacktrace - name: Upload prodDebug APK uses: actions/upload-artifact@v2.3.1 with: name: prodDebugAPK path: app/build/outputs/apk/prod/debug/app-*.apk