Files
sb-backend/.gitea/workflows/ci.yaml
T
sb 9fdec36758
Deploy / deploy (push) Failing after 15m48s
fix(ci): SQL_INIT_MODE=always 추가 — 컨텍스트 테스트 스키마 초기화
@SpringBootTest(contextLoads) 시작 시 DefaultCategorySeeder 가 테이블을 조회하는데
CI 는 SQL_INIT_MODE 미설정(never)이라 스키마가 없어 BadSqlGrammarException 으로 실패했음.
운영과 동일하게 always 로 초기화 → 애플 로그인 커밋(a10e16c) 배포도 함께 통과.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 00:00:43 +09:00

74 lines
2.1 KiB
YAML

name: CI
on:
# main 은 Deploy(clean build=테스트 포함)가 게이트 역할을 하므로 CI 중복 실행 제외(배포 시간 단축).
push:
branches: [dev]
pull_request:
branches: [main, dev]
jobs:
build:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:11
env:
MARIADB_ROOT_PASSWORD: ci_root_pw
MARIADB_DATABASE: sb_db
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=15
redis:
image: redis:7
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=10
env:
DB_URL: jdbc:mariadb://mariadb:3306/sb_db?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Seoul
DB_USERNAME: root
DB_PASSWORD: ci_root_pw
REDIS_HOST: redis
REDIS_PORT: '6379'
# 컨텍스트 테스트(@SpringBootTest)가 스키마를 필요로 함(시작 시 기본분류 시더가 테이블 조회) → 운영과 동일하게 스키마 초기화
SQL_INIT_MODE: always
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
cache: gradle
# clean build 는 test 태스크를 포함 — 단위테스트 실패 시 빌드/배포 차단(게이트)
- name: Build & Test
run: |
chmod +x ./gradlew
./gradlew --no-daemon clean build
# 테스트 결과 리포트 — 성공/실패 무관하게 항상 업로드(실패 원인 확인용)
- name: Upload test report
if: always()
uses: actions/upload-artifact@v3
with:
name: test-report
path: build/reports/tests/test
retention-days: 7
- name: Upload jar
uses: actions/upload-artifact@v3
with:
name: app-jar
path: build/libs/*.jar
retention-days: 7