๐ฅ fix : ์ด๋ฏธ์ง ๊ด๋ จ ๊ถํ ๋ฌธ์ ์์ #151
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
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
| name: SEEAT ํ ์คํธ CI ํ์ดํ๋ผ์ธ | |
| ### develop์ผ๋ก PR ์ฌ๋ฆด ๋, ํ ์คํธ ์ฝ๋๋ฅผ ์คํํ์ฌ, ๋น๋ ์ฌ๋ถ ๋ฐ ํ ์คํธ๋ฅผ ์ฒดํฌํ๋ ๋ก์ง์ ์ํํ๋ค. | |
| on: | |
| pull_request: | |
| branches: [ "develop"] | |
| jobs: | |
| #1. ํตํฉ ํ ์คํธ ์ฉ | |
| test: | |
| runs-on: ubuntu-22.04 | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| ports: | |
| - '3306:3306' | |
| env: | |
| MYSQL_DATABASE: seeat_test | |
| MYSQL_USER: testuser | |
| MYSQL_PASSWORD: testpass | |
| MYSQL_ROOT_PASSWORD: root | |
| redis: | |
| image: redis:7.2.5 | |
| ports: | |
| - '6379:6379' | |
| mongo: | |
| image: mongo:6.0 | |
| ports: | |
| - 27017:27017 | |
| permissions: | |
| contents: write | |
| checks: write | |
| pull-requests: write | |
| steps: | |
| # 1-1. repository checkout | |
| - uses: actions/checkout@v4 | |
| # 1-2. jdk ํ๊ฒฝ ์ค์น | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| # 1-3. '*.yml' ํ์ผ ์ธํ | |
| - name: application.yml ํ์ผ ์ค์ | |
| run: | | |
| mkdir -p src/main/resources | |
| echo "${{ secrets.APPLICATION_YML }}" > ./src/main/resources/application.yml | |
| - name: application-dev.yml ์ค์ | |
| run: echo "${{ secrets.APPLICATION_DEV_YML }}" > ./src/main/resources/application-dev.yml | |
| - name: application-oauth2.yml ์ค์ | |
| run: echo "${{ secrets.APPLICATION_OAUTH2_YML }}" > ./src/main/resources/application-oauth2.yml | |
| - name: application-test.yml ์ค์ | |
| run: | | |
| mkdir -p src/test/resources | |
| echo "${{ secrets.APPLICATION_TEST_YML }}" > ./src/test/resources/application-test.yml | |
| # 1-4. ์ฑ๋ฅ ํฅ์์ ์ํ Gradle ์บ์ฑ | |
| - name: Gradle Caching | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| gradle-${{ runner.os }} | |
| # 1-5. ํ ์คํธ ์ปจํ ์ด๋๋ค ์๋์ฌ๋ถ ์ฒดํฌ | |
| - name: MySQL ์ฒดํฌ | |
| run: | | |
| until nc -z localhost 3306; do | |
| echo "Waiting for MySQL..." | |
| sleep 3 | |
| done | |
| - name: Redis ์ฒดํฌ | |
| run: | | |
| until nc -z localhost 6379; do | |
| echo "Waiting for Redis..." | |
| sleep 3 | |
| done | |
| - name: MongoDB ์ฒดํฌ | |
| run: | | |
| until nc -z localhost 27017; do | |
| echo "Waiting for MongoDB..." | |
| sleep 3 | |
| done | |
| # 2. ๋น๋ | |
| - name: Build with Gradle Wrapper | |
| run: ./gradlew clean build | |
| # 3. ํ ์คํธ ์ปค๋ฒ๋ฆฌ์ง | |
| - name: Test Coverage Report | |
| id: jacoco | |
| uses: madrapps/[email protected] | |
| with: | |
| title: Test Coverage Report | |
| paths: ${{ github.workspace }}/build/jacoco/index.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| min-coverage-changed-files: 0 | |
| min-coverage-overall: 0 | |
| debug-mode: true | |
| # 4. JUnit ํ ์คํธ ๊ฒฐ๊ณผ ๊ฒ์ | |
| - name: Test ๊ฒฐ๊ณผ ์ถ๋ ฅ | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| if: always() | |
| with: | |
| junit_files: '**/build/test-results/test/TEST-*.xml' | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |