Skip to content

chore: CI Gradle 빌드 캐시 적용#284

Merged
easyhooon merged 2 commits intodevelopfrom
BOOK-290-chore/#163
Feb 26, 2026
Merged

chore: CI Gradle 빌드 캐시 적용#284
easyhooon merged 2 commits intodevelopfrom
BOOK-290-chore/#163

Conversation

@easyhooon
Copy link
Contributor

@easyhooon easyhooon commented Feb 25, 2026

CI 속도 개선을 위함

🔗 관련 이슈

📙 작업 설명

  • gradle.properties에 org.gradle.caching=true 추가 (빌드 결과물(Task Output)을 캐시하여 재사용
    • 태스크 입력(소스, 의존성, 컴파일러 옵션 등)이 동일하면 이전 빌드 결과를 재사용하여 빌드 시간 단축
  • Gradle Action을 gradle/gradle-build-action@v2에서 gradle/actions/setup-gradle@v4로 교체
  • cache-read-only: PR에서는 캐시 읽기만 허용(read-only), push(develop/main)에서만 캐시 갱신하여 용량 절약
  • cache-cleanup: on-success: 빌드 성공 시 미사용 캐시 엔트리 자동 정리

🧪 테스트 내역 (선택)

  • 주요 기능 정상 동작 확인
  • 브라우저/기기에서 동작 확인
  • 엣지 케이스 테스트 완료
  • 기존 기능 영향 없음

💬 추가 설명 or 리뷰 포인트 (선택)

  • 첫 CI 실행은 캐시가 없으므로 기존과 동일한 속도이며, 이후 develop/main push부터 캐시가 적용됩니다.
  • CI 캐싱 적용은 해당 레퍼런스를 참고하였습니다

태스크

Gradle에서 태스크는 빌드 과정의 각 개별 작업 단위입니다.

assembleDebug를 실행하면 내부적으로 이런 태스크들이 순서대로 실행됩니다:

  1. compileDebugKotlin — Kotlin 소스 컴파일
  2. processDebugResources — 리소스(xml, 이미지 등) 처리
  3. mergeDebugAssets — assets 병합
  4. dexBuilderDebug — DEX 변환
  5. packageDebug — APK 패키징
  6. ...

이게 모듈마다 있으니까 core, feature, app 각각에 이런 태스크들이 존재합니다.

빌드 캐시는 이 태스크 하나하나에 대해 "입력이 이전과 같으면 결과를 재사용"하는 방식입니다. 예를 들어 core 모듈의 소스를 안 건드렸으면 core:compileDebugKotlin 태스크는 캐시 hit → 스킵됩니다.

태스크에서 입력의 의미

여기서 입력은 태스크가 실행될 때 참조하는 모든 것입니다.

compileDebugKotlin 태스크를 예로 들면:

입력:

  • .kt 소스 파일들
  • 의존하는 라이브러리 버전
  • Kotlin 컴파일러 버전/옵션

출력:

  • 컴파일된 .class 파일들

Gradle이 이 태스크를 실행하기 전에 입력들의 해시값을 계산합니다.
이전 빌드 때와 해시가 같으면 "소스 안 바뀌었으니 다시 컴파일할 필요없다"고 판단하고 캐시된 출력(.class 파일)을 그대로 쓰는 겁니다.

processDebugResources도 마찬가지로:

  • 입력: res/ 폴더의 xml, 이미지 파일들
  • 출력: 처리된 리소스 파일들

리소스를 안 건드렸으면 → 해시 동일 → 캐시 hit → 스킵

결국 "코드나 설정을 바꾼 부분과 관련된 태스크만 다시 실행된다"는 뜻입니다.

Summary by CodeRabbit

릴리스 노트

  • Chores
    • CI/CD 빌드 프로세스 트리거 및 실행 조건 업데이트로 더 자주/예측 가능하게 빌드가 실행되도록 개선
    • 빌드 도구 설정과 캐시/병렬 실행 활성화로 빌드 성능 및 안정성 향상
    • 캐시 동작 및 후처리 흐름 정비로 CI 효율성 증대

@easyhooon easyhooon changed the title [BOOK-290] chore: CI Gradle 빌드 캐시 적용 chore: CI Gradle 빌드 캐시 적용 Feb 25, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between baace35 and ceeba01.

📒 Files selected for processing (1)
  • .github/workflows/android-ci.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/android-ci.yml

Walkthrough

GitHub Actions 안드로이드 CI 워크플로우에 push 트리거가 추가되고, Gradle 액션이 gradle/actions/setup-gradle@v4로 교체되었으며 캐시 동작이 조건부로 변경되었습니다. 또한 gradle.properties에서 병렬 실행·설정 캐시·빌드 캐시가 활성화되었습니다.

Changes

Cohort / File(s) 요약
CI 워크플로우
.github/workflows/android-ci.yml
pull_request에 더해 push 이벤트 트리거 추가. ci-build 및 stability_check 작업의 Gradle 액션을 gradle/gradle-build-action@v2에서 gradle/actions/setup-gradle@v4로 교체. gradle-home-cache-cleanup 제거, cache-read-only 조건부 설정(이벤트 타입 기준) 및 관련 주석/후처리 단계 추가. ci-build 조건문에 push 이벤트 고려하도록 조정.
Gradle 구성
gradle.properties
주석 해제 및 설정 추가: org.gradle.parallel=true, org.gradle.configuration-cache=true, org.gradle.caching=true로 병렬 실행·설정 캐시·빌드 캐시 활성화. 기존 JVM args 및 AndroidX 속성은 유지.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🐰 휙휙 도약하며 캐시를 씻고,
병렬로 달려 빌드가 춤추네.
푸시와 PR 둘 다 맞이하며,
속도는 쑥쑥, 기다림은 쏙쏙.
토끼가 전하는 빠른 CI 축배! 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 Gradle 빌드 캐시 적용이라는 주요 변경사항을 명확하게 요약하고 있습니다.
Linked Issues check ✅ Passed CI 속도 개선을 위한 gradle.properties 캐시 설정 추가, GitHub Actions Gradle 액션 업그레이드, 캐시 정책 구성 등 모든 주요 목표가 #163 요구사항을 충족합니다.
Out of Scope Changes check ✅ Passed gradle.properties와 CI 워크플로우 파일의 모든 변경사항이 CI 속도 개선이라는 링크된 이슈의 범위 내에 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch BOOK-290-chore/#163

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (1)
.github/workflows/android-ci.yml (1)

42-43: push 시 두 잡 모두 캐시 쓰기를 허용하면 캐시 churn이 커질 수 있습니다.

용량 절약이 목표라면 stability_check는 read-only로 고정해도(읽기 재사용 유지) 저장소 사용량을 더 안정적으로 줄일 수 있습니다.

♻️ 제안 수정 (`stability_check`만)
-                    cache-read-only: ${{ github.event_name == 'pull_request' }}
+                    cache-read-only: true

Also applies to: 85-86

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/android-ci.yml around lines 42 - 43, The workflow
currently allows cache writes on push which can increase cache churn; update the
workflow so the stability_check job sets cache-read-only to true (i.e., keep
read-only behavior regardless of github.event_name) by modifying the
stability_check job's cache-read-only setting (reference job name
"stability_check" and the "cache-read-only" key) so pushes do not write caches
while other jobs can remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/android-ci.yml:
- Around line 39-40: Update the incorrect comments for the setup-gradle@v4
action's cache-cleanup option: change the comment text currently saying
"default: never" to the correct "default: on-success" for both occurrences (the
comment near the cache-cleanup: on-success setting and the second instance
further down), ensuring the comment next to the cache-cleanup key and any
explanatory comment blocks reflect the actual default behavior of
setup-gradle@v4.

---

Nitpick comments:
In @.github/workflows/android-ci.yml:
- Around line 42-43: The workflow currently allows cache writes on push which
can increase cache churn; update the workflow so the stability_check job sets
cache-read-only to true (i.e., keep read-only behavior regardless of
github.event_name) by modifying the stability_check job's cache-read-only
setting (reference job name "stability_check" and the "cache-read-only" key) so
pushes do not write caches while other jobs can remain unchanged.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a536f75 and baace35.

📒 Files selected for processing (2)
  • .github/workflows/android-ci.yml
  • gradle.properties

Comment on lines 39 to 40
# 빌드 성공 시 미사용 캐시 엔트리 자동 정리 (default: never)
cache-cleanup: on-success
Copy link

@coderabbitai coderabbitai bot Feb 25, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the actual file to see the context
cat -n .github/workflows/android-ci.yml | sed -n '35,45p'

Repository: YAPP-Github/Reed-Android

Length of output: 714


🏁 Script executed:

# Also check lines 80-90 for the other occurrence mentioned
cat -n .github/workflows/android-ci.yml | sed -n '80,90p'

Repository: YAPP-Github/Reed-Android

Length of output: 662


🌐 Web query:

setup-gradle@v4 cache-cleanup default value documentation

💡 Result:

For gradle/actions/setup-gradle@v4, the cache-cleanup input defaults to on-success (i.e., it only runs cache cleanup when all Gradle builds in the job succeed). You can set it to always or never. [1]

This behavior (and that cache cleanup is enabled by default in v4) is also noted in the v4 deprecation/upgrade guide, where the old boolean gradle-home-cache-cleanup input was replaced by cache-cleanup. [2]

Sources: [1], [2]


cache-cleanup 주석의 기본값을 수정하세요.

setup-gradle@v4 액션의 cache-cleanup 기본값은 on-success이지만, 주석에는 default: never로 잘못 표기되어 있습니다. 두 위치(39-40, 83-84)의 주석을 모두 수정해야 합니다.

수정 방법
-                    # 빌드 성공 시 미사용 캐시 엔트리 자동 정리 (default: never)
+                    # 빌드 성공 시 미사용 캐시 엔트리 자동 정리 (default: on-success)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# 빌드 성공 시 미사용 캐시 엔트리 자동 정리 (default: never)
cache-cleanup: on-success
# 빌드 성공 시 미사용 캐시 엔트리 자동 정리 (default: on-success)
cache-cleanup: on-success
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/android-ci.yml around lines 39 - 40, Update the incorrect
comments for the setup-gradle@v4 action's cache-cleanup option: change the
comment text currently saying "default: never" to the correct "default:
on-success" for both occurrences (the comment near the cache-cleanup: on-success
setting and the second instance further down), ensuring the comment next to the
cache-cleanup key and any explanatory comment blocks reflect the actual default
behavior of setup-gradle@v4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

default값 어디서 어떻게 확인할 수 있어?

Copy link

Choose a reason for hiding this comment

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

@easyhooon GitHub Actions의 default 값을 확인하는 방법은 다음과 같습니다:

1. 액션 저장소의 action.yml 파일 확인

가장 정확한 방법은 해당 액션의 GitHub 저장소에서 action.yml (또는 action.yaml) 파일을 직접 확인하는 것입니다.

setup-gradle@v4의 경우:

여기서 inputs 섹션을 보면 각 파라미터의 default 값이 명시되어 있습니다:

cache-cleanup:
  description: ...
  required: false
  default: 'on-success'

2. 공식 문서 확인

3. 실전 팁

  • GitHub에서 액션 버전을 명시할 때 (예: @v4), 해당 버전의 태그나 릴리스를 찾아가서 확인
  • 액션 사용 시 @ 뒤의 버전/태그/커밋을 클릭하면 해당 시점의 코드로 이동 가능

현재 케이스에서 cache-cleanup의 default 값은 실제로 on-success가 맞습니다! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

default가 on-success면 굳이 설정 코드 남길필요없잖아 주석만 남기고 코드는 지워야겠네

Copy link

Choose a reason for hiding this comment

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

No description provided.

Copy link
Contributor

@seoyoon513 seoyoon513 left a comment

Choose a reason for hiding this comment

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

캐시 적용 시 시간 단축 얼마나 될지 기대됩니다 👍👍

@easyhooon
Copy link
Contributor Author

캐시 적용 시 시간 단축 얼마나 될지 기대됩니다 👍👍

첫 빌드시간은 그대로 일텐데 그 이후에 리뷰 반영이나, 추가 커밋시 시간은 많이 줄어들것같습니다. 다른 사이드 플젝에서 리뷰 반영 및 추가 때문에 깃허브 액션 무료 2000분을 다 소진해서 현재 못돌리고있는데 기대가 되네요 ㅎ

@easyhooon
Copy link
Contributor Author

image 엥? 11분 걸렸는데? 그대론데?

@easyhooon easyhooon merged commit 6226536 into develop Feb 26, 2026
4 checks passed
@easyhooon easyhooon deleted the BOOK-290-chore/#163 branch February 26, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BOOK-290/chore] CI 속도 개선

2 participants