Skip to content

Commit 4df62e9

Browse files
committed
Pass project version to sonar
1 parent 56820bf commit 4df62e9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- name: Install dependencies
3131
run: |
32-
pip install -e ".[tests]"
32+
pip install -e ".[tests]" setuptools_scm
3333
3434
- name: Tests
3535
run: pytest --cov --cov-report=xml
@@ -47,6 +47,7 @@ jobs:
4747
echo "SOURCE_REPOSITORY=${SOURCE_REPOSITORY}" >> sonar_env
4848
echo "SOURCE_BRANCH=${SOURCE_BRANCH}" >> sonar_env
4949
echo "TARGET_BRANCH=${TARGET_BRANCH}" >> sonar_env
50+
echo "PROJECT_VERSION=$(python -m setuptools_scm)" >> sonar_env
5051
cat sonar_env
5152
5253
# upload coverage report for sonar workflow

.github/workflows/sonar.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ jobs:
9090
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9191
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
9292
SONAR_HOST_URL: https://sonar-ctao.zeuthen.desy.de
93+
with:
94+
args: >
95+
-Dsonar.projectVersion=${{ env.PROJECT_VERSION }}
9396
9497
- name: Sonarqube Scan PR
9598
if: github.event.workflow_run.event == 'pull_request'
@@ -100,6 +103,7 @@ jobs:
100103
SONAR_HOST_URL: https://sonar-ctao.zeuthen.desy.de
101104
with:
102105
args: >
106+
-Dsonar.projectVersion=${{ env.PROJECT_VERSION }}
103107
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
104108
-Dsonar.pullrequest.key=${{ env.PR_NUMBER }}
105109
-Dsonar.pullrequest.branch=${{ env.SOURCE_BRANCH }}

0 commit comments

Comments
 (0)