From 44f9ba7be825c36795744ead8a0e2cc7b856a5d7 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Mon, 17 Nov 2025 13:50:21 +0100 Subject: [PATCH] TA-4413: Add sonarcloud integration --- .github/workflows/sonarcloud-scan.yml | 36 +++++++++++++++++++++++++++ sonar-project.properties | 26 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/sonarcloud-scan.yml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonarcloud-scan.yml b/.github/workflows/sonarcloud-scan.yml new file mode 100644 index 00000000..86b46522 --- /dev/null +++ b/.github/workflows/sonarcloud-scan.yml @@ -0,0 +1,36 @@ +name: SonarCloud Scan + +on: + pull_request: + push: + branches: + - master + +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: yarn install + + - name: Build project + run: yarn build + + - name: Run tests and collect coverage + run: yarn test --coverage --coverageReporters=lcov + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..df536b58 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,26 @@ +# Project identification +sonar.projectKey=celonis_content-cli +sonar.organization=celonis +sonar.projectName=Content CLI + +# Source code location +sonar.sources=src + +# Test location +sonar.tests=tests + +# Encoding +sonar.sourceEncoding=UTF-8 + +# Coverage reporting (from Jest / ts-jest) +sonar.javascript.lcov.reportPaths=coverage/lcov.info + +# Exclusions (optional, adjust as needed) +# Ignore built files and configs +sonar.exclusions=dist/**, node_modules/**, coverage/**, **/*.test.ts + +# Test file inclusions +sonar.test.inclusions=**/*.test.ts, **/*.spec.ts + +# Report verbose output +sonar.verbose=true \ No newline at end of file