Update android_ci.yml #37
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: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up Java JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
cache-dependency-path: | | |
**/*.gradle* | |
**/gradle-wrapper.properties | |
- name: Replace ADMOB_APP_ID in AndroidManifest.xml | |
run: sed -i 's/${ADMOB_APP_ID}/${{ secrets.ADMOB_APP_ID }}/g' app/src/main/AndroidManifest.xml | |
lint: | |
name: Perform lint check | |
needs: [setup] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up Java JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
cache-dependency-path: | | |
**/*.gradle* | |
**/gradle-wrapper.properties | |
- name: Replace ADMOB_APP_ID in AndroidManifest.xml | |
run: sed -i 's/${ADMOB_APP_ID}/${{ secrets.ADMOB_APP_ID }}/g' app/src/main/AndroidManifest.xml | |
- name: Make Gradle executable | |
run: chmod +x ./gradlew | |
- name: Run lint | |
run: ./gradlew lintDebug | |
- name: Upload html test report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lint.html | |
path: app/build/reports/lint-results-debug.html | |
unit-test: | |
name: Perform Unit Testing | |
needs: [lint] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up Java JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
cache-dependency-path: | | |
**/*.gradle* | |
**/gradle-wrapper.properties | |
- name: Replace ADMOB_APP_ID in AndroidManifest.xml | |
run: sed -i 's/${ADMOB_APP_ID}/${{ secrets.ADMOB_APP_ID }}/g' app/src/main/AndroidManifest.xml | |
- name: Run tests | |
run: ./gradlew test | |
- name: Upload test report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unit_test_report | |
path: app/build/reports/test/testDebugUnitTest/ | |
instrumentation-test: | |
name: Perform Instrumentation Testing | |
needs: [unit-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up Java JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
cache-dependency-path: | | |
**/*.gradle* | |
**/gradle-wrapper.properties | |
- name: Replace ADMOB_APP_ID in AndroidManifest.xml | |
run: sed -i 's/${ADMOB_APP_ID}/${{ secrets.ADMOB_APP_ID }}/g' app/src/main/AndroidManifest.xml | |
- name: Run espresso tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
script: ./gradlew check | |
- name: Upload Instrumentation Test report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: instrumentation_test_report | |
path: app/build/reports/androidTests/connected | |
debug-apk: | |
name: Generate Debug APK | |
needs: [instrumentation-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up Java JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
cache-dependency-path: | | |
**/*.gradle* | |
**/gradle-wrapper.properties | |
- name: Replace ADMOB_APP_ID in AndroidManifest.xml | |
run: sed -i 's/${ADMOB_APP_ID}/${{ secrets.ADMOB_APP_ID }}/g' app/src/main/AndroidManifest.xml | |
- name: Build debug APK | |
run: ./gradlew assembleDebug --stacktrace | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: stacompanion | |
path: app/build/outputs/apk/debug/*.apk |