[Test] TestContainers와 H2로 DB 테스트하기 #6
Workflow file for this run
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
name: PR 시 CI 테스트 자동화 | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: 레포지토리 체크아웃 | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GIT_TOKEN }} | |
- run: touch ./src/main/resources/security.properties | |
- run: echo "${{ secrets.SECURITY_PROP }}" > ./src/main/resources/security.properties | |
- name: JDK 17 설치 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Gradle 종속성 캐시 | |
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: Gradle 명령 실행 권한 부여 | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Gradle로 프로젝트 Build | |
run: ./gradlew build | |
- name: 테스트 결과를 PR 코멘트로 출력 | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: '**/build/test-results/test/TEST-*.xml' | |
- name: 테스트 실패 시, 오류가 발생한 코드 라인에 코멘트 추가 | |
uses: mikepenz/action-junit-report@v4 | |
if: always() | |
with: | |
report_paths: '**/build/test-results/test/TEST-*.xml' |