Skip to content

Commit 16848a5

Browse files
committed
Add sonar to project for quality checks
1 parent b697249 commit 16848a5

File tree

6 files changed

+272
-19
lines changed

6 files changed

+272
-19
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ name: CI
22

33
on:
44
push:
5-
branches-ignore:
6-
- "github-pages/*"
7-
- "gh-pages/*"
8-
- "main"
9-
- "master"
5+
branches:
6+
- main
7+
- master
8+
pull_request:
9+
types: [opened, synchronize, reopened]
1010
schedule:
1111
# “At 00:00 on every 7th day-of-month from 1 through 31.” (https://crontab.guru)
1212
- cron: "0 0 1/7 * *"
1313

14+
1415
jobs:
1516

1617
CI:
@@ -22,5 +23,6 @@ jobs:
2223
Metrics:
2324
needs: [ CI ]
2425
uses: ./.github/workflows/report.yml
26+
secrets: inherit
2527
permissions:
2628
contents: read

.github/workflows/report.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Copy Artifacts into Root Folder
3030
working-directory: ./artifacts
3131
run: |
32-
poetry run -- coverage combine --keep coverage-python3.9*/.coverage
32+
poetry run -- coverage combine --keep coverage-python*/.coverage
3333
# Errors during copying are ignored because they are checked in the next step
3434
cp .coverage ../ || true
3535
cp lint-python3.9/.lint.txt ../ || true
@@ -42,6 +42,18 @@ jobs:
4242
- name: Generate Report
4343
run: poetry run -- nox -s project:report -- --format json | tee metrics.json
4444

45+
- name: Prepare files for sonar
46+
run: |
47+
poetry run -- coverage xml -o ci-coverage.xml --include="exasol/toolbox/*"
48+
49+
- name: Upload to sonar
50+
run: |
51+
poetry run -- pysonar --sonar-token ${{ secrets.SONAR_TOKEN }} \
52+
--sonar-branch-name ${{ github.ref_name }} \
53+
--sonar-python-coverage-report-paths ci-coverage.xml \
54+
--sonar-python-pylint-report-path .lint.json \
55+
--sonar-python-mypy-report-paths .security.json
56+
4557
- name: Upload Artifacts
4658
uses: actions/[email protected]
4759
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ odbcconfig/odbcinst.ini
77
.html-documentation
88

99
.coverage
10+
.sonar
1011

1112
_build/
1213

0 commit comments

Comments
 (0)