From 83994fa2e6b4d524d92d4c7bd8d6565e1be4ef2e Mon Sep 17 00:00:00 2001 From: hck2025 Date: Mon, 1 Dec 2025 02:16:13 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B8=B0=EC=A1=B4=20ci=20test=EC=97=90=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit build 여부만 확인했던 기존 워크플로우에 test 여부도 확인하도록 수정 및 확장 리포트 작성 로직 추가 --- .github/workflows/build-plus-test.yml | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/build-plus-test.yml diff --git a/.github/workflows/build-plus-test.yml b/.github/workflows/build-plus-test.yml new file mode 100644 index 0000000..51d1fa2 --- /dev/null +++ b/.github/workflows/build-plus-test.yml @@ -0,0 +1,63 @@ +name: Extended Java CI with Gradle # build only -> logic test like api call.. + +on: + push: + branches: ["main", "develop"] + pull_request: + branches: ["main", "develop"] + +permissions: + contents: read + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: "17" + distribution: "temurin" + + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Create GCP Key JSON + run: | + echo "${{ secrets.GCP_KEY_JSON }}" > ./gcp-key.json + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + + - name: Build and Test with Gradle + run: ./gradlew clean build # test 수행 + env: # test용 더미 환경변수 주입 + JWT_SECRET_KEY: "test-secret" + MAIL_USERNAME: "test@gmail.com" + MAIL_PASSWORD: "test" + DB_HOST: "localhost" + DB_NAME: "testdb" + DB_USERNAME: "sa" + DB_PASSWORD: "" + FOOD_SAFETY_KEY: "test" + GEMINI_API_KEY: "test" + GCP_PROJECT_ID: "test" + GCP_PROCESSOR_ID: "test" + GOOGLE_APPLICATION_CREDENTIALS: "./gcp-key.json" + + - name: Upload Test Report # 리포트 생성 + if: always() # 성공/실패 여부와 관계없이 실행 + uses: actions/upload-artifact@v4 + with: + name: test-report + path: build/reports/tests/test/