-
Notifications
You must be signed in to change notification settings - Fork 4
[CI] ci.yml 파일 생성 #14
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
Conversation
This commit introduces a GitHub Actions workflow that automates the build process for both Android and iOS platforms. The workflow includes the following jobs: - `android-build`: Builds debug and release APKs for Android. - `ios-build`: Builds the iOS framework for simulator and device, and builds the iOS app. Key steps in the workflow include: - Checking out the code. - Setting up JDK 11. - Granting execute permission for gradlew. - Caching Gradle packages to speed up subsequent builds. - Running the respective build commands for Android and iOS. - For iOS, it also sets up Xcode.
Walkthrough새 GitHub Actions CI 워크플로우(.github/workflows/ci.yml)를 추가해 main/develop의 push 및 pull_request에서 Android(ubuntu-latest)와 iOS(macos-latest) 빌드를 병렬로 실행하도록 구성했습니다. JDK 17 설정, Gradle 캐시, 권한 부여 및 각 플랫폼별 빌드 명령을 포함합니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as 개발자
participant GH as GitHub
participant WF as CI Workflow
participant A as Android Runner (ubuntu-latest)
participant I as iOS Runner (macos-latest)
Dev->>GH: push / pull_request (main, develop)
GH->>WF: 워크플로우 트리거
par 병렬 실행
WF->>A: android-build 시작
A->>A: checkout, setup JDK 17, gradle 캐시, chmod gradlew
A->>A: ./gradlew assembleDebug --stacktrace
A->>A: ./gradlew assembleRelease --stacktrace
WF->>I: ios-build 시작
I->>I: checkout, setup JDK 17, select Xcode, gradle 캐시, chmod gradlew
I->>I: ./gradlew linkDebugFrameworkIosSimulatorArm64 --stacktrace
I->>I: ./gradlew linkDebugFrameworkIosArm64 --stacktrace
I->>I: cd iosApp && xcodebuild (Simulator, CODE_SIGNING_ALLOWED=NO)
end
WF-->>GH: 빌드 결과 보고
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests
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 (11)
.github/workflows/ci.yml (11)
3-8: 트리거 범위 확인: feature 브랜치 push는 빌드 안 돼요push 트리거가 main/develop만 포함해 feature/* 브랜치에 직접 push 시 CI가 돌지 않습니다. 의도라면 OK, 아니라면 아래처럼 브랜치 패턴을 넓히거나 paths 조건을 추가해 주세요.
on: push: - branches: [ main, develop ] + branches: + - main + - develop + - 'feature/**' pull_request: branches: [ main, develop ] types: [ opened, synchronize, reopened ]
11-12: OS 러너 pin 권장ubuntu-latest 롤링 업그레이드로 빌드가 예고 없이 깨질 수 있습니다. 안정성을 위해 LTS로 pin 해주세요. 타임아웃도 설정 권장.
- android-build: - runs-on: ubuntu-latest + android-build: + runs-on: ubuntu-22.04 + timeout-minutes: 30
27-36: Gradle 캐시 스텝 교체 제안: wrapper 검증 + 공식 Gradle 액션actions/cache 수동 키 관리 대신 Gradle 공식 액션이 더 정확하고 안전합니다. wrapper 검증도 같이 넣어주세요.
- - name: Cache Gradle packages - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v2 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3같은 변경을 iOS job에도 적용해 주세요.
Also applies to: 62-71
37-41: Release APK 빌드 실패 가능성(사인 키 불필요/미설정 시)assembleRelease는 서명 설정 없으면 실패합니다. 의도적으로 빌드만 검증하려면 Debug만 빌드하거나, 조건부로 Release를 분리하세요.
- - name: Build Android Release APK - run: ./gradlew assembleRelease --stacktrace + - name: Build Android Release APK (optional) + if: ${{ vars.BUILD_RELEASE == 'true' }} + run: ./gradlew assembleRelease --stacktrace --no-daemon추가로 CI에서는
--no-daemon사용을 권장합니다.
43-45: macOS/Xcode 버전 고정macos-latest/Xcode 기본 경로 고정은 변동성 큽니다. 러너 이미지와 Xcode를 명시적으로 pin 하세요. setup-xcode 액션 사용을 추천합니다.
- ios-build: - runs-on: macos-latest + ios-build: + runs-on: macos-14 + timeout-minutes: 45 @@ - - name: Select Xcode - run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.4'버전은 프로젝트 호환 범위로 조정해 주세요.
Also applies to: 56-58
62-71: Kotlin/Native(Konan) 캐시 추가로 iOS/KMP 빌드 가속KMP라면
~/.konan캐싱이 효과 큽니다.- name: Cache Gradle packages uses: actions/cache@v4 with: path: | ~/.gradle/caches ~/.gradle/wrapper key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- + + - name: Cache Kotlin/Native (Konan) + uses: actions/cache@v4 + with: + path: ~/.konan + key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-konan-
78-81: iOS 빌드 안정화 + 아티팩트 업로드 추가 제안
- destination의
OS=latest는 간헐적 실패 유발. 핀 또는 동적 조회 권장.- 빌드 산출물 업로드로 디버깅/공유 편의성↑.
- name: Build iOS App run: | - cd iosApp - xcodebuild -project iosApp.xcodeproj -scheme iosApp -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' build CODE_SIGNING_ALLOWED=NO + set -eo pipefail + cd iosApp + xcrun simctl list runtimes + xcodebuild -project iosApp.xcodeproj \ + -scheme iosApp \ + -configuration Debug \ + -destination 'platform=iOS Simulator,name=iPhone 15' \ + -sdk iphonesimulator \ + CODE_SIGNING_ALLOWED=NO \ + build + + - name: Upload Android APKs + if: always() + uses: actions/upload-artifact@v4 + with: + name: android-apks + path: | + **/build/outputs/apk/**/debug/*.apk + **/build/outputs/apk/**/release/*.apk + + - name: Upload iOS build products + if: always() + uses: actions/upload-artifact@v4 + with: + name: ios-build + path: | + iosApp/build/**/*.app + **/build/bin/**/debugFramework/**
1-1: 권한 최소화와 중복 실행 취소(concurrency) 제안워크플로우 전역 권한을 최소화하고 동일 ref의 중복 실행을 취소해 리소스 절약하세요.
name: CI + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true
37-38: Gradle 플래그: CI 친화 옵션 추가
--no-daemon --warning-mode all -Dorg.gradle.parallel=true등 CI 친화 플래그 권장.- run: ./gradlew assembleDebug --stacktrace + run: ./gradlew assembleDebug --stacktrace --no-daemon -Dorg.gradle.parallel=true @@ - run: ./gradlew linkDebugFrameworkIosArm64 --stacktrace + run: ./gradlew linkDebugFrameworkIosArm64 --stacktrace --no-daemon -Dorg.gradle.parallel=trueAlso applies to: 75-76
81-81: EOF 개행 누락파일 끝에 개행이 없습니다. 일부 linters에서 실패합니다.
- xcodebuild -project iosApp.xcodeproj -scheme iosApp -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' build CODE_SIGNING_ALLOWED=NO + xcodebuild -project iosApp.xcodeproj -scheme iosApp -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' build CODE_SIGNING_ALLOWED=NO +
72-77: KMP iOS 타깃·프레임워크 task 확인 — 워크플로우 명령 유효함composeApp/build.gradle.kts(약 23–27)에서 iosX64(), iosArm64(), iosSimulatorArm64()와 iosTarget.binaries.framework가 선언되어 있으므로 .github/workflows/ci.yml의 ./gradlew linkDebugFrameworkIosSimulatorArm64 및 ./gradlew linkDebugFrameworkIosArm64 호출은 타깃 이름과 일치합니다.
선택사항: 여러 타깃을 통합 빌드하려면 :shared:createXCFramework 사용 고려.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci.yml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/ci.yml
[error] 81-81: no new line character at the end of file
(new-line-at-end-of-file)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: android-build
- GitHub Check: ios-build
🔇 Additional comments (1)
.github/workflows/ci.yml (1)
15-23: 체크아웃/Java 설정은 적절합니다JDK 17(Temurin) 설정과 checkout@v4 사용은 목적에 맞습니다.
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 |
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.
액션 버전 tag 대신 커밋 SHA pin 권장
서플라이 체인 리스크 완화를 위해 @v4/@v3 태그 대신 커밋 SHA로 pin 하세요. GitHub 보안 가이드가 권장합니다.
예)
-uses: actions/checkout@v4
+uses: actions/checkout@<commit-sha>필요 시 제가 현재 권장 SHA 목록 드릴게요.
Also applies to: 19-19, 28-28, 48-48, 51-51, 63-63
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: 0
♻️ Duplicate comments (1)
.github/workflows/ci.yml (1)
16-16: 액션 버전 태그 대신 커밋 SHA로 pin 하세요서플라이 체인 리스크 완화 및 재현성 확보를 위해
@v4태그 대신 커밋 SHA 고정 권장합니다. 아래 예시처럼 모든uses:에 적용해주세요.-uses: actions/checkout@v4 +uses: actions/checkout@<commit-sha> -uses: actions/setup-java@v4 +uses: actions/setup-java@<commit-sha> -uses: actions/cache@v4 +uses: actions/cache@<commit-sha>원하시면 현재 권장 SHA 목록 드릴게요.
Also applies to: 19-19, 28-28, 48-48, 51-51, 63-63
🧹 Nitpick comments (9)
.github/workflows/ci.yml (9)
3-9: 동시 실행 취소(concurrency)로 중복 빌드 낭비 방지동일 브랜치로 연속 푸시 시 이전 작업 자동 취소 설정을 추가하면 CI 시간 절약됩니다.
on: push: branches: [ main, develop ] pull_request: branches: [ main, develop ] types: [ opened, synchronize, reopened ] + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true
12-12: 호스트 러너 버전 고정 권장
ubuntu-latest,macos-latest는 예기치 않은 이미지 변경으로 빌드가 깨질 수 있습니다. 안정성 위해 명시 버전으로 고정 검토해주세요(예:ubuntu-24.04,macos-14등).Also applies to: 44-44
18-23: Gradle 캐시 방식 단순화: setup-java의 내장 캐시 사용수동
actions/cache대신actions/setup-java의cache: 'gradle'옵션을 쓰면 키 관리가 단순해지고 실수 위험이 줄어듭니다. 두 잡 모두에 적용해주세요.- name: Set up JDK 17 -uses: actions/setup-java@v4 +uses: actions/setup-java@<commit-sha> with: java-version: '17' distribution: 'temurin' + cache: 'gradle' -# (삭제) 수동 Gradle 캐시 단계 -- name: Cache Gradle packages - uses: actions/cache@<commit-sha> - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle-iOS 잡(51
55, 6271)에도 동일하게 적용 바랍니다.Also applies to: 27-36, 50-55, 62-71
15-16: Gradle Wrapper 무결성 검증 추가서드파티 PR/디펜던시 공격 대비를 위해 Gradle Wrapper 검증 액션을 체크아웃 직후에 추가하세요.
- name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@<commit-sha> + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@<commit-sha>Also applies to: 47-48
10-10: 레포 권한 최소화(permissions) 기본값 명시워크플로우 상단에 최소 권한을 명시해 토큰 오남용 위험을 낮추세요.
jobs: +permissions: + contents: read필요 시 잡 단위로 추가 권한을 올려주세요.
37-42: 빌드 성과물 업로드로 디버깅/공유 편의성 향상APK, KMM 프레임워크, Xcode 빌드 산출물(로그/앱)을 아티팩트로 업로드하면 실패 시 분석이 쉬워집니다.
- name: Build Android Release APK run: ./gradlew assembleRelease --stacktrace + - name: Upload Android APKs + uses: actions/upload-artifact@<commit-sha> + with: + name: android-apks + path: | + app/build/outputs/apk/**/**.apk + retention-days: 7 - name: Build iOS Framework for Simulator run: ./gradlew linkDebugFrameworkIosSimulatorArm64 --stacktrace - name: Build iOS Framework for Device run: ./gradlew linkDebugFrameworkIosArm64 --stacktrace + - name: Upload KMM Frameworks + uses: actions/upload-artifact@<commit-sha> + with: + name: kmm-frameworks + path: | + **/build/bin/**/linkDebugFramework*/** + retention-days: 7 - name: Build iOS App run: | cd iosApp xcodebuild -project iosApp.xcodeproj -scheme iosApp -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' build CODE_SIGNING_ALLOWED=NO + - name: Upload iOS build logs + if: always() + uses: actions/upload-artifact@<commit-sha> + with: + name: xcode-logs + path: ~/Library/Logs/DiagnosticReports/**/* + retention-days: 7Also applies to: 72-77, 78-81
78-81: iOS 빌드 전 의존성 확인(Pods 등)프로젝트가 CocoaPods/SwiftPM 사용 시
pod install또는xcodebuild -resolvePackageDependencies가 필요할 수 있습니다. 현재 단계엔 누락되어 있어 환경에 따라 빌드 실패 가능성이 있습니다.
1-1: 보안/비밀값 처리 가이드
baseUrl,google-services.json등 민감 정보는 GitHub Secrets/Actions variables로 주입하고 파일은 런타임에 생성하세요. 예: secret를 파일로 쓰기.- name: Write google-services.json run: | mkdir -p android/app/src/debug echo "${{ secrets.GOOGLE_SERVICES_JSON_DEBUG }}" > android/app/src/debug/google-services.json필요 시 환경별 분리와 시크릿 회전 전략 같이 잡아드릴게요.
81-81: 파일 끝 개행 누락YAMLlint 오류가 있습니다. EOF 개행 추가해주세요.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci.yml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/ci.yml
[error] 81-81: no new line character at the end of file
(new-line-at-end-of-file)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: ios-build
🔇 Additional comments (1)
.github/workflows/ci.yml (1)
56-58: Xcode 버전·시뮬레이터 고정 필요 — macOS 러너 이미지별 설치 차이로 빌드 실패 가능
- 문제: 현재 .github/workflows/ci.yml에서 sudo xcode-select로 시스템 Xcode를 선택하고 있는데, GitHub 호스티드 macOS 러너에 설치된 Xcode/시뮬레이터는 이미지(macos-14, macos-15, macos-latest 등)에 따라 달라 'iPhone 16' 시뮬레이터가 없으면 xcodebuild -destination이 실패합니다.
- 위치: .github/workflows/ci.yml — 56-58 (및 동일 이슈가 78-81에 적용)
권장 수정:
- - name: Select Xcode - run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer + - name: Select Xcode 16.x + uses: maxim-lobanov/setup-xcode@<commit-sha> + with: + xcode-version: '16.x' - name: Build iOS App run: | - cd iosApp - xcodebuild -project iosApp.xcodeproj -scheme iosApp -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' build CODE_SIGNING_ALLOWED=NO + cd iosApp + xcodebuild \ + -project iosApp.xcodeproj \ + -scheme iosApp \ + -destination 'platform=iOS Simulator,OS=latest,name=iPhone 16' \ + -configuration Debug \ + CODE_SIGNING_ALLOWED=NO \ + build확인 요청: 사용 중인 러너 이미지(macos-14 / macos-15 / macos-latest 등)와 확인 시점을 알려주세요. 해당 이미지의 설치된 Xcode 버전 및 시뮬레이터 목록을 확인해 정확한 xcode-version과 시뮬레이터 이름(OS)을 제안하겠습니다.
🚀 이슈번호
✏️ 변경사항
숨겨야 할 중요 값 정보가 있으면 추후 ci.yml 파일 수정이 필요하고, Github Secret 에 넣어야 합니다.
ex) baseUrl, google-services.json ...
Summary by CodeRabbit