-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.64 KB
/
itcast-build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: ItcastBuildAndTests # 워크플로우 이름
on:
push:
branches:
- main # main 브랜치 push 트리거
- issue/**
pull_request:
branches:
- main
- issue/** # main, issue/** 대상으로의 PR 생성 트리거
jobs:
build:
runs-on: ubuntu-latest
steps:
# 코드 체크아웃
- name: Checkout code
uses: actions/checkout@v3
# Java 언어 설치
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
# Docker Compose 설치
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
# Docker Compose 실행
- name: Set up Docker Compose
run: |
docker-compose up -d
docker-compose ps
# 데이터베이스 작동까지 대기 5초단위로 재시도, 작동 후 10초 대기
- name: Wait for services to be ready
run: |
until docker-compose exec -T mysql mysqladmin ping -h"127.0.0.1" --silent; do
echo "Waiting for MySQL to be ready..."
sleep 5
done
sleep 10
# gradlew 실행 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
# 프로젝트 빌드
- name: Build with Gradle
run: ./gradlew clean build -Duser.language=ko -Duser.country=KR
# DockerCompose down (컨테이너 및 이미지 정리)
- name: Tear down Docker Compose
if: always() # CI 성공, 실패 여부와 관계없이 동작
run: docker-compose down