Skip to content

[FEAT/#226] Git Action CI/CD 워크플로우를 추가합니다.#242

Merged
MoonsuKang merged 2 commits intodevelopfrom
feat/#226-gitaction-ci-cd
Mar 31, 2025
Merged

[FEAT/#226] Git Action CI/CD 워크플로우를 추가합니다.#242
MoonsuKang merged 2 commits intodevelopfrom
feat/#226-gitaction-ci-cd

Conversation

@MoonsuKang
Copy link
Contributor

@MoonsuKang MoonsuKang commented Mar 30, 2025

📌 ISSUE

closed #226

📄 Work Description

  • CI/CD yml 추가
  • Firebase App Distribution 설정 추가
  • github secret 설정
  • staging 브랜치에 pr 시 discord web hook을 통해 알림 전송

✨ PR Point

어우 깃 꼬여서 이전 pr 닫고 다시 올렸습니다..

📸 ScreenShot/Video

Summary by CodeRabbit

  • New Features
    • Introduced automated workflows that streamline Android app builds and distribution for smoother test releases and notifications.
    • Enhanced the build configuration to support pre-release testing, enabling faster, more reliable delivery of new versions for evaluation.

@MoonsuKang MoonsuKang added ✨ FEAT 기능 개발 🌊 문수 문수 labels Mar 30, 2025
@MoonsuKang MoonsuKang requested a review from SYAAINN March 30, 2025 09:32
@MoonsuKang MoonsuKang self-assigned this Mar 30, 2025
@coderabbitai
Copy link

coderabbitai bot commented Mar 30, 2025

Walkthrough

This pull request introduces two new GitHub Actions workflows for an Android project: one for continuous deployment triggered by pull requests to the staging branch, and another for continuous integration triggered by pull requests to the develop branch. The workflows perform steps such as checking out the code, caching dependencies, setting up JDK/Android SDK, handling Firebase configurations, building artifacts, and notifying Discord. Additionally, the Firebase App Distribution plugin is integrated into the Gradle build files with dependency declarations added in the versions file.

Changes

File(s) Change Summary
.github/workflows/android_cd.yml
.github/workflows/android_ci.yml
Added two new GitHub Actions workflows: one for continuous deployment (staging branch) and one for continuous integration (develop branch). Both include steps for code checkout, dependency caching, JDK/SDK setup, Firebase configurations, and notifications (Discord for CD).
app/build.gradle.kts
build.gradle.kts
Integrated the Firebase App Distribution plugin; the app build file applies it for distribution, while the root build file includes the plugin conditional application.
gradle/libs.versions.toml Added the firebase-app-distribution library with version 5.1.0 and declared the associated plugin configuration.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant GH_CD as GitHub Actions (CD)
    participant Build as Android Build
    participant FB as Firebase
    participant DC as Discord

    Dev->>GH_CD: Open PR to staging
    GH_CD->>GH_CD: Checkout code, cache dependencies, setup JDK & SDK, update permissions
    GH_CD->>GH_CD: Decode Firebase secrets & generate local.properties
    GH_CD->>Build: Build release AAB
    Build->>FB: Deploy AAB via Firebase App Distribution
    GH_CD->>DC: Send notification via Discord webhook
Loading
sequenceDiagram
    participant Dev as Developer
    participant GH_CI as GitHub Actions (CI)
    participant Build as Android Build

    Dev->>GH_CI: Open PR to develop
    GH_CI->>GH_CI: Checkout code, cache Gradle and SDK, setup JDK & SDK, update permissions
    GH_CI->>GH_CI: Decode Firebase secrets & generate local.properties
    GH_CI->>Build: Run lint checks and build the project
Loading

Assessment against linked issues

Objective Addressed Explanation
GitHub Actions YAML configuration (#226)
Firebase App Distribution integration (#226)
GitHub Secrets setup (#226)
Discord webhook integration (#226)

Poem

I'm a happy rabbit, hopping through the code,
With workflows and plugins lighting my adventurous road.
CI/CD magic flows like a river so grand,
Firebase secrets and distribution all nicely planned.
Cheers from the burrow—let's build a wonderland!
🐇🚀

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a087607 and 321e5fd.

📒 Files selected for processing (5)
  • .github/workflows/android_cd.yml (1 hunks)
  • .github/workflows/android_ci.yml (1 hunks)
  • app/build.gradle.kts (1 hunks)
  • build.gradle.kts (1 hunks)
  • gradle/libs.versions.toml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (16)
build.gradle.kts (1)

12-12: Firebase App Distribution Plugin Alias Added

The new alias added on line 12 –

alias(libs.plugins.firebase.app.distribution) apply false

– correctly includes the Firebase App Distribution plugin in the build configuration. The use of apply false indicates that the plugin is conditionally applied; please ensure that this aligns with your intended usage across subprojects/modules and that corresponding configuration exists where the plugin is actually activated.

app/build.gradle.kts (1)

17-17: Firebase App Distribution Plugin Enabled in the App Module

The addition of

alias(libs.plugins.firebase.app.distribution)

on line 17 ensures that the Firebase App Distribution plugin is actively applied in the app module (unlike the top-level configuration where it is applied conditionally). This is appropriate since you want the plugin active for the app’s build and distribution. Verify that any additional configuration required by the plugin is included later in the build script or via the CI/CD workflows.

gradle/libs.versions.toml (2)

40-40: New Firebase App Distribution Version Entry

The addition of

firebase-app-distribution = "5.1.0"

on line 40 in the [versions] section correctly defines the required version. Ensure that this version is compatible with your other Firebase dependencies.


125-125: Firebase App Distribution Plugin Declaration

The declaration in the [plugins] section on line 125:

firebase-app-distribution = { id = "com.google.firebase.appdistribution", version.ref = "firebase-app-distribution" }

is correctly set up. Confirm that the version reference is resolved correctly to the version specified above.

.github/workflows/android_ci.yml (6)

1-11: CI Workflow Trigger Configuration

The workflow’s trigger is configured to run on pull requests to the develop branch affecting files in the app module, the top-level build file, or any Kotlin files. This granular trigger helps limit CI runs to relevant changes.


22-33: Efficient Dependency Caching

The caching steps for Gradle packages (lines 24–33) and the Android SDK (lines 35–40) are appropriately set up. These steps should help reduce build times by reusing cached dependencies across workflow runs.


45-51: JDK and Android SDK Setup

The steps for setting up JDK 17 (lines 45–51) using the Corretto distribution and installing the Android SDK (lines 52–55) align with Android’s official recommendations. No issues found.


60-64: Secure Decoding of Firebase Secrets

The step on lines 60–64 decodes the google-services.json securely from a Base64-encoded secret. This ensures that sensitive information is handled securely during the CI run. Verify that the secret FIREBASE_SECRET is correctly set in the repository’s secrets.


67-80: Generation of local.properties

The generation of the local.properties file (lines 67–80) using environment variables for API keys and URLs is implemented correctly. Make sure that the key names and the overall file format match what your build logic expects in app/build.gradle.kts.


82-84: Lint and Build Command

The final step on lines 82–84 that runs ./gradlew --no-daemon --configuration-cache ktlintCheck assembleDebug combines linting and building effectively. This should help catch style or quality issues early in the CI process.

.github/workflows/android_cd.yml (6)

1-6: CD Workflow Trigger Settings

The workflow is set to trigger on pull requests targeting the staging branch (lines 3–6), which matches the intended continuous deployment scenario. This focused trigger helps separate CD from CI processes.


12-27: Caching and Environment Setup for Deployment

The caching (lines 18–27) and environment setup steps (JDK, Android SDK, and gradlew permission on lines 28–43) mirror the best practices seen in the CI workflow, ensuring consistency and optimized build times.


40-43: File Permission and Firebase Secret Decoding

The steps to change permissions on the gradlew script and to decode google-services.json (lines 40–49) are sound. Confirm that the environment variable FIREBASE_SECRET in your GitHub repository holds the correct Base64-encoded JSON.


50-64: local.properties Generation for Deployment

The generation of local.properties (lines 50–64) using environment variables ensures that build configurations such as base URLs and API keys are securely injected into the build process. This approach is consistent with the CI workflow and should work as expected.


65-68: Release AAB Build Process

The command on lines 65–68, ./gradlew bundleRelease --stacktrace, instructs Gradle to build the release Android App Bundle (AAB) with stacktrace enabled for debugging build failures. Confirm that the output location of the AAB matches what is expected in the distribution step.


77-86: Firebase App Distribution and Discord Notification

The final steps on lines 77–86 handle uploading the AAB to Firebase App Distribution and notifying a Discord channel via webhook. Both commands are appropriately configured, but please double-check that:

  • The AAB file path (app/build/outputs/bundle/release/app-release.aab) is correct.
  • All required secrets (e.g., FIREBASE_APP_ID, DISCORD_WEBHOOK_URL) are present and correctly set in the repository’s secrets.

Comment on lines +69 to +76
# Firebase 인증
- name: Set up Firebase Service Account Credentials
env:
GOOGLE_APPLICATION_CREDENTIALS_JSON: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}
run: |
echo "$GOOGLE_APPLICATION_CREDENTIALS_JSON" | base64 --decode > $HOME/firebase-credentials.json
export GOOGLE_APPLICATION_CREDENTIALS=$HOME/firebase-credentials.json

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Firebase Service Account Credentials Setup

The steps on lines 69–76 decode the Firebase service account credentials and set the GOOGLE_APPLICATION_CREDENTIALS environment variable.

Note: Consider adding an explicit step to install the Firebase CLI (for example, using npm install -g firebase-tools) if it is not pre-installed on the ubuntu-latest image. This ensures that the subsequent Firebase distribution command will execute reliably.

Copy link
Contributor

@SYAAINN SYAAINN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 local.properties 인식이 안돼서 ktlint 체크 오류 나는거 어떻게 아시고 ㅎㅎ yml파일이랑 github secrets 설정 야무지게 배웠습니다 수고하셨슴둥

@MoonsuKang MoonsuKang merged commit dde8b5e into develop Mar 31, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ FEAT 기능 개발 🌊 문수 문수

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Git Action CI/CD를 구축합니다.

2 participants