From 94b44b1013c2b9d58b14b3be49b9ca75e6c5a237 Mon Sep 17 00:00:00 2001 From: Doi Kim <154426332+d0ikim@users.noreply.github.com> Date: Sat, 4 Jul 2026 12:31:01 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B0=B1=EC=97=94=EB=93=9C=20CI?= =?UTF-8?q?=EC=97=90=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=9A=A9=20PostgreSQL?= =?UTF-8?q?=20=EC=84=9C=EB=B9=84=EC=8A=A4=EC=BB=A8=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=84=88=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index a45d784..b0f5204 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -29,6 +29,31 @@ jobs: # runs-on: 어디서 실행할 것인가? (ubuntu-latest = 리눅스 가상 서버) runs-on: ubuntu-latest + # services: 이 job이 실행되는 동안 함께 띄워줄 부가 컨테이너 + # application.yaml이 jdbc:postgresql://localhost:5432/... 로 DB에 접속하는데, + # 지금까지는 이 job에 PostgreSQL 자체가 없어서 @SpringBootTest(contextLoads)가 + # DB 연결에 실패해 빌드가 계속 실패했음 → 아래 postgres 컨테이너로 해결 + services: + postgres: + image: postgres:16 + # 아래 3개 값은 밑의 "Build and run tests with Gradle" 단계의 + # DB_DATABASE / DB_USER / DB_PASSWORD 환경변수와 반드시 같아야 함 + env: + POSTGRES_DB: dazz + POSTGRES_USER: dazz_admin + POSTGRES_PASSWORD: test_password + # ports: 컨테이너의 5432 포트를 러너(가상 서버)의 5432 포트로 그대로 열어줌 + # → job의 다른 step에서는 "localhost:5432"로 접속 가능해짐 + ports: + - 5432:5432 + # options: 컨테이너가 완전히 켜질 때까지 기다리는 헬스체크 + # (Postgres는 켜지는 데 몇 초 걸리므로, 준비 안 된 상태에서 바로 접속 시도하면 실패함) + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + # 작업이 실행할 단계들 (steps: 1단계, 2단계, ...) steps: # 1단계: 코드 다운로드