From 49274c5dbde7dadac70955e0225eff83af626e3e Mon Sep 17 00:00:00 2001 From: Madhur Gupta <30932899+madhurgupta10@users.noreply.github.com> Date: Thu, 3 Feb 2022 11:22:57 +0530 Subject: [PATCH] Update CI with latest versions, artifacts and caching (#4785) * Auto generate apk after build is complete * Add cache * Fix syntax error * Fix syntax error * Fix artifact name not valid error --- .github/workflows/android.yml | 59 +++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 24bf1b5ce..d36ed6566 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -8,18 +8,51 @@ concurrency: jobs: build: - runs-on: ubuntu-18.04 + name: Build APK and Run Unit Tests + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build with Gradle - run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage - - name: Upload Test Report - run: | - curl -Os https://uploader.codecov.io/latest/linux/codecov - chmod +x codecov - ./codecov -f "app/build/reports/jacoco/testBetaDebugUnitTestCoverage/testBetaDebugUnitTestCoverage.xml" -Z + - 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