fix(sonar): Fix test path overlap causing double indexing #41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SonarCloud Analysis | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| sonarcloud: | |
| name: SonarCloud | |
| runs-on: ubuntu-latest | |
| steps: | |
| - 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: | | |
| backend/package-lock.json | |
| frontend/package-lock.json | |
| - name: Install Backend Dependencies | |
| working-directory: ./backend | |
| run: npm ci | |
| continue-on-error: true | |
| - name: Install Frontend Dependencies | |
| working-directory: ./frontend | |
| run: npm ci | |
| continue-on-error: true | |
| - name: Run Backend Tests with Coverage | |
| working-directory: ./backend | |
| run: npm run test:coverage || echo "Backend tests completed" | |
| env: | |
| NODE_ENV: test | |
| MONGODB_URI: mongodb://localhost:27017/notes-app-test | |
| JWT_SECRET: test-jwt-secret-for-ci | |
| continue-on-error: true | |
| - name: Run Frontend Tests with Coverage | |
| working-directory: ./frontend | |
| run: npm run test:coverage || echo "Frontend tests completed" | |
| continue-on-error: true | |
| - name: SonarQube Scan | |
| uses: SonarSource/sonarqube-scan-action@v6 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |