Bump Gradle, AGP and deps (#1184) #1676
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 | |
on: | |
push: | |
branches: | |
- main | |
- "[0-9]+.[0-9]+.x" | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
paths: | |
- ".github/workflows/android.yaml" | |
- "api-client/**" | |
- "app/**" | |
- "gradle/**" | |
- "**.gradle" | |
- "gradle.properties" | |
- "gradlew" | |
- "gradlew.bat" | |
pull_request: | |
branches: | |
- main | |
- "[0-9]+.[0-9]+.x" | |
paths: | |
- ".github/workflows/android.yaml" | |
- "api-client/**" | |
- "app/**" | |
- "gradle/**" | |
- "**.gradle" | |
- "gradle.properties" | |
- "gradlew" | |
- "gradlew.bat" | |
env: | |
JAVA_VERSION: 17 | |
jobs: | |
validate-gradle-wrapper: | |
name: Validate Gradle Wrapper | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/wrapper-validation-action@v2 | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: gradle | |
- run: ./gradlew :api-client:lintDebug :app:lintFreeDebug :app:lintFullDebug --no-daemon | |
- if: ${{ always() }} | |
uses: yutailang0119/action-android-lint@v3 | |
with: | |
report-path: "**/build/reports/*.xml" | |
api-client-unit-tests: | |
name: API Client Unit Tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: gradle | |
- run: ./gradlew :api-client:testDebugCoverage --no-daemon | |
- uses: codecov/codecov-action@v4 | |
with: | |
flags: api-client | |
files: api-client/build/reports/jacoco/testDebugCoverage/testDebugCoverage.xml | |
app-unit-tests: | |
name: App Unit Tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: gradle | |
- run: ./gradlew :app:testDebugCoverage --no-daemon | |
- uses: codecov/codecov-action@v4 | |
with: | |
flags: app | |
files: app/build/reports/jacoco/testFreeDebugCoverage/testFreeDebugCoverage.xml,app/build/reports/jacoco/testFullDebugCoverage/testFullDebugCoverage.xml | |
app-ui-tests: | |
name: App UI tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
include: | |
- android: 30 | |
target: aosp_atd | |
appVariant: FreeDebug | |
- android: 30 | |
target: google_atd | |
appVariant: FullDebug | |
fail-fast: false | |
steps: | |
- name: Enable KVM group perms | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: gradle | |
- uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.target }}-${{ matrix.android }} | |
- name: Generate AVD Snapshot Cache | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.android }} | |
target: ${{ matrix.target }} | |
arch: x86_64 | |
emulator-options: >- | |
-camera-back none -camera-front none -gpu swiftshader_indirect | |
-memory 3000 -no-audio -no-boot-anim -no-window | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.android }} | |
target: ${{ matrix.target }} | |
arch: x86_64 | |
script: ./scripts/run-ui-tests.sh :app:create${{ matrix.appVariant }}CoverageReport | |
emulator-options: >- | |
-camera-back none -camera-front none -gpu swiftshader_indirect | |
-memory 3000 -no-audio -no-boot-anim -no-window -no-snapshot-save | |
- uses: codecov/codecov-action@v4 | |
with: | |
flags: app | |
deploy-app-play-store: | |
name: Deploy App - Play Store | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
needs: | |
- validate-gradle-wrapper | |
- lint | |
- api-client-unit-tests | |
- app-unit-tests | |
- app-ui-tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: gradle | |
- run: bundle install | |
- run: | | |
echo "$SERVICE_ACCOUNT_KEY" > service-account-key.json | |
echo "$JKS_STORE" | base64 --decode > keystore.jks | |
env: | |
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }} | |
JKS_STORE: ${{ secrets.JKS_STORE }} | |
- run: bundle exec fastlane beta | |
env: | |
STORE_PASSWORD: ${{ secrets.JKS_STORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.JKS_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.JKS_ALIAS_PASSWORD }} | |
- if: ${{ always() }} | |
run: rm -f service-account-key.json keystore.jks | |
deploy-app-github: | |
name: Deploy App - GitHub | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
needs: | |
- validate-gradle-wrapper | |
- lint | |
- api-client-unit-tests | |
- app-unit-tests | |
- app-ui-tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
env: | |
FULL_APK: noice-full.apk | |
FULL_MAPPING: noice-full-mapping.txt | |
FREE_APK: noice-free.apk | |
FREE_MAPPING: noice-free-mapping.txt | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: gradle | |
- run: git fetch --prune --unshallow --tags -f | |
- run: ./scripts/create-github-release-artifacts.sh | |
env: | |
JKS_STORE: ${{ secrets.JKS_STORE }} | |
STORE_PASSWORD: ${{ secrets.JKS_STORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.JKS_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.JKS_ALIAS_PASSWORD }} | |
- id: tag_info | |
run: | | |
export TAG_NAME="${GITHUB_REF/'refs/tags/'/''}" | |
{ | |
echo "name=$TAG_NAME"; | |
echo "body<<EOF"; | |
git tag --list --format='%(contents:body)' $TAG_NAME; | |
echo "EOF"; | |
} >> "$GITHUB_OUTPUT" | |
- uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.BOT_PAT }} | |
name: v${{ steps.tag_info.outputs.name }} | |
body: ${{ steps.tag_info.outputs.body }} | |
files: | | |
${{ env.FREE_APK }} | |
${{ env.FREE_MAPPING }} | |
${{ env.FULL_APK }} | |
${{ env.FULL_MAPPING }} |