[feature-2] CI/CD 구축 #1
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Java CI with Gradle | |
on: | |
pull_request: | |
branches: | |
- dev | |
permissions: write-all #테스트 결과 작성을 위해 쓰기권한 추가 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
#jdk 세팅 | |
- name: check out | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
#gradle 캐싱 | |
- 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- | |
### CI | |
#gradlew 권한 추가 | |
- name: Grant Execute Permission For Gradlew | |
run: chmod +x gradlew | |
#test를 제외한 프로젝트 빌드 | |
- name: Build With Gradle | |
run: ./gradlew build -x test | |
#test코드 빌드 | |
- name: Build With Test | |
run: ./gradlew test | |
#테스트 결과 파일 생성 | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
if: ${{ always() }} | |
with: | |
files: build/test-results/**/*.xml |