Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: 개발환경 통일 #113

Merged
merged 11 commits into from
Aug 21, 2024
51 changes: 48 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
name: unit test on push
name: test on push
on: [ pull_request ]

jobs:
deploy:
name: unit test
name: test
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0.32
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ticketing
options: >-
--health-cmd "mysqladmin ping -u root -proot"
--health-interval 10s
--health-timeout 5s
--health-retries 5

redis:
image: redis:7.0.11
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: checkout
uses: actions/checkout@v3
Expand All @@ -18,7 +42,28 @@ jobs:
distribution: 'temurin'
java-version: '17'

- name: Set /etc/hosts for MySQL and Redis
run: |
echo "127.0.0.1 mysql" | sudo tee -a /etc/hosts
echo "127.0.0.1 redis" | sudo tee -a /etc/hosts

- name: Wait for MySQL to be ready
run: |
until mysqladmin ping -h mysql -u root -proot --silent; do
echo 'waiting for mysql...'
sleep 5
done

- name: Wait for Redis to be ready
run: |
until nc -zv redis 6379; do
echo 'waiting for redis...'
sleep 5
done


- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew --info test
./gradlew copyYml
./gradlew test
2 changes: 1 addition & 1 deletion backend-config
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'io.micrometer:micrometer-registry-prometheus'

// Redisson
implementation 'org.redisson:redisson-spring-boot-starter:3.17.6'
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/version: '3.8'
version: '3.8'
services:
mysql:
image: mysql:8.0.32
hostname: mysql
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: demo
MYSQL_DATABASE: ticketing
ports:
- "3306:3306"
restart: always
Expand Down
10 changes: 10 additions & 0 deletions scripts/local-end.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# 현재 스크립트의 디렉토리로 이동
cd "$(dirname "$0")"

# Docker Compose 파일이 있는 디렉토리로 이동
cd ../docker

# Docker Compose를 사용하여 서비스 종료
docker-compose -f docker-compose.yml down
Loading