Skip to content

Update detekt to v1.23.3 #410

Update detekt to v1.23.3

Update detekt to v1.23.3 #410

Workflow file for this run

name: Android
on:
pull_request:
branches:
- main
paths-ignore:
- '**/*.md'
- 'ios/**'
push:
branches:
- main
tags:
- android-[0-9]+.[0-9]+.[0-9]+
paths-ignore:
- '**/*.md'
- 'ios/**'
env:
CI: true
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xms4g -Xmx4g -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError"
TERM: dumb
jobs:
assemble:
name: Assemble
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
KSTREAMLINED_KEY_ALIAS: ${{ secrets.KSTREAMLINED_KEY_ALIAS }}
KSTREAMLINED_KEY_PASSWORD: ${{ secrets.KSTREAMLINED_KEY_PASSWORD }}
KSTREAMLINED_STORE_PASSWORD: ${{ secrets.KSTREAMLINED_STORE_PASSWORD }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '20'
- name: Decrypt secrets
run: |
mkdir android/app/src/dev && mkdir android/app/src/prod
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/kstreamlined.aes -out android/secrets/kstreamlined.jks -k $ENCRYPTION_KEY
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/android-google-services-dev.aes -out android/app/src/dev/google-services.json -k $ENCRYPTION_KEY
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/android-google-services-prod.aes -out android/app/src/prod/google-services.json -k $ENCRYPTION_KEY
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Assemble dev debug APK and signed release App Bundle
run: ./gradlew app:assembleDevDebug app:bundleProdRelease
- name: Cleanup secrets
if: always()
run: |
rm -f android/secrets/kstreamlined.jks
rm -f android/app/src/dev/google-services.json
rm -f android/app/src/prod/google-services.json
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-outputs
path: android/app/build/outputs/
retention-days: 7
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENABLE_APP_VERSIONING: false
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '20'
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Run unit tests
run: ./gradlew test jvmTest -PslimTests
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENABLE_APP_VERSIONING: false
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '20'
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Run detekt, ktlint and Android Lint
run: |
./gradlew detekt lint
./gradlew -p build-logic detekt
deploy-dev-build:
name: Upload dev build
needs: [ assemble, unit-tests, static-analysis ]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/android')
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
ENABLE_APP_VERSIONING: false
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '20'
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-outputs
path: android/app/build/outputs
- name: Decrypt secrets
run: |
mkdir android/app/src/dev
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in secrets/firebase-key.aes -out secrets/firebase-key.json -k $ENCRYPTION_KEY
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/android-google-services-dev.aes -out android/app/src/dev/google-services.json -k $ENCRYPTION_KEY
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Publish dev build to Firebase App Distribution
run: ./gradlew processDevDebugGoogleServices appDistributionUploadDevDebug
- name: Cleanup secrets
if: always()
run: |
rm -f secrets/firebase-key.json
rm -f android/app/src/dev/google-services.json
deploy-release-build:
name: Publish release build to Play Store (internal test track)
needs: [ assemble, unit-tests, static-analysis ]
if: startsWith(github.ref, 'refs/tags/android')
runs-on: ubuntu-latest
timeout-minutes: 15
env:
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
ENABLE_APP_VERSIONING: false
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '20'
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-outputs
path: android/app/build/outputs
- name: Decrypt secrets
run: |
mkdir android/app/src/prod
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/play-publishing.aes -out android/secrets/play-publishing.json -k $ENCRYPTION_KEY
openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -salt -in android/secrets/android-google-services-prod.aes -out android/app/src/prod/google-services.json -k $ENCRYPTION_KEY
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Publish release App Bundle to Play Store
run: ./gradlew publishBundle --artifact-dir android/app/build/outputs/bundle/prodRelease
- name: Cleanup secrets
if: always()
run: |
rm -f android/secrets/play-publishing.json
rm -f android/app/src/prod/google-services.json