test: CommentService Test 작성 #25
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 | |
permissions: | |
checks: write | |
pull-requests: write | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_DATABASE: milkweb | |
MYSQL_ROOT_PASSWORD: ${{secrets.MY_SQL_PWD}} | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: touch ./src/main/resources/application-oauth.properties | |
- run: echo "${{ secrets.APPLICATION_OAUTH }}" > ./src/main/resources/application-oauth.properties | |
- run: cat ./src/main/resources/application-oauth.properties | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Install MySQL Server | |
run: sudo apt-get install mysql-server | |
- name: Test MySQL Connection | |
run: | | |
mysql -h 127.0.0.1 -u root -p${{secrets.MY_SQL_PWD}} -e "SELECT 1;" | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2.9.0 | |
with: | |
arguments: | | |
clean build | |
# 테스트 후 Result를 보기위해 Publish Unit Test Results step 추가 | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
if: ${{ always() }} # 테스트가 실패하여도 Report를 보기 위해 `always`로 설정 | |
with: | |
files: build/test-results/**/*.xml |