diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8dda349..e53ee94 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,6 +17,46 @@ jobs: deploy: runs-on: ubuntu-latest environment: backend_env + services: + mysql: + image: mysql:8.4 + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: amumal_test + MYSQL_USER: testuser + MYSQL_PASSWORD: testpass + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot" + --health-interval=10s + --health-timeout=5s + --health-retries=10 + redis: + image: redis:7-alpine + ports: + - 6379:6379 + options: >- + --health-cmd="redis-cli ping" + --health-interval=10s + --health-timeout=5s + --health-retries=10 + env: + DB_HOST: 127.0.0.1 + DB_NAME: amumal_test + DB_USERNAME: testuser + DB_PASSWORD: testpass + DDL_AUTO_SET: create-drop + MAX_FILE_SIZE: 10MB + MAX_REQUEST_SIZE: 10MB + AWS_ACCESS_KEY: test-access-key + AWS_SECRET_KEY: test-secret-key + AWS_REGION: ap-northeast-2 + AWS_S3_BUCKET: test-bucket + JWT_SECRET: c2VjcmV0a2V5c2VjcmV0a2V5c2VjcmV0a2V5c2VjcmV0a2V5 + SERVER_URL: http://localhost + REDIS_HOST: 127.0.0.1 + REDIS_PORT: 6379 steps: - uses: actions/checkout@v4 @@ -34,6 +74,15 @@ jobs: distribution: 'temurin' java-version: '26' cache: 'gradle' + + - name: 외부 서비스 연결 확인 (MySQL, Redis) + shell: bash + run: | + echo > /dev/tcp/127.0.0.1/3306 + echo "MySQL 연결 확인 완료" + echo > /dev/tcp/127.0.0.1/6379 + echo "Redis 연결 확인 완료" + - name: 테스트 run: ./gradlew integrationTest --no-daemon diff --git a/deploy.sh b/deploy.sh index 9b6d663..84dbac5 100644 --- a/deploy.sh +++ b/deploy.sh @@ -151,4 +151,4 @@ echo "$NEW_ENV_PATH" > "$(color_env_file "$TARGET_COLOR")" echo "$NEW_TAG" > "$CURRENT_TAG_FILE" echo "$NEW_ENV_PATH" > "$CURRENT_ENV_FILE" -echo "블루-그린 배포 성공: $TARGET_COLOR -> $NEW_TAG" +echo "블루-그린 배포 성공: $TARGET_COLOR -> $NEW_TAG" \ No newline at end of file