Skip to content

Commit

Permalink
#3 test: ci 수정
Browse files Browse the repository at this point in the history
- gradle actions 적용
- 불필요한 build step 제거
- 테스트 실패시에만 결과 코멘트 작성
  • Loading branch information
rivkode committed Sep 5, 2024
1 parent 4da62a5 commit 7bfc4a4
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,44 @@ jobs:
java-version: '17'
distribution: 'adopt'

- name: Gradle Caching
uses: actions/cache@v3
# - name: Gradle Caching
# uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

# gradle 실행 허가
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
# - name: Run chmod to make gradlew executable
# run: chmod +x ./gradlew

- name: 빌드 진행
run: ./gradlew build -x test
# - name: 빌드 진행
# run: ./gradlew build -x test

- name: 테스트 코드 실행
run: ./gradlew --info test

- name: 테스트 결과 PR에 코멘트 작성
uses: EnricoMi/publish-unit-test-result-action@v2
if: always() # 테스트가 실패했을때만 or 테스트가 성공했을때만 알려주기(여기선 둘다!)
if: always() # 테스트가 실패했을때만 or 테스트가 성공했을때만 알려주기
with:
files: |
**/build/test-results/**/*.xml
comment_mode: 'failures'

# Files changed에서 어디에서 잘못되었는지 가르쳐준다.
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
report_paths: '**/build/test-results/test/TEST-*.xml'

0 comments on commit 7bfc4a4

Please sign in to comment.