Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 14 #53

Merged
merged 6 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 217 additions & 0 deletions .github/workflows/TEST_android_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
name: Android CI

on:
workflow_dispatch:

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: Accept licenses
run: echo "y" | /usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0-rc3"

- name: Run tests
run: ./gradlew test --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: Accept licenses
run: echo "y" | /usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0-rc3"

- 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: Accept licenses
run: echo "y" | /usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0-rc3"

- name: Assemble debug APKs
run: ./gradlew assembleDebug --stacktrace

- name: Upload APKs
uses: actions/upload-artifact@v3
with:
name: artifacts.zip
path: |
app/build/outputs/apk/debug/app-universal-debug.apk
newquiz_uploads/build/outputs/aar

android-test:
needs: assemble-apk
runs-on: macos-latest # enables hardware acceleration in the virtual machine
timeout-minutes: 55
strategy:
fail-fast: true
matrix:
api-level: [22, 26]
steps:
- name: checkout
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: ${{ env.JAVA_DISTR }}
java-version: ${{ env.JAVA_VERSION }}

- name: Setup gradle
uses: gradle/[email protected]

- name: Accept licenses
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true

- name: Create google-services.json file
run: cat app/google-services.json | base64

- name: Put google-services.json data
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $DATA > app/google-services.json

- name: Increase gradle daemon memory
run: "echo \"org.gradle.jvmargs=-Xmx4096m\" >> gradle.properties"

# API 30+ emulators only have x86_64 system images.
- name: Get AVD info
uses: ./.github/actions/get-avd-info
id: avd-info
with:
api-level: ${{ matrix.api-level }}

- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: Create AVD snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ steps.avd-info.outputs.arch }}
target: ${{ steps.avd-info.outputs.target }}
disable-animations: false
force-avd-creation: false
ram-size: 4096M
emulator-boot-timeout: 12000
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: echo "Generated AVD snapshot."

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
disable-animations: true
force-avd-creation: false
ram-size: 4096M
emulator-boot-timeout: 12000
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: ./gradlew connectedDebugAndroidTest
104 changes: 21 additions & 83 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ jobs:
- name: Workaround for Android Gradle Plugin issue
run: 'echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" > local.properties'

- name: Run unit tests
- name: Setup gradle
uses: gradle/[email protected]
with:
arguments: >
test

- name: Accept licenses
run: echo "y" | /usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0-rc3"

- name: Run tests
run: ./gradlew test --stacktrace

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
Expand Down Expand Up @@ -86,10 +89,14 @@ jobs:
- name: Workaround for Android Gradle Plugin issue
run: 'echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" > local.properties'

- name: Lint sources
- name: Setup gradle
uses: gradle/[email protected]
with:
arguments: lint --stacktrace

- name: Accept licenses
run: echo "y" | /usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0-rc3"

- name: Lint sources
run: ./gradlew lint --stacktrace

- name: Generate GitHub annotations
uses: yutailang0119/action-android-lint@v3
Expand Down Expand Up @@ -124,10 +131,14 @@ jobs:
- name: Workaround for Android Gradle Plugin issue
run: 'echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" > local.properties'

- name: Assemble debug APKs
- name: Setup gradle
uses: gradle/[email protected]
with:
arguments: assembleDebug

- name: Accept licenses
run: echo "y" | /usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0-rc3"

- name: Assemble debug APKs
run: ./gradlew assembleDebug --stacktrace

- name: Upload APKs
uses: actions/upload-artifact@v3
Expand All @@ -136,76 +147,3 @@ jobs:
path: |
app/build/outputs/apk/debug/app-universal-debug.apk
newquiz_uploads/build/outputs/aar

android-test:
needs: assemble-apk
runs-on: macos-latest # enables hardware acceleration in the virtual machine
timeout-minutes: 55
strategy:
fail-fast: true
matrix:
api-level: [22, 26, 31]
steps:
- name: checkout
uses: actions/checkout@v3

- name: Gradle cache
uses: gradle/[email protected]

- 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 app/google-services.json | base64

- name: Put google-services.json data
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $DATA > app/google-services.json

- name: Increase gradle daemon memory
run: "echo \"org.gradle.jvmargs=-Xmx4096m\" >> gradle.properties"

# API 30+ emulators only have x86_64 system images.
- name: Get AVD info
uses: ./.github/actions/get-avd-info
id: avd-info
with:
api-level: ${{ matrix.api-level }}

- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: Create AVD snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ steps.avd-info.outputs.arch }}
target: ${{ steps.avd-info.outputs.target }}
disable-animations: false
force-avd-creation: false
ram-size: 4096M
emulator-boot-timeout: 12000
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: echo "Generated AVD snapshot."

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
disable-animations: true
force-avd-creation: false
ram-size: 4096M
emulator-boot-timeout: 12000
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: ./gradlew connectedCheck
3 changes: 3 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading