Skip to content

Commit

Permalink
Merge pull request #274 from aivanovski/feature/add-automation-build
Browse files Browse the repository at this point in the history
Add automation build type
  • Loading branch information
aivanovski authored Jul 27, 2024
2 parents 9619a60 + 820b64b commit 9a4ddae
Show file tree
Hide file tree
Showing 42 changed files with 266 additions and 178 deletions.
120 changes: 27 additions & 93 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,32 @@ jobs:
- name: Run tests
run: ./gradlew app:test

build-gplay-debug:
name: Build Google Play debug
build-apks:
name: Build and store apk files
needs: [ check-code-style, run-tests ]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- command: assembleGplayDebug
fileName: app-gplay-debug.apk
filePath: ./app/build/outputs/apk/gplay/debug/app-gplay-debug.apk

- command: assembleGplayRelease
fileName: app-gplay-release.apk
filePath: ./app/build/outputs/apk/gplay/release/app-gplay-release.apk

- command: assembleFdroidDebug
fileName: app-fdroid-debug.apk
filePath: ./app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk

- command: assembleFdroidRelease
fileName: app-fdroid-release.apk
filePath: ./app/build/outputs/apk/fdroid/release/app-fdroid-release.apk

- command: assembleFdroidAutomation
fileName: app-fdroid-automation.apk
filePath: ./app/build/outputs/apk/fdroid/automation/app-fdroid-automation.apk
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -69,98 +91,10 @@ jobs:

