fix : 파일 하나만 받도록 #66
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: CI | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
permissions: | |
contents: read | |
# PR 코멘트 등록을 위한 write 권한 | |
checks: write | |
pull-requests: write | |
jobs: | |
build: | |
name: Build and analyze | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' # Alternative distribution options are available | |
- name: make application.properties 파일 생성 | |
run: | | |
## create application.yml | |
mkdir ./src/main/resources | |
cd ./src/main/resources | |
# application.yml 파일 생성 | |
touch ./application.yml | |
# GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기 | |
echo "${{ secrets.LOVE_MARKER_DEV_APPLICATION }}" >> ./application.yml | |
# application.yml 파일 확인 | |
cat ./application.yml | |
shell: bash | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew build sonar --info | |
## 테스트 결과 PR 코멘트에 등록 | |
- name: Register the test results as PR comments | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: '**/build/test-results/test/TEST-*.xml' | |
## 테스트 실패시 코드 라인에 대한 체크 추가 | |
- name: If test fail, add check comment on failed code line | |
uses: mikepenz/action-junit-report@v3 | |
if: always() | |
with: | |
report_paths: '**/build/test-results/test/TEST-*.html' |