From b351aa104552e3ad0ea53620bf9009519f993faa Mon Sep 17 00:00:00 2001 From: baejunil Date: Fri, 27 Oct 2023 17:51:33 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20github=20actions=EB=A1=9C=20CI=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EC=9D=84=20=EC=84=B8=ED=8C=85=ED=95=9C?= =?UTF-8?q?=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 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 000000000..4037fea22 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI-Backend + +on: + push: + branches: [ "dev", "main" ] + pull_request: + branches: [ "dev", "main" ] + +permissions: + contents: read + # PR 코멘트 등록을 위한 write 권한 + checks: write + pull-requests: write + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + # Java version 세팅 + - 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 ./anifriends/gradlew + shell: bash + + # 빌드 + - name: Build with Gradle + run: ./anifriends/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