diff --git a/.github/workflows/gcp.yml b/.github/workflows/gcp.yml index b28c25c..a1a0cac 100644 --- a/.github/workflows/gcp.yml +++ b/.github/workflows/gcp.yml @@ -21,7 +21,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - # Setup for Java projects + # Set up JDK for Java projects - name: Set up JDK 21 uses: actions/setup-java@v4 with: @@ -29,13 +29,13 @@ jobs: distribution: 'temurin' cache: maven - # Setup for Angular projects + # Set up Node.js for Angular projects - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '21' - # Build Java services + # Build Java and Angular projects - name: Build Projects run: | SERVICE_NAMES=$(cat projects-changes-deploy.txt) @@ -45,9 +45,9 @@ jobs: if [ -d "$SERVICE_NAME" ]; then cd $SERVICE_NAME if [ "$SERVICE_NAME" == "blogs-analyzer-ui" ]; then - npm install + npm install && npm test && npm install -g sonarqube-scanner && npm run sonar else - mvn clean install -B -V + mvn clean install -Psonar -B -V fi cd .. fi @@ -122,62 +122,3 @@ jobs: cd ../.. fi done - - sonarcloud: - name: SonarCloud Analysis - runs-on: ubuntu-latest - needs: build - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Setup for Java projects - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'temurin' - cache: maven - - # Setup for Node.js - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: '21' - - # Sonar Analysis for Java projects - - name: Sonar Analysis for Java projects - run: | - SERVICE_NAMES=$(cat projects-changes-deploy.txt) - echo "Service Names: $SERVICE_NAMES" - for SERVICE_NAME in $(echo $SERVICE_NAMES | tr ',' ' '); do - echo "Processing Service: $SERVICE_NAME" - if [ -d "$SERVICE_NAME" ]; then - cd $SERVICE_NAME - if [ "$SERVICE_NAME" != "blogs-analyzer-ui" ]; then - mvn clean verify sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=nashtech -Dsonar.branch.name=master - fi - cd .. - fi - done - - # Sonar Analysis for Angular projects - - name: Sonar Analysis for Angular projects - run: | - SERVICE_NAMES=$(cat projects-changes-deploy.txt) - echo "Service Names: $SERVICE_NAMES" - for SERVICE_NAME in $(echo $SERVICE_NAMES | tr ',' ' '); do - echo "Processing Service: $SERVICE_NAME" - if [ -d "$SERVICE_NAME" ]; then - cd $SERVICE_NAME - if [ "$SERVICE_NAME" == "blogs-analyzer-ui" ]; then - npm install - npm test - npm install -g sonarqube-scanner - npm run sonar - fi - cd .. - fi - done