Skip to content
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
25 changes: 25 additions & 0 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI Setup
description: Common setup steps for CI jobs

runs:
using: composite
steps:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash

- name: Download config files
uses: actions/download-artifact@v4
with:
name: config-files
72 changes: 51 additions & 21 deletions .github/workflows/android_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,65 @@ on:
pull_request:
branches: [ "develop" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
setup:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up local.properties
run: echo "${{ secrets.LOCAL_PROPERTIES }}" > local.properties

- name: Set up keystore
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/ndgl.keystore
echo "KEYSTORE_PATH=../app/ndgl.keystore" >> local.properties
echo "KEYSTORE_STORE_PASSWORD=${{ secrets.KEYSTORE_STORE_PASSWORD }}" >> local.properties
echo "KEYSTORE_ALIAS=${{ secrets.KEYSTORE_ALIAS }}" >> local.properties
echo "KEYSTORE_KEY_PASSWORD=${{ secrets.KEYSTORE_KEY_PASSWORD }}" >> local.properties
echo "NDGL_BASE_URL_DEBUG=${{ secrets.NDGL_BASE_URL_DEBUG }}" >> local.properties
echo "NDGL_BASE_URL_RELEASE=${{ secrets.NDGL_BASE_URL_RELEASE }}" >> local.properties

- name: Set up google-services.json
run: |
mkdir -p app/src/debug app/src/release
echo '${{ secrets.GOOGLE_SERVICES_DEBUG }}' | base64 -d > app/src/debug/google-services.json
echo '${{ secrets.GOOGLE_SERVICES_RELEASE }}' | base64 -d > app/src/release/google-services.json

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true
- name: Upload config files
uses: actions/upload-artifact@v4
with:
name: config-files
retention-days: 1
path: |
local.properties
app/ndgl.keystore
app/src/debug/google-services.json
app/src/release/google-services.json

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
lint:
needs: setup
runs-on: ubuntu-latest

- name: Grant execute permission for gradlew
run: chmod +x gradlew
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup

- name: Set up local.properties
run: echo "${{ secrets.LOCAL_PROPERTIES }}" > local.properties
- name: Code style checks
run: ./gradlew ktlintCheck detekt --build-cache --parallel

- name: Set up google-services.json
run: echo '${{ secrets.GOOGLE_SERVICES }}' | base64 -d > app/google-services.json
build:
needs: setup
runs-on: ubuntu-latest

- name: Code style checks
run: ./gradlew ktlintCheck detekt
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup

- name: Run build
run: ./gradlew assembleDebug --stacktrace
- name: Run build
run: ./gradlew assembleDebug --build-cache --parallel --stacktrace
37 changes: 33 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,48 @@ plugins {
android {
namespace = Configuration.APPLICATION_ID

defaultConfig {
val localProperties = Properties().apply {
load(rootProject.file("local.properties").bufferedReader())
}
val localProperties = Properties().apply {
load(rootProject.file("local.properties").bufferedReader())
}

defaultConfig {
manifestPlaceholders["MAPS_API_KEY"] = localProperties.getProperty("MAPS_API_KEY", "")
}

signingConfigs {
create("release") {
storeFile = file(localProperties.getProperty("KEYSTORE_PATH"))
storePassword = localProperties.getProperty("KEYSTORE_STORE_PASSWORD")
keyAlias = localProperties.getProperty("KEYSTORE_ALIAS")
keyPassword = localProperties.getProperty("KEYSTORE_KEY_PASSWORD")
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

buildFeatures {
buildConfig = true
}

buildTypes {
all {
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
buildConfigField("String", "NDGL_API_KEY", "\"${localProperties.getProperty("NDGL_API_KEY", "")}\"")
}
debug {
applicationIdSuffix = ".debug"
isDebuggable = true
isMinifyEnabled = false
isShrinkResources = false
buildConfigField("String", "NDGL_BASE_URL", "\"${localProperties.getProperty("NDGL_BASE_URL_DEBUG")}\"")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
release {
signingConfig = signingConfigs.getByName("release")
isDebuggable = false
isMinifyEnabled = true
isShrinkResources = true
buildConfigField("String", "NDGL_BASE_URL", "\"${localProperties.getProperty("NDGL_BASE_URL_RELEASE")}\"")
}
}
}
Expand All @@ -36,6 +63,8 @@ dependencies {
implementation(project(":feature:travel"))
implementation(project(":feature:travel-helper"))

implementation(project(":data:core"))

implementation(project(":core:ui"))

implementation(libs.androidx.navigation3.runtime)
Expand Down
6 changes: 5 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

# j2objc annotations are not available on Android
-dontwarn com.google.j2objc.annotations.ReflectionSupport
-dontwarn com.google.j2objc.annotations.RetainedWith
3 changes: 3 additions & 0 deletions app/src/debug/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">NDGL.debug</string>
</resources>
25 changes: 25 additions & 0 deletions app/src/main/java/com/yapp/ndgl/di/AppNetworkModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.yapp.ndgl.di

import com.yapp.ndgl.BuildConfig
import com.yapp.ndgl.data.core.di.ApiKey
import com.yapp.ndgl.data.core.di.BaseUrl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object AppNetworkModule {

@BaseUrl
@Singleton
@Provides
fun provideBaseUrl(): String = BuildConfig.NDGL_BASE_URL

@ApiKey
@Singleton
@Provides
fun provideApiKey(): String = BuildConfig.NDGL_API_KEY
}
5 changes: 5 additions & 0 deletions build-logic/src/main/kotlin/NDGLAndroidLibraryPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import convention.configureTimber
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import util.libraryExtension
import util.libs

class NDGLAndroidLibraryPlugin : Plugin<Project> {
Expand All @@ -19,6 +20,10 @@ class NDGLAndroidLibraryPlugin : Plugin<Project> {
configureComposeAndroid()
configureTimber()

libraryExtension.defaultConfig {
consumerProguardFiles("consumer-rules.pro")
}

dependencies {
"implementation"(libs.findLibrary("kotlinx-immutable").get())
}
Expand Down
5 changes: 5 additions & 0 deletions build-logic/src/main/kotlin/NDGLDataPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import convention.configureTimber
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import util.libraryExtension
import util.libs

class NDGLDataPlugin : Plugin<Project> {
Expand All @@ -19,6 +20,10 @@ class NDGLDataPlugin : Plugin<Project> {
configureCoroutineAndroid()
configureTimber()

libraryExtension.defaultConfig {
consumerProguardFiles("consumer-rules.pro")
}

if (path != ":data:core") {
dependencies.add("implementation", project(":data:core"))
}
Expand Down
9 changes: 0 additions & 9 deletions build-logic/src/main/kotlin/convention/KotlinAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ internal fun Project.configureKotlinAndroid() {
defaultConfig {
minSdk = Configuration.MIN_SDK
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility = Configuration.JAVA_VERSION
targetCompatibility = Configuration.JAVA_VERSION
Expand Down
Empty file added core/base/consumer-rules.pro
Empty file.
Empty file added core/ui/consumer-rules.pro
Empty file.
21 changes: 0 additions & 21 deletions core/ui/proguard-rules.pro

This file was deleted.

2 changes: 2 additions & 0 deletions data/auth/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-keep class com.yapp.ndgl.data.auth.model.** { *; }
-keep interface com.yapp.ndgl.data.auth.api.** { *; }
21 changes: 0 additions & 21 deletions data/auth/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFact
import com.yapp.ndgl.data.auth.api.AuthApi
import com.yapp.ndgl.data.core.adapter.NDGLCallAdapterFactory
import com.yapp.ndgl.data.core.di.AuthClient
import com.yapp.ndgl.data.core.di.BaseUrl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -21,7 +22,7 @@ object AuthNetworkModule {
@Singleton
fun provideAuthApi(
json: Json,
baseUrl: String,
@BaseUrl baseUrl: String,
@AuthClient okHttpClient: OkHttpClient,
callAdapterFactory: NDGLCallAdapterFactory,
): AuthApi = Retrofit.Builder()
Expand Down
11 changes: 0 additions & 11 deletions data/core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import java.util.Properties
import kotlin.apply

plugins {
id("ndgl.data")
}

android {
namespace = "com.yapp.ndgl.data.core"

defaultConfig {
val localProperties = Properties().apply {
load(rootProject.file("local.properties").bufferedReader())
}

buildConfigField("String", "NDGL_BASE_URL", "\"${localProperties["NDGL_BASE_URL"]}\"")
}

buildFeatures {
buildConfig = true
}
Expand Down
2 changes: 2 additions & 0 deletions data/core/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-keep class com.yapp.ndgl.data.core.model.** { *; }
-keep class com.yapp.ndgl.data.core.serializer.** { *; }
21 changes: 0 additions & 21 deletions data/core/proguard-rules.pro

This file was deleted.

Loading