feat : 서버 점검 상태 확인 API 및 필터를 통해 점검 시 API 호출 차단 로직 추가 #110
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Dev - CI (Build & Push) | |
| on: | |
| push: | |
| branches: ["dev"] | |
| pull_request: | |
| branches: ["dev"] | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| packages: write | |
| env: | |
| # CI에서 Testcontainers 안정성 확보(테스트 병렬 워커 제한) | |
| GRADLE_OPTS: "-Dorg.gradle.workers.max=1" | |
| jobs: | |
| test: | |
| name: Test (Gradle + Testcontainers) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| token: ${{ secrets.ACTION_TOKEN }} | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Add +x permission to gradlew | |
| run: chmod +x gradlew | |
| - name: Docker sanity check | |
| run: | | |
| docker version | |
| docker info | |
| # (선택) 이미지 미리 pull 해서 간헐적 네트워크 이슈/시간초과 감소 | |
| - name: Pre-pull docker images for tests | |
| run: | | |
| docker pull mysql:8.0 | |
| docker pull redis:7.0-alpine | |
| - name: Run tests | |
| env: | |
| DOCKER_HOST: unix:///var/run/docker.sock | |
| DOCKER_API_VERSION: 1.44 | |
| TESTCONTAINERS_RYUK_DISABLED: true | |
| run: ./gradlew clean test --no-daemon --info | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v5 | |
| if: success() || failure() | |
| with: | |
| report_paths: "**/build/test-results/test/TEST-*.xml" | |
| # 실패 시 원인 파악용 덤프(컨테이너 종료/로그 확인) | |
| - name: Dump docker state on failure | |
| if: failure() | |
| run: | | |
| echo "==== docker ps -a ====" | |
| docker ps -a | |
| echo "==== mysql logs (tail) ====" | |
| docker ps -a --format "{{.ID}} {{.Image}}" | grep mysql | awk '{print $1}' | xargs -r -n1 docker logs --tail=200 | |
| echo "==== redis logs (tail) ====" | |
| docker ps -a --format "{{.ID}} {{.Image}}" | grep redis | awk '{print $1}' | xargs -r -n1 docker logs --tail=200 | |
| docker: | |
| name: Docker Build & Push | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name != 'pull_request' | |
| outputs: | |
| image-tag: ${{ steps.meta.outputs.tags }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| token: ${{ secrets.ACTION_TOKEN }} | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Add +x permission to gradlew | |
| run: chmod +x gradlew | |
| # 테스트는 앞 job에서 끝났으니, 여기서는 jar만 생성(테스트 재실행 방지) | |
| - name: Build bootJar (skip tests) | |
| run: ./gradlew bootJar -x test --no-daemon | |
| - name: Setup QEMU (multi-arch) | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Github Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.ACTION_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=sha | |
| - name: Build and Push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Export Image Tag | |
| run: echo "${{ steps.meta.outputs.tags }}" > image_tag.txt | |
| - name: Upload Image Tag Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: image-tag | |
| path: image_tag.txt |