Files
sb-backend/.gitea/workflows/ci.yaml
T
sb 0082e647c2
Deploy / deploy (push) Successful in 49s
ci: setup-java 캐시 제거 — 'Save cache' 후처리 hang 회피
Gitea 캐시 서버 미연결 시 cache:gradle 저장 후처리가 수 분 hang → 가짜 실패 유발.

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

74 lines
2.2 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 제거: Gitea 캐시 서버 미연결 시 'Save cache' 후처리가 수 분 hang → '가짜 실패' 유발
# 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