add pr-test.yml file #8
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: Test | |
on: | |
pull_request: | |
branches: [ "develop/be" ] # develop/be 브랜치에 PR 시 실행 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write # 체크 실행 결과 표시 권한 | |
contents: read # 저장소 read 권한 | |
pull-requests: write # PR에 코멘트 작성 허용 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle # Gradle 캐싱 활성화 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | |
- name: make application.properties | |
run: | | |
cd ./backend/src/main/resources | |
echo "${{ secrets.APPLICATION_PROD_DEV }}" > ./application.properties | |
- name: create-json | |
id: create-json | |
uses: jsdaniell/[email protected] | |
with: | |
name: "gce_sa_key.json" | |
json: ${{ secrets.GCE_SA_KEY }} | |
- name: Move JSON file | |
run: mv gce_sa_key.json /app/gce_sa_key.json | |
- name: Grant execute permission for gradlew and test | |
run: | | |
cd ./backend | |
chmod +x gradlew | |
./gradlew --info test | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 # JUnit, NUnit, xUnit 등의 테스트 결과를 자동으로 PR에 표시하는 GitHub Action | |
if: always() | |
with: | |
junit_files: '**/build/test-results/test/TEST-*.xml' # gradle의 테스트 결과 파일 |