🚀 이미지 관련 validation 추가와 각 상황에 맞는 테스트 코드 작성 #96
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: Spring Boot Gradle Test Workflow | |
on: | |
pull_request: | |
workflow_call: | |
inputs: | |
target-env: | |
required: true | |
type: string | |
secrets: | |
TEST_MYSQL_DATABASE: | |
required: true | |
TEST_MYSQL_USERNAME: | |
required: true | |
TEST_MYSQL_PASSWORD: | |
required: true | |
TEST_MYSQL_URL: | |
required: true | |
TEST_MYSQL_PORT: | |
required: true | |
MINIO_URL: | |
required: true | |
MINIO_BUCKET: | |
required: true | |
MINIO_USER: | |
required: true | |
MINIO_PASSWORD: | |
required: true | |
MINIO_PORT: | |
required: true | |
TOKEN_ISSUER: | |
required: true | |
TOKEN_SECRET: | |
required: true | |
TOKEN_EXPIRATION: | |
required: true | |
FORECAST_SERVICE_KEY: | |
required: true | |
FORECAST_URL: | |
required: true | |
permissions: | |
contents: read | |
checks: write | |
pull-requests: write | |
jobs: | |
build: | |
environment: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure docker-compose.yml | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: ./docker-compose.yml | |
env: | |
services.mysql-main.environment.MYSQL_ROOT_PASSWORD: ${{secrets.MAIN_MYSQL_PASSWORD}} | |
services.mysql-main.environment.MYSQL_DATABASE: ${{secrets.MAIN_MYSQL_DATABASE}} | |
services.mysql-main.ports.0: ${{secrets.MAIN_MYSQL_PORT}} | |
services.mysql-test.environment.MYSQL_ROOT_PASSWORD: ${{secrets.TEST_MYSQL_PASSWORD}} | |
services.mysql-test.environment.MYSQL_DATABASE: ${{secrets.TEST_MYSQL_DATABASE}} | |
services.mysql-test.ports.0: ${{secrets.TEST_MYSQL_PORT}} | |
services.minio.environment.MINIO_ROOT_USER: ${{secrets.MINIO_USER}} | |
services.minio.environment.MINIO_ROOT_PASSWORD: ${{secrets.MINIO_PASSWORD}} | |
services.minio.ports.0: ${{secrets.MINIO_PORT}} | |
# Build and start container | |
- name: Build and Start Container | |
run: docker-compose up -d | |
# java 설치 | |
- name: Set up JDK 17 | |
uses: actions/[email protected] | |
with: | |
java-version: '17' | |
distribution: 'liberica' | |
# 환경 변수 적용 | |
- name: Configure application.yaml under test directory | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: ./src/test/resources/application.yaml | |
env: | |
spring.datasource.username: ${{secrets.TEST_MYSQL_USERNAME}} | |
spring.datasource.password: ${{secrets.TEST_MYSQL_PASSWORD}} | |
spring.datasource.url: ${{secrets.TEST_MYSQL_URL}} | |
minio.url: ${{secrets.MINIO_URL}} | |
minio.bucket: ${{secrets.MINIO_BUCKET}} | |
minio.access-key: ${{secrets.MINIO_USER}} | |
minio.secret-key: ${{secrets.MINIO_PASSWORD}} | |
jwt.issuer: ${{secrets.TOKEN_ISSUER}} | |
jwt.base64-secret: ${{secrets.TOKEN_SECRET}} | |
jwt.token-validity-in-seconds: ${{secrets.TOKEN_EXPIRATION}} | |
openfeign.forecast.service-key: ${{secrets.FORECAST_SERVICE_KEY}} | |
openfeign.forecast.url: ${{secrets.FORECAST_URL}} | |
# gradle 권한 추가 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
# 프로젝트 빌드 | |
- name: Build with Gradle | |
run: ./gradlew clean build | |
# Jacoco 테스트 결과 추가 | |
- name: Comment Jacoco test report | |
id: jacoco | |
uses: madrapps/[email protected] | |
with: | |
title: 📑 Jacoco 테스트 결과 | |
paths: ${{github.workspace}}/**/build/reports/jacoco/test/jacocoTestReport.xml | |
token: ${{secrets.GITHUB_TOKEN}} | |
min-coverage-overall: 70 | |
min-coverage-changed-files: 70 |