Skip to content
35 changes: 35 additions & 0 deletions .github/workflows/angular-sonar-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 3'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rationale for the scheduled scan ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have the trigger for the PR as well

pull_request:
    types: [opened, synchronize]


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 }}
20 changes: 11 additions & 9 deletions .github/workflows/java-sonar-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

8 changes: 8 additions & 0 deletions matchbox-frontend/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -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/**

Loading