From 5322edc700f0ab24453f6426c54245e17cbe6f5d Mon Sep 17 00:00:00 2001 From: teetangh Date: Sat, 6 Sep 2025 21:56:56 +0530 Subject: [PATCH] Enhance GitHub Actions workflow for Java tests - Added a timeout of 15 minutes for the test job. - Implemented a fail-fast strategy in the job matrix. - Made the Maven wrapper executable before running tests. - Updated the test command to run only tests instead of a full build. - Added a step to upload test results with a retention period of 7 days. These changes improve the efficiency and clarity of the testing process. --- .github/workflows/tests.yaml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 0425b13..f32f0a2 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -13,19 +13,17 @@ jobs: run_tests: name: Run Tests runs-on: ubuntu-latest + timeout-minutes: 15 env: DB_CONN_STR: ${{ vars.DB_CONN_STR }} DB_USERNAME: ${{ vars.DB_USERNAME }} DB_PASSWORD: ${{ secrets.DB_PASSWORD }} strategy: + fail-fast: false matrix: java-version: ["17", "21"] steps: - - name: Update repositories - run: | - sudo apt update || echo "apt-update failed" # && apt -y upgrade - - - name: Checkout ${{ github.event.repository.name }} + - name: Checkout repository uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java-version }} @@ -35,11 +33,22 @@ jobs: distribution: "temurin" cache: "maven" + - name: Make Maven wrapper executable + run: chmod +x mvnw + - name: Run Maven Tests id: run - run: | - chmod +x mvnw - ./mvnw clean install -DskipTests=false -Dmaven.javadoc.skip=true -Dgpg.skip=true -B -V -e + run: ./mvnw clean test -B + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results-java-${{ matrix.java-version }} + path: | + target/surefire-reports/ + target/failsafe-reports/ + retention-days: 7 - name: Report Status if: always()