fix(ci): improve SonarCloud configuration and optimize the installati… #31
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: Monorepo Test & SonarCloud | |
| on: | |
| push: | |
| branches: [ main, Development ] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| jobs: | |
| sonarcloud: | |
| name: Unified Coverage + SonarCloud | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.13'] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install global test dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-cov coverage | |
| - name: Install service dependencies | |
| run: | | |
| for service in Auth Projects Notifications Documents ExternalTools Gateway; do | |
| if [ -f "${service}-service/requirements.txt" ]; then | |
| pip install -r "${service}-service/requirements.txt" | |
| fi | |
| done | |
| - name: Run all tests with coverage | |
| run: | | |
| pytest \ | |
| --cov=auth-service \ | |
| --cov=project-service \ | |
| --cov=notification-service \ | |
| --cov=documents-service \ | |
| --cov=externaltools-service \ | |
| --cov=gateway \ | |
| --cov-report=xml \ | |
| */tests | |
| - name: SonarCloud Analysis | |
| uses: SonarSource/sonarcloud-github-action@v2 | |
| with: | |
| projectBaseDir: . | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |