From 64653a91dac999c10fc89af6385cd6c3c15c0e2c Mon Sep 17 00:00:00 2001 From: GSRN Date: Wed, 17 Sep 2025 00:51:25 +0200 Subject: [PATCH] chore: Simplify CI workflow for api-gateway by removing redundant test checks ### Summary of Changes - Removed checks for the existence of test files and test reports in the CI workflow for `api-gateway.yml`, streamlining the process. - Updated the workflow to focus on running unit tests and sending results to SonarQube without pre-checks. ### Expected Results - Enhanced efficiency of the CI process by eliminating unnecessary steps, allowing for quicker feedback on code changes. --- .gitea/workflows/api-gateway.yml | 69 -------------------------------- 1 file changed, 69 deletions(-) diff --git a/.gitea/workflows/api-gateway.yml b/.gitea/workflows/api-gateway.yml index bddea11..dbee06e 100644 --- a/.gitea/workflows/api-gateway.yml +++ b/.gitea/workflows/api-gateway.yml @@ -85,33 +85,6 @@ jobs: - name: Compile code run: ./mvnw compile - - name: Check for test files - run: | - echo "Checking for test files in src/test/java/..." - if [ -d "src/test/java" ]; then - TEST_COUNT=$(find src/test/java -name "*Test*.java" -type f | wc -l) - echo "Found $TEST_COUNT test files" - if [ $TEST_COUNT -eq 0 ]; then - echo "⚠️ No test files found! Please add test files to src/test/java/" - echo "TEST_FILES_EXIST=false" >> $GITHUB_ENV - else - echo "✅ Test files found" - echo "TEST_FILES_EXIST=true" >> $GITHUB_ENV - fi - else - echo "❌ No src/test/java directory found!" - echo "TEST_FILES_EXIST=false" >> $GITHUB_ENV - fi - - - name: Fail if no test files exist - if: env.TEST_FILES_EXIST == 'false' - run: | - echo "❌ No test files found in src/test/java/" - echo "This pipeline requires test files to be present." - echo "Please add test files with names ending in 'Test.java' or 'Tests.java'" - echo "Example: src/test/java/com/labfusion/MyServiceTest.java" - exit 1 - - name: Run unit tests run: | echo "Running Maven tests..." @@ -129,24 +102,6 @@ jobs: mkdir -p target/surefire-reports fi - - name: Check test reports - run: | - echo "Checking for test report files..." - if [ -d "target/surefire-reports" ]; then - echo "Surefire reports directory exists" - ls -la target/surefire-reports/ - if [ -n "$(find target/surefire-reports -name '*.xml' -type f)" ]; then - echo "✅ Found test report XML files" - echo "TEST_REPORTS_EXIST=true" >> $GITHUB_ENV - else - echo "⚠️ No XML files found in surefire-reports" - echo "TEST_REPORTS_EXIST=false" >> $GITHUB_ENV - fi - else - echo "❌ Surefire reports directory does not exist" - echo "TEST_REPORTS_EXIST=false" >> $GITHUB_ENV - fi - - name: Send test results to SonarQube if: env.TEST_REPORTS_EXIST == 'true' run: | @@ -158,30 +113,6 @@ jobs: -Dsonar.token="${{ secrets.SONAR_TOKEN }}" \ -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml \ -Dsonar.junit.reportPaths=target/surefire-reports - - - name: Fail if no test reports found - if: env.TEST_REPORTS_EXIST == 'false' - run: | - echo "❌ No test reports were generated!" - echo "This indicates that either:" - echo "1. No test files were found in src/test/java/" - echo "2. Tests failed to execute properly" - echo "3. Maven Surefire plugin did not generate reports" - echo "" - echo "Please ensure you have test files and they are executing correctly." - exit 1 - - - name: Run code quality checks - run: | - ./mvnw spotbugs:check - ./mvnw checkstyle:check - ./mvnw pmd:check - - - name: Generate code coverage - run: | - echo "Generating JaCoCo code coverage report..." - ./mvnw jacoco:report - echo "Code coverage report generated at target/site/jacoco/jacoco.xml" build: runs-on: [self-hosted]