Update README.md #220
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Create empty google services json file | |
run: touch ${GITHUB_WORKSPACE}/app/google-services.json | |
- name: Copy dummy google services json file | |
run: cp ${GITHUB_WORKSPACE}/.github/workflows/dummy-google-services.json ${GITHUB_WORKSPACE}/app/google-services.json | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Build the app | |
run: ./gradlew assembleDebug | |
- name: Upload apk | |
uses: actions/upload-artifact@v2 | |
with: | |
name: debug apk | |
path: app/build/outputs/apk/debug/app-debug.apk | |
test: | |
runs-on: macos-latest | |
needs: build | |
strategy: | |
matrix: | |
api-level: [29] | |
target: [default] | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: List contents of location | |
run: ls ${GITHUB_WORKSPACE}; ls ${GITHUB_WORKSPACE}/app | |
- name: Download google services json file | |
run: curl -o ${GITHUB_WORKSPACE}/app/google-services.json https://raw.githubusercontent.com/SaiPavanYalla/XpensAuditor/main/app/google-services.json | |
- name: Run unit & Instrumentation Tests | |
uses: reactivecircus/[email protected] | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: x86 | |
profile: Nexus 6 | |
script: ./gradlew jacocoAllCombinedTestReport --scan | |
- name: Upload coverage to Codecov | |
run: | | |
curl -Os https://uploader.codecov.io/latest/macos/codecov | |
chmod +x codecov | |
./codecov | |