diff --git a/.github/workflows/android-ci.yml b/.github/workflows/android-ci.yml new file mode 100644 index 00000000..328bf5a0 --- /dev/null +++ b/.github/workflows/android-ci.yml @@ -0,0 +1,47 @@ +name: Android CI + +on: + push: # 코드 푸시 이벤트에 대한 설정 + branches: [ "develop" ] # "develop" 브랜치에 푸시될 때만 트리거된다. + pull_request: # 풀 리퀘스트 이벤트에 대한 설정 + branches: [ "develop" ] # "develop" 브랜치로의 풀 리퀘스트가 생성될 때만 트리거된다. + +jobs: # CI에서 수행할 작업을 정의한다. + ci-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Generate local.properties + run: | + echo '${{ secrets.LOCAL_PROPERTIES }}' >> ./local.properties + + - name: Generate google-services.json + run: | + echo '${{ secrets.GOOGLE_SERVICES }}' >> ./app/google-services.json + +# - name: Code style checks +# run: | +# ./gradlew detekt + + - name: Run build + run: ./gradlew assembleDebug --stacktrace + diff --git a/.github/workflows/firebase-app-distribution-debug.yml b/.github/workflows/firebase-app-distribution-debug.yml new file mode 100644 index 00000000..3e93757b --- /dev/null +++ b/.github/workflows/firebase-app-distribution-debug.yml @@ -0,0 +1,63 @@ +name: Build & upload to Firebase App Distribution + +on: + push: + branches: + - main + +jobs: + cd-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Prepare keystore dir + run: mkdir -p keystore + + - name: Decode And Save Keystore Base64 + run: | + echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore/keystore.jks + + - name: Decode And Save Debug Keystore Base64 + run: | + echo "${{ secrets.DEBUG_KEYSTORE_BASE64 }}" | base64 -d > debug.keystore + + - name: Generate local.properties + run: | + echo '${{ secrets.LOCAL_PROPERTIES }}' >> ./local.properties + + - name: Generate google-services.json + run: | + echo '${{ secrets.GOOGLE_SERVICES }}' >> ./app/google-services.json + + - name: Build debug APK + run: ./gradlew assembleDebug + + - name: Upload artifact to Firebase App Distribution + uses: wzieba/Firebase-Distribution-Github-Action@v1 + with: + appId: ${{ secrets.FIREBASE_APP_ID }} + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} + groups: testers + file: app/build/outputs/apk/debug/app-debug.apk +# releaseNotes: ${{ steps.firebase_release_note.outputs.notes }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b7197f62..4a5682ef 100644 --- a/.gitignore +++ b/.gitignore @@ -168,3 +168,5 @@ fabric.properties ### AndroidStudio Patch ### !/gradle/wrapper/gradle-wrapper.jar +/app/debug/output-metadata.json +/app/build/outputs/**/output-metadata.json diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 59256179..5d566441 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,6 +5,7 @@ plugins { alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.compose) alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.firebase.crashlytics) id("com.google.dagger.hilt.android") // Hilt 플러그인 추가 kotlin("kapt") // Hilt를 위한 kapt 추가 } @@ -32,6 +33,24 @@ android { } + signingConfigs { + val debugKeystore = rootProject.file("debug.keystore") + if (debugKeystore.exists()) { + getByName("debug") { + storeFile = debugKeystore + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" + } + } + getByName("debug") { + storeFile = file("$rootDir/debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" + } + } + buildTypes { release { isMinifyEnabled = false @@ -98,12 +117,17 @@ dependencies { // Kakao SDK implementation("com.kakao.sdk:v2-all:2.20.6") implementation("com.kakao.sdk:v2-user:2.20.6") // 카카오 로그인 API 모듈 - implementation ("com.kakao.maps.open:android:2.12.8") // 카카오 맵 API + implementation("com.kakao.maps.open:android:2.12.8") // 카카오 맵 API // coil implementation(libs.coil.compose) implementation(libs.coil.network.okhttp) implementation(libs.coil.svg) + + // Firebase + implementation(platform(libs.firebase.bom)) + implementation(libs.firebase.crashlytics.ndk) + implementation(libs.firebase.analytics) } // Hilt를 사용할 때 필요한 Annotation Processor diff --git a/build.gradle.kts b/build.gradle.kts index 493c6f6f..464702a5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,4 +4,5 @@ plugins { alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.compose) apply false alias(libs.plugins.dagger.hilt) apply false + alias(libs.plugins.firebase.crashlytics) apply false } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7e37a3be..82cbe271 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,6 +2,7 @@ agp = "8.7.3" coilCompose = "3.1.0" converterGson = "2.11.0" +firebaseBom = "34.1.0" hiltAndroid = "2.52" hiltNavigationCompose = "1.2.0" kotlin = "2.0.0" @@ -23,6 +24,8 @@ okhttp = "4.11.0" retrofitKotlinSerializationConverter = "1.0.0" datastorePreferences = "1.1.3" playServicesLocation = "21.3.0" +firebaseCrashlytics = "3.0.6" +googleServices = "4.4.3" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } @@ -31,6 +34,9 @@ coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCo coil-svg = { module = "io.coil-kt.coil3:coil-svg", version.ref = "coilCompose" } coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coilCompose" } converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "converterGson" } +firebase-analytics = { module = "com.google.firebase:firebase-analytics" } +firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" } +firebase-crashlytics-ndk = { module = "com.google.firebase:firebase-crashlytics-ndk" } hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hiltAndroid" } hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hiltAndroid" } junit = { group = "junit", name = "junit", version.ref = "junit" } @@ -66,3 +72,5 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } dagger-hilt = { id = "com.google.dagger.hilt.android", version.ref = "hiltAndroid" } +firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlytics" } +google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" } \ No newline at end of file