diff --git a/.gitea/workflows/sonarqube.yml b/.gitea/workflows/sonarqube.yml new file mode 100644 index 0000000..48182e1 --- /dev/null +++ b/.gitea/workflows/sonarqube.yml @@ -0,0 +1,41 @@ +name: SonarQube Analysis + +on: + schedule: + - cron: '0 3 * * *' + workflow_dispatch: + +jobs: + sonarqube: + runs-on: ubuntu-latest + container: + image: node:22-bookworm-slim + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install dependencies + run: npm ci + + - name: Run tests with coverage + run: npx vitest run --exclude 'e2e/**' --coverage --coverage.reporter=lcov + + - name: Install SonarQube scanner + run: npm install -g sonarqube-scanner + + - name: Run SonarQube analysis + env: + SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + sonar-scanner \ + -Dsonar.host.url="$SONAR_HOST_URL" \ + -Dsonar.token="$SONAR_TOKEN" \ + -Dsonar.projectKey=cameleer-design-system \ + -Dsonar.projectName="Cameleer Design System" \ + -Dsonar.sources=src/design-system \ + -Dsonar.tests=src/design-system \ + -Dsonar.test.inclusions="**/*.test.tsx,**/*.test.ts" \ + -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info \ + -Dsonar.exclusions="**/node_modules/**,**/dist/**"