Repository navigation
잘못된 형태의 요청이 500+Slack/Sentry 알림으로 새던 문제 수정 #72
Workflow file for this run
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: RUNNECT PROD CI | |
| on: | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| # 테스트(contextLoads 등)는 실제 prod DB/Redis가 아니라 CI 안에서 띄우는 | |
| # 임시 컨테이너를 바라보게 한다 (원격 prod 환경에 직접 의존하지 않도록). | |
| # Course.path가 PostGIS geometry 컬럼이라 순정 postgres 이미지로는 그 컬럼이 있는 | |
| # 테이블(course) 생성 자체가 실패한다(Hibernate가 ddl-auto 실패를 조용히 무시해서 | |
| # 지금까지 드러나지 않았을 뿐, course 테이블이 CI에 존재한 적이 없었다 — 실제 Course row가 | |
| # 필요 없던 테스트만 우연히 계속 통과해온 것). prod/staging과 동일하게 PostGIS가 포함된 | |
| # 이미지를 써서 CI가 실제 환경과 같은 스키마로 검증하도록 한다. | |
| services: | |
| postgres: | |
| image: postgis/postgis:15-3.4 | |
| env: | |
| POSTGRES_DB: runnect | |
| POSTGRES_USER: runnect | |
| POSTGRES_PASSWORD: runnect_local_password | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:7 | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: make application.properties 파일 생성 | |
| run: | | |
| ## create application.yml | |
| mkdir -p ./src/main/resources | |
| cd ./src/main/resources | |
| # application.yml 파일 생성 | |
| touch ./application.yml | |
| # GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기 | |
| echo "${{ secrets.RUNNECT_PROD_APPLICATION }}" >> ./application.yml | |
| # application.yml 파일 확인 | |
| cat ./application.yml | |
| shell: bash | |
| # 이 워크플로우는 gradle build | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| env: | |
| SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/runnect | |
| SPRING_DATASOURCE_USERNAME: runnect | |
| SPRING_DATASOURCE_PASSWORD: runnect_local_password | |
| SPRING_DATA_REDIS_HOST: localhost | |
| # PR에서 새로 추가/수정된 라인만 커버리지를 검사한다 (전체 커버리지 게이트가 아님). | |
| # 로직이 바뀌었는데 테스트가 안 따라오는 경우를 CI에서 기계적으로 잡기 위함. | |
| - name: Diff coverage 게이트 (변경된 라인 기준) | |
| run: | | |
| pip install diff-cover | |
| diff-cover build/reports/jacoco/test/jacocoTestReport.xml \ | |
| --compare-branch=origin/${{ github.base_ref }} \ | |
| --fail-under=70 |