질문 도메인의 API, Service 기능 구현 및 테스트 작성 #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# main 브랜치에 PR 이벤트가 발생하면 Workflow가 실행된다. | |
# 브랜치 구분이 없으면 on: [pull_request]로 해주어도 된다. | |
on: | |
pull_request: | |
branches: [ "main" ] | |
# 테스트 결과 작성을 위해 쓰기권한 추가 | |
permissions: | |
checks: write | |
pull-requests: write | |
# Job 실행 | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 레포지토리 체크아웃 | |
uses: actions/checkout@v4 | |
- name: JDK 17 설치 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
# - 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: | |
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: ./gradlew build -x test | |
- name: 테스트 코드 실행 | |
run: ./gradlew --info test | |
- name: 테스트 결과 PR에 코멘트 작성 | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: | | |
**/build/test-results/**/*.xml | |
# 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' |