Skip to content

Commit a3bcaa3

Browse files
committed
fix(ci): improve SonarCloud configuration and optimize the installation of dependencies
1 parent 813febf commit a3bcaa3

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

.github/workflows/sonar.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,52 @@ name: Monorepo Test & SonarCloud
22

33
on:
44
push:
5-
branches: [ main , Development ]
5+
branches: [ main, Development ]
6+
paths-ignore:
7+
- '**.md'
8+
- 'docs/**'
69
pull_request:
710
types: [opened, synchronize, reopened]
11+
paths-ignore:
12+
- '**.md'
13+
- 'docs/**'
814

915
jobs:
1016
sonarcloud:
1117
name: Unified Coverage + SonarCloud
1218
runs-on: ubuntu-latest
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
python-version: ['3.13']
1324

1425
steps:
1526
- name: Checkout
1627
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
1730

18-
- name: Setup Python
31+
- name: Setup Python ${{ matrix.python-version }}
1932
uses: actions/setup-python@v4
2033
with:
21-
python-version: '3.13'
34+
python-version: ${{ matrix.python-version }}
35+
cache: 'pip'
2236

23-
- name: Install global test deps
37+
- name: Install global test dependencies
2438
run: |
2539
python -m pip install --upgrade pip
26-
pip install pytest pytest-cov
40+
pip install pytest pytest-cov coverage
2741
2842
- name: Install service dependencies
2943
run: |
30-
pip install -r Auth-service/requirements.txt
31-
pip install -r Projects-service/requirements.txt
32-
pip install -r Notifications-service/requirements.txt
33-
pip install -r Documents-service/requirements.txt
34-
pip install -r ExternalTools-service/requirements.txt
35-
pip install -r Gateway/requirements.txt
36-
37-
- name: Run all tests with per-service coverage
44+
for service in Auth Projects Notifications Documents ExternalTools Gateway; do
45+
if [ -f "${service}-service/requirements.txt" ]; then
46+
pip install -r "${service}-service/requirements.txt"
47+
fi
48+
done
49+
50+
- name: Run all tests with coverage
3851
run: |
3952
pytest \
4053
--cov=auth-service \
@@ -44,11 +57,12 @@ jobs:
4457
--cov=externaltools-service \
4558
--cov=gateway \
4659
--cov-report=xml \
47-
auth-service/tests project-service/tests notification-service/tests documents-service/tests externaltools-service/tests gateway/tests
60+
*/tests
4861
4962
- name: SonarCloud Analysis
5063
uses: SonarSource/sonarcloud-github-action@v2
5164
with:
5265
projectBaseDir: .
5366
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5468
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)