-
Notifications
You must be signed in to change notification settings - Fork 1
GitHub action CI 설정 추가 #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
The head ref may contain hidden characters: "feat/#16-github-action-ci-\uC124\uC815-\uCD94\uAC00"
Conversation
📝 Walkthrough🔄 주요 변경사항WalkthroughAndroid 프로젝트를 위한 새로운 GitHub Actions CI 워크플로우가 추가되었습니다. 이 워크플로우는 develop 브랜치로의 풀 리퀘스트, develop 및 main 브랜치로의 푸시, 그리고 수동 실행을 트리거로 설정하며, JDK 21 환경에서 Gradle을 통해 ktlintCheck, test, assembleDebug 작업을 순차적으로 실행합니다. google-services.json 파일은 저장소 시크릿으로부터 생성되며, 빌드 캐시와 병렬 실행이 활성화되어 있습니다. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 📋 리뷰 피드백✅ 칭찬할 점워크플로우 구조가 명확하고 잘 구성되어 있습니다. 다음과 같은 부분이 좋습니다:
💭 개선 고려사항몇 가지 검토 질문을 제안드립니다:
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this 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
🧹 Nitpick comments (4)
.github/workflows/android-ci.yml (4)
27-29: 사용되지 않는 권한이 설정되어 있습니다.
pull-requests: write권한이 부여되어 있지만, 현재 워크플로우에는 PR에 코멘트나 테스트 결과를 작성하는 단계가 없습니다. 향후 테스트 결과 리포팅 기능을 추가할 계획이라면 유지하고, 그렇지 않다면 보안 최소 권한 원칙에 따라 제거하는 것을 권장합니다.🔎 권한이 필요 없다면 제거하는 방법
permissions: contents: read - pull-requests: write
54-55: Clean 태스크가 CI 성능을 저하시킬 수 있습니다.매번
clean을 실행하면 다음과 같은 문제가 있습니다:
- 빌드 캐시 무효화:
--build-cache옵션을 사용하더라도 clean으로 인해 이점이 감소합니다.- CI 실행 시간 증가: 매번 전체 빌드를 수행하게 되어 CI가 느려집니다.
- Gradle 증분 빌드 미활용: Gradle의 증분 빌드는 충분히 신뢰할 수 있습니다.
특별한 이유(예: 빌드 캐시 오염 문제)가 없다면 제거하는 것을 권장합니다.
🔎 Clean 태스크 제거
- - name: Clean Project - run: ./gradlew clean - - name: Run ktlint Check run: ./gradlew ktlintCheck --build-cache --parallel
60-61: 테스트 결과 리포팅 기능 추가를 권장합니다.유닛 테스트를 실행하는 것은 좋지만, 현재는 테스트 결과를 확인하기 어렵습니다. 다음 기능을 추가하면 개발자 경험이 크게 향상됩니다:
- 테스트 결과 아티팩트 업로드: 실패 시 상세 리포트 확인
- PR에 테스트 결과 요약 게시: 빠른 피드백
🔎 테스트 결과 리포팅 추가 예시
- name: Run Unit Tests run: ./gradlew test --build-cache --parallel + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: '**/build/test-results/test/*.xml' + retention-days: 7 + + - name: Publish Test Report + if: always() + uses: dorny/test-reporter@v1 + with: + name: Test Results + path: '**/build/test-results/test/*.xml' + reporter: java-junit참고:
dorny/test-reporter를 사용하려면 이전에 제안한pull-requests: write권한이 필요합니다.
63-64: 디버그 APK 업로드를 고려해보세요.디버그 빌드를 생성하는 것은 좋지만, 생성된 APK를 아티팩트로 업로드하면 다음과 같은 이점이 있습니다:
- 즉시 테스트 가능: 재빌드 없이 APK 다운로드 및 테스트
- QA 팀과 공유: CI에서 생성된 APK를 바로 전달
- 히스토리 추적: 각 커밋별 빌드 결과 보관
필수는 아니지만 개발 워크플로우를 개선할 수 있는 좋은 추가 기능입니다.
🔎 APK 아티팩트 업로드 추가
- name: Assemble Debug run: ./gradlew assembleDebug --build-cache --parallel + + - name: Upload Debug APK + uses: actions/upload-artifact@v4 + with: + name: app-debug + path: app/build/outputs/apk/debug/app-debug.apk + retention-days: 7참고:
app/build/outputs/apk/debug/app-debug.apk경로는 프로젝트 구조에 따라 조정이 필요할 수 있습니다.
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/android-ci.yml
🔇 Additional comments (6)
.github/workflows/android-ci.yml (6)
3-13: 워크플로우 트리거 설정이 잘 되어 있습니다.PR과 푸시, 수동 실행을 모두 지원하도록 설정되어 있어 좋습니다. 다만
main브랜치로의 푸시 트리거는 PR 기반 워크플로우를 사용한다면 중복될 수 있습니다. PR을 통해서만main에 머지한다면 이 트리거는 제거해도 무방합니다.
15-17: 동시성 제어 설정이 우수합니다.동일한 PR에서 새로운 커밋이 푸시되면 이전 실행을 자동으로 취소하도록 설정되어 있어, CI 리소스를 효율적으로 사용할 수 있습니다.
32-35: 체크아웃 설정이 적절합니다.
fetch-depth: 1로 shallow clone을 사용하여 CI 성능을 최적화했습니다. 현재와 같은 빌드 및 테스트 CI에는 적합한 설정입니다.
37-42: JDK 설정이 훌륭합니다.최신 JDK 21을 사용하고 Gradle 캐시를 활성화하여 빌드 성능을 크게 향상시킬 수 있습니다. Temurin 배포판도 신뢰할 수 있는 선택입니다.
44-45: 실행 권한 부여가 안전하게 설정되어 있습니다.Linux 러너에서는 보통 자동으로 실행 권한이 있지만, 명시적으로 설정하는 것은 안전한 방어적 코딩입니다.
57-58: 코드 스타일 검사가 잘 설정되어 있습니다.ktlint 검사를 통해 코드 품질을 유지하고,
--build-cache와--parallel플래그로 성능을 최적화했습니다. 좋은 실천 방법입니다!
| - name: Create google-services.json | ||
| env: | ||
| GOOGLE_SERVICES_JSON_DEBUG: ${{ secrets.GOOGLE_SERVICES_JSON_DEBUG }} | ||
| run: | | ||
| mkdir -p ./app/src/debug | ||
| echo "${GOOGLE_SERVICES_JSON_DEBUG}" > ./app/src/debug/google-services.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Find google-services.json files in the repository
fd -t f 'google-services.json' 2>/dev/null | head -20Repository: YAPP-Github/Twix-Android
Length of output: 50
🏁 Script executed:
# Check the project structure for Android modules
find . -maxdepth 3 -type d -name 'src' 2>/dev/null | grep -v '.git' | head -20Repository: YAPP-Github/Twix-Android
Length of output: 246
🏁 Script executed:
# Look for build.gradle files to understand project structure
fd -t f 'build.gradle*' 2>/dev/null | head -20Repository: YAPP-Github/Twix-Android
Length of output: 373
🏁 Script executed:
# Check the full context of the android-ci.yml workflow file
cat -n .github/workflows/android-ci.yml 2>/dev/null | head -80Repository: YAPP-Github/Twix-Android
Length of output: 1914
🏁 Script executed:
# Check if Google Services plugin is configured in app/build.gradle.kts
cat -n app/build.gradle.kts | head -50Repository: YAPP-Github/Twix-Android
Length of output: 1152
🏁 Script executed:
# Search for any references to google-services in gradle files
rg -i 'google.services|gms|firebase' app/build.gradle.kts 2>/dev/null | head -20Repository: YAPP-Github/Twix-Android
Length of output: 50
🏁 Script executed:
# Check if there's an AndroidManifest.xml to understand the app structure
find . -name "AndroidManifest.xml" -type f 2>/dev/null | head -10Repository: YAPP-Github/Twix-Android
Length of output: 147
🏁 Script executed:
# Verify the ubuntu-latest environment typically has jq
# Check documentation or search for common tools available
echo "jq is typically available in ubuntu-latest runners"
# Let's also check if there are any other validation scripts in the repo
fd -t f '\.sh$' 2>/dev/null | head -20Repository: YAPP-Github/Twix-Android
Length of output: 118
🏁 Script executed:
# Check the convention plugin to see if Google Services plugin is configured
cat -n build-logic/convention/build.gradle.kts 2>/dev/null | head -80Repository: YAPP-Github/Twix-Android
Length of output: 2061
🏁 Script executed:
# Search for Google Services plugin configuration in the convention directory
rg -i 'google.services|gms|firebase' build-logic/ 2>/dev/nullRepository: YAPP-Github/Twix-Android
Length of output: 50
🏁 Script executed:
# Check src directory of convention plugin for plugin application
find build-logic/convention/src -type f -name "*.kt" 2>/dev/null | xargs grep -l "google" 2>/dev/null | head -10Repository: YAPP-Github/Twix-Android
Length of output: 50
🏁 Script executed:
# Check the Android Application Convention Plugin
find build-logic/convention/src -name "AndroidApplicationConventionPlugin.kt" -type f 2>/dev/null | xargs cat -n 2>/dev/null | head -100Repository: YAPP-Github/Twix-Android
Length of output: 960
🏁 Script executed:
# Search for google-services in all gradle files
rg -i 'google.*services|com\.google\.gms' . --type gradle --type kotlin 2>/dev/null | head -20Repository: YAPP-Github/Twix-Android
Length of output: 50
Google Services 플러그인 적용이 필요합니다.
경로(./app/src/debug)는 프로젝트 구조와 올바르게 일치하고 있어 문제없습니다. 다만, 더 중요한 문제가 있습니다:
현재 워크플로우는 google-services.json 파일을 생성하지만, 그 파일을 실제로 빌드에 포함시키는 Google Services Gradle 플러그인이 적용되어 있지 않습니다. 파일이 생성되어도 빌드 시스템에서 인식되지 않아 효과가 없습니다.
필요한 조치:
- Google Services 플러그인을
app/build.gradle.kts에 추가하거나, 또는 - 규칙 플러그인(
build-logic/convention)의AndroidApplicationConventionPlugin에 Google Services 플러그인을 포함시키세요.
예시:
plugins {
alias(libs.plugins.twix.android.application)
alias(libs.plugins.gms.google.services) // 추가 필요
alias(libs.plugins.twix.koin)
}추가 개선사항:
파일 생성 후 JSON 유효성을 검증하여, 잘못된 시크릿이 설정된 경우 빌드가 실패하도록 하는 것을 권장합니다. 이를 통해 개발자가 설정 오류를 빠르게 발견할 수 있습니다.
🤖 Prompt for AI Agents
.github/workflows/android-ci.yml around lines 47 to 52: the workflow creates
./app/src/debug/google-services.json but the Google Services Gradle plugin is
not applied so the file won’t be picked up by the build; add the Google Services
plugin to the app module (app/build.gradle.kts) or add it to your build-logic
convention (AndroidApplicationConventionPlugin) so the plugin
alias/libs.plugins.gms.google.services is applied for the application module,
and optionally add a step after file creation to validate the JSON is non-empty
and well-formed to fail CI early on invalid secret.
보류!!