Skip to content

Merge pull request #59 from joaomanaia/user-services #220

Merge pull request #59 from joaomanaia/user-services

Merge pull request #59 from joaomanaia/user-services #220

Workflow file for this run

name: Android CI
on:
workflow_dispatch:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
permissions:
contents: read
checks: write
id-token: write
env:
JAVA_VERSION: "17"
JAVA_DISTR: 'corretto'
jobs:
test:
name: "πŸ€– Unit Tests"
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: ${{ env.JAVA_DISTR }}
java-version: ${{ env.JAVA_VERSION }}
- name: Create google-services.json file
run: cat /home/runner/work/newquiz/newquiz/app/google-services.json | base64
- name: Put google-services.json data
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $DATA > /home/runner/work/newquiz/newquiz/app/google-services.json
- name: Workaround for Android Gradle Plugin issue
run: 'echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" > local.properties'
- name: Setup gradle
uses: gradle/[email protected]
- name: Run tests
run: ./gradlew testAllUnitTest --stacktrace
# run: ./gradlew testNormalDebug testFossDebug --stacktrace
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test*/TEST-*.xml'
android-lint:
name: "πŸ” Android Lint"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: ${{ env.JAVA_DISTR }}
java-version: ${{ env.JAVA_VERSION }}
- name: Create google-services.json file
run: cat /home/runner/work/newquiz/newquiz/app/google-services.json | base64
- name: Put google-services.json data
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $DATA > /home/runner/work/newquiz/newquiz/app/google-services.json
- name: Increase gradle daemon memory
run: "echo \"org.gradle.jvmargs=-Xmx4096m\" >> gradle.properties"
- name: Workaround for Android Gradle Plugin issue
run: 'echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" > local.properties'
- name: Setup gradle
uses: gradle/[email protected]
- name: Lint sources
run: ./gradlew lint --stacktrace
- name: Generate GitHub annotations
uses: yutailang0119/action-android-lint@v3
with:
report-path: '**/build/reports/*.xml'
assemble-apk:
name: "πŸ“¦ Assemble APKs"
needs:
- test
- android-lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: ${{ env.JAVA_DISTR }}
java-version: ${{ env.JAVA_VERSION }}
- name: Create google-services.json file
run: cat /home/runner/work/newquiz/newquiz/app/google-services.json | base64
- name: Put google-services.json data
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $DATA > /home/runner/work/newquiz/newquiz/app/google-services.json
- name: Workaround for Android Gradle Plugin issue
run: 'echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" > local.properties'
- name: Setup gradle
uses: gradle/[email protected]
- name: Assemble debug APKs
run: ./gradlew assembleNormalDebug assembleFossDebug --stacktrace
- name: Upload APKs
uses: actions/upload-artifact@v3
with:
name: APKs
path: app/build/outputs/apk/**/app-*-universal-debug.apk
# app/build/outputs/apk/debug/app-universal-debug.apk