- name: Build
run: |
./gradlew app:assembleGplayDebug
./gradlew app:${{ matrix.command }}
- name: Store APK file
uses: actions/upload-artifact@v3
with:
name: app-gplay-debug.apk
path: |
./app/build/outputs/apk/gplay/debug/app-gplay-debug.apk
build-gplay-release:
name: Build Google Play release
needs: [ check-code-style, run-tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Decrypt and validate decrypted data
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./.github/workflows/decrypt-and-validate-data.sh

- name: Build
run: |
./gradlew app:assembleGplayRelease
- name: Store APK file
uses: actions/upload-artifact@v3
with:
name: app-gplay-release.apk
path: |
./app/build/outputs/apk/gplay/release/app-gplay-release.apk
build-fdroid-debug:
name: Build FDroid debug
needs: [ check-code-style, run-tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Decrypt and validate decrypted data
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./.github/workflows/decrypt-and-validate-data.sh

- name: Build
run: |
./gradlew app:assembleFdroidDebug
- name: Store APK file
uses: actions/upload-artifact@v3
with:
name: app-fdroid-debug.apk
path: |
./app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk
build-fdroid-release:
name: Build FDroid release
needs: [ check-code-style, run-tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Decrypt and validate decrypted data
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./.github/workflows/decrypt-and-validate-data.sh

- name: Build
run: |
./gradlew app:assembleFdroidRelease
- name: Store APK file
uses: actions/upload-artifact@v3
with:
name: app-fdroid-release.apk
path: |
./app/build/outputs/apk/fdroid/release/app-fdroid-release.apk
name: ${{ matrix.fileName }}
path: ${{ matrix.filePath }}
30 changes: 11 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ jobs:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
Expand All @@ -25,32 +24,25 @@ jobs:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./.github/workflows/decrypt-and-validate-data.sh

- name: Build debug and release apk's
- name: Build apk's
run: |
./gradlew app:assembleFdroidDebug app:assembleFdroidRelease
- name: Store debug apk
uses: actions/upload-artifact@v3
with:
name: app-fdroid-debug.apk
path: |
./app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk
./gradlew app:assembleFdroidDebug app:assembleFdroidRelease app:assembleFdroidAutomation
- name: Store release apk
uses: actions/upload-artifact@v3
with:
name: app-fdroid-release.apk
path: |
./app/build/outputs/apk/fdroid/release/app-fdroid-release.apk
- name: Rename files
run: |
cp ./app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk ./keepassvault-debug.apk
cp ./app/build/outputs/apk/fdroid/release/app-fdroid-release.apk ./keepassvault-release.apk
cp ./app/build/outputs/apk/fdroid/automation/app-fdroid-automation.apk ./keepassvault-test.apk
- name: Publish Github Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
prerelease: true
files: |
./app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk
./app/build/outputs/apk/fdroid/release/app-fdroid-release.apk
./keepassvault-debug.apk
./keepassvault-release.apk
./keepassvault-test.apk
upload-to-google-play:
name: Upload App Bundle to Google Play
Expand Down
12 changes: 9 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion "1.5.4"
kotlinCompilerExtensionVersion "1.5.14"
}

kotlinOptions {
Expand Down Expand Up @@ -154,9 +154,15 @@ android {
versionNameSuffix 'd'
signingConfig signingConfigs.debug
}
release {
automation {
debuggable true
minifyEnabled false
signingConfig signingConfigs.debug
applicationIdSuffix '.automation'
}
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
Expand Down Expand Up @@ -314,7 +320,7 @@ dependencies {
// KeePass
implementation "com.github.anvell:kotpass:$kotpassVersion"
implementation "com.github.aivanovski:keepass-tree-diff:$treeDiffVersion"
debugImplementation "com.github.aivanovski:keepass-tree-builder:$treeBuilderVersion"
implementation "com.github.aivanovski:keepass-tree-builder:$treeBuilderVersion"

// Fuzzy search
implementation "com.github.aivanovski:fzf4j:$fzf4jVersion"
Expand Down
74 changes: 74 additions & 0 deletions app/icons/icon-automation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions app/src/automation/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:label="@string/app_name_automation"
tools:replace="android:label">

<receiver
android:name=".domain.test.TestDataBroadcastReceiver"
android:enabled="true"
android:exported="true" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.ivanovsky.passnotes.injection

import android.content.Context
import com.ivanovsky.passnotes.data.repository.settings.Settings
import com.ivanovsky.passnotes.domain.LoggerInteractor
import com.ivanovsky.passnotes.injection.modules.BiometricModule
import com.ivanovsky.passnotes.injection.modules.CoreModule
import com.ivanovsky.passnotes.injection.modules.UiModule
import com.ivanovsky.passnotes.injection.modules.UseCaseModule
import com.ivanovsky.passnotes.injection.modules.debug.DebugFileSystemProvidersModule
import com.ivanovsky.passnotes.injection.modules.debug.DebugModule
import com.ivanovsky.passnotes.injection.modules.debug.FakeBiometricModule
import org.koin.core.module.Module

// Is loaded via reflection in App.kt
class DebugModuleBuilder(
private val context: Context,
private val loggerInteractor: LoggerInteractor,
private val settings: Settings
) : DIModuleBuilder {

override var isExternalStorageAccessEnabled: Boolean = false

override fun buildModules(): List<Module> {
val isLoadFakeBiometricModule = settings.testToggles?.isFakeBiometricEnabled ?: false
val isFakeFileSystemEnabled = settings.testToggles?.isFakeFileSystemEnabled ?: false

return listOf(
CoreModule.build(loggerInteractor),
DebugModule.build(),
DebugFileSystemProvidersModule.build(
isExternalStorageAccessEnabled = isExternalStorageAccessEnabled,
isFakeFileSystemEnabled = isFakeFileSystemEnabled
),
if (isLoadFakeBiometricModule) {
FakeBiometricModule.build()
} else {
BiometricModule.build()
},
UseCaseModule.build(),
UiModule.build()
)
}
}
5 changes: 5 additions & 0 deletions app/src/automation/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="launcher_icon_background">#58e67e</color>
<color name="launcher_icon_foreground">#2c733f</color>
</resources>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import com.ivanovsky.passnotes.data.repository.settings.Settings
import com.ivanovsky.passnotes.domain.LoggerInteractor
import com.ivanovsky.passnotes.injection.modules.BiometricModule
import com.ivanovsky.passnotes.injection.modules.CoreModule
import com.ivanovsky.passnotes.injection.modules.DebugFileSystemProvidersModule
import com.ivanovsky.passnotes.injection.modules.DebugModule
import com.ivanovsky.passnotes.injection.modules.FakeBiometricModule
import com.ivanovsky.passnotes.injection.modules.UiModule
import com.ivanovsky.passnotes.injection.modules.UseCaseModule
import com.ivanovsky.passnotes.injection.modules.debug.DebugFileSystemProvidersModule
import com.ivanovsky.passnotes.injection.modules.debug.DebugModule
import com.ivanovsky.passnotes.injection.modules.debug.FakeBiometricModule
import org.koin.core.module.Module

// Is loaded via reflection in App.kt
Expand Down
Loading

0 comments on commit 9a4ddae

Please sign in to comment.