-
Notifications
You must be signed in to change notification settings - Fork 0
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
[CHORE] CI 스크립트 작성 #21
Conversation
Test Results1 tests 1 ✅ 0s ⏱️ Results for commit 4f11bf8. ♻️ This comment has been updated with latest results. |
📝 Test Coverage Report
|
Backend_Dev_CI.yml > Dev_CI.yml
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.
/noti
PR을 통해 정상 작동 확인했습니다!
제안 사항 달아 두었으니 가능한 부분만 반영 부탁드릴께요!
build.gradle
Outdated
tasks.named('test') { | ||
useJUnitPlatform() | ||
finalizedBy jacocoTestReport | ||
} |
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.
[제안] local에서 테스트할 때도 항상 jacocoTestReport
가 실행될 것 같은데, 더 좋은 방안 없을까요? (특정 옵션을 주어야만 작동하게 한다거나 등등...)
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.
TEST_REPORT 환경변수 옵션에 따라서 실행여부를 결정하도록 하였습니다.
- local에서는 환경변수가 없어서 실행되지 않음
- Script 상에서는 env 설정을 통해
jacocoTestReport {
dependsOn test
reports {
xml.required.set(true)
csv.required.set(false)
html.required.set(false)
}
//dto는 테스트 대상에서 제외
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"com/debatetimer/**/dto/**"
])
}))
}
**onlyIf {
return System.getenv('TEST_REPORT') == 'true'
}**
}
CI script 에서 환경 변수 설정
name: dev-ci
on:
pull_request:
branches:
- develop
permissions: write-all
jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 2
env:
TEST_REPORT: true
/noti
|
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.
/noti
콜리 ci 스크립트에 관해서 궁금한 부분이 있어 RC 남겼어요~
확인 부탁드려요
.github/workflows/Dev_CI.yml
Outdated
- name: Cache Gradle dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: | | ||
${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- |
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.
gradle을 캐싱하는 부분 같은데 gitHub 공식문서에서는 actions의 활용을 권장하고 있습니다.
https://docs.github.com/ko/actions/use-cases-and-examples/building-and-testing/building-and-testing-java-with-gradle#caching-dependencies
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.
✅ 반영 완료!
.github/workflows/Dev_CI.yml
Outdated
branches: | ||
- develop | ||
|
||
permissions: write-all |
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.
쓰기 권한이 너무 광범위 한 것 같아요. 필요한 권한만 주는 건 어떤가요?
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.
✅ 반영 완료
permissions:
contents: read
checks: write
pull-requests: write
.github/workflows/Dev_CI.yml
Outdated
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 2 |
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.
2분으로 설정한 기준이 궁금해요
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.
도메인이 커진 오디 CI 스크립트가 1분 40초정도 소모되어 현재 프로젝트 규모에서 확장된 상황을 감안했을 때에도 2분이라는 기준이 이상치를 판단하기에 적정한 기준이라 생각했던 것 같아요.
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.
다시 보니 1분 40초가 아니라 2분 40초 정도였네요... 3분으로 늘려주었습니다. GPT도 gradle test까지 2분은 너무 짧다고 하네요 😓
.github/workflows/Dev_CI.yml
Outdated
- name: Publish Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: always() | ||
with: | ||
files: ${{ github.workspace }}/build/test-results/**/*.xml | ||
|
||
- name: JUnit Report Action | ||
uses: mikepenz/action-junit-report@v4 | ||
if: always() | ||
with: | ||
report_paths: ${{ github.workspace }}/build/test-results/**/*.xml | ||
|
||
- name: Report test Coverage to PR | ||
id: jacoco | ||
uses: madrapps/[email protected] | ||
with: | ||
title: 📝 Test Coverage Report | ||
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
min-coverage-overall: 80 | ||
min-coverage-changed-files: 80 | ||
update-comment: true | ||
debug-mode: true |
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.
이건 제가 잘 몰라서 질문드립니다.
지금 Publish Test Results
와 JUnit Report Action
는 if: always()
를 통해 앞의 step이 실패해도 동작하게 하는 것 같은데 Report test Coverage to PR
는 그런 조건이 없어도 앞의 step에서 실패해도 동작하나요?
해당 부분이 테스트 결과를 PR에 코멘트로 올리는 부분 같은데 if: always()
이게 없어도 작동하는 지 궁금해서 질문드립니다.
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.
/noti 리뷰 모두 반영하였고 의견도 남겼으니 천천히 살펴봐주세요~ |
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.
/noti
리뷰 관련해서 다 확인했습니다!
근데 정말 사소한 궁금증 있어서 RC 남겨요~
.github/workflows/Dev_CI.yml
Outdated
on: | ||
push: | ||
branches: | ||
- chore/#20 | ||
pull_request: | ||
branches: |
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.
이 조건은 왜 필요한가요?
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.
permissions 관련해서 push하면서 실험해보다가 원상복구 해주었는데, local에서만 반영되고 push가 안되었어요 😓 복구해주었습니다!
/noti 트리거 원상복구 반영하였습니다! (local에서 수정하고 복구된 부분이 push가 안되었었네요 😓 ) ㅎㅎ 꼼꼼한 비토와의 PR 벌써부터 기대되어요 💪 |
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.
/noti
깔끔하네요. merge도 바로 하겠습니다!
🚩 연관 이슈
closed #20
closed #22
⭐ CI Description
🗣️ 리뷰 요구사항 (선택)