diff --git a/.github/workflows/angular-sonar-build.yml b/.github/workflows/angular-sonar-build.yml new file mode 100644 index 00000000000..66c2c21218f --- /dev/null +++ b/.github/workflows/angular-sonar-build.yml @@ -0,0 +1,35 @@ +name: Build +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * 3' + +jobs: + sonarqube: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./matchbox-frontend + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: matchbox-frontend/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Test the build + run: npm run build + + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/java-sonar-build.yml b/.github/workflows/java-sonar-build.yml index b430e418307..db33c77382f 100644 --- a/.github/workflows/java-sonar-build.yml +++ b/.github/workflows/java-sonar-build.yml @@ -33,15 +33,17 @@ jobs: key: ${{ runner.os }}-m2 restore-keys: ${{ runner.os }}-m2 - name: Build and analyze + continue-on-error: true env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | - cd matchbox-engine - mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=AccessDigitalHealth_cicd-jira-automation - - name: Build and analyze - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: | - cd matchbox-server - mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=AccessDigitalHealth_cicd-jira-automation - + export MAVEN_OPTS="$MAVEN_OPTS -Dorg.slf4j.simpleLogger.defaultLogLevel=error" + mvn -B --no-transfer-progress -q verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=AccessDigitalHealth_matchbox -l build.log + # Log is too large and so we are creating a log file and uploading it. + # this is why we need continue on error on the step above. + - name: Upload build log + uses: actions/upload-artifact@v4 + with: + name: build-log + path: build.log + diff --git a/matchbox-frontend/sonar-project.properties b/matchbox-frontend/sonar-project.properties new file mode 100644 index 00000000000..1dd0d87737d --- /dev/null +++ b/matchbox-frontend/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.projectKey=accessdigitalhealth_matchbox_frontend +sonar.organization=accessdigitalhealth +sonar.projectName=matchbox angular frontend +sonar.host.url=https://sonarcloud.io +sonar.sources=. +sonar.sourceEncoding=UTF-8 +sonar.exclusions=**/node_modules/**,**/*.spec.ts,src/environments/** +