From b1683c9680601784bb61785c6863930f370d1c8d Mon Sep 17 00:00:00 2001 From: hs12 Date: Fri, 22 Dec 2023 19:10:10 +0900 Subject: [PATCH] =?UTF-8?q?chore=20:=20ci.yml=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..12cc005a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +# 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: CI Backend + +on: + push: + branches: [ "main", "dev" ] + pull_request: + branches: [ "main", "dev" ] + +permissions: + contents: read + checks: write + pull-requests: write + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + # 자바 버전 설정 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + # 빌드 시 캐시 적용 + - 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- + + # gradle 권한 부여 + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + shell: bash + + # 빌드 + - name: Build with Gradle + run: ./gradlew build + + # 테스트 결과 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' \ No newline at end of file