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
This commit is contained in:
Madhur Gupta 2022-02-03 11:22:57 +05:30 committed by GitHub
parent ff8f067841
commit 49274c5dbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
- uses: actions/checkout@v2.4.0
- name: Set up JDK
uses: actions/setup-java@v2.5.0
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage
- name: Upload Test Report
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