diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f150fd..989e52e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,33 @@ jobs: files: ./coverage/coverage-final.json fail_ci_if_error: false + sonarcloud: + name: SonarCloud Analysis + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for better analysis + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests with coverage + run: npm run test:coverage + + - name: SonarCloud Scan + uses: SonarSource/sonarqube-scan-action@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + build: name: Build runs-on: ubuntu-latest diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..3c0d0d9 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,24 @@ +sonar.projectKey=abdullahmujahidali_Cellify +sonar.organization=abdullahmujahidali +sonar.host.url=https://sonarcloud.io + +# Project information +sonar.projectName=Cellify +sonar.projectVersion=0.3.0 + +# Source code location +sonar.sources=src +sonar.tests=tests + +# Exclusions +sonar.exclusions=**/node_modules/**,**/dist/**,**/coverage/**,**/wasm/**,**/*.test.ts,**/*.spec.ts + +# Test exclusions from coverage +sonar.test.inclusions=**/*.test.ts,**/*.spec.ts + +# TypeScript/JavaScript settings +sonar.javascript.lcov.reportPaths=coverage/lcov.info +sonar.typescript.lcov.reportPaths=coverage/lcov.info + +# Encoding +sonar.sourceEncoding=UTF-8