Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
ci(cov): upload coverage data to sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschutt committed Nov 18, 2022
1 parent 2489d53 commit 145adf9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,14 @@ jobs:
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # @v3.0.1
with:
name: covdata
- name: Fail if it's <100%.
- name: Report coverage
run: |
python -m tox -e coverage
- name: Upload HTML report if check failed.
- name: Upload XML report for sonar.
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # @v3.1.1
with:
name: html-report
path: htmlcov
if: ${{failure()}}
name: xml-report
path: coverage.xml
codeql:
name: CodeQL
runs-on: ubuntu-latest
Expand Down Expand Up @@ -190,6 +189,7 @@ jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
needs: coverage
steps:
- name: Harden Runner
uses: step-security/harden-runner@2e205a28d0e1da00c5f53b161f4067b052c61f34 # @v1.5.0
Expand All @@ -198,6 +198,10 @@ jobs:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0
with:
fetch-depth: 0
- name: Download coverage report
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # @v3.0.1
with:
name: xml-report
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@156db6fef3e168e4972abb76de0b32bbce8ec77a # @v1.7
env:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ site/
*.env*
!.env.example
!tests.env
coverage.json
coverage.*
.coverage
.coverage.*
.dmypy.json
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ ignore-words-list = "alog"

[tool.coverage.run]
branch = true
source_pkgs = ["starlite_saqlalchemy"]
omit = ["*/starlite_saqlalchemy/scripts.py", "tests/*"]
relative_files = true
source_pkgs = ["starlite_saqlalchemy"]

[tool.coverage.paths]
source = ["src", "*/site-packages"]
Expand Down
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ sonar.sources=src
sonar.sourceEncoding=UTF-8
sonar.cpd.exclusions=alembic/**/*
sonar.python.version=3.11
sonar.python.coverage.reportPaths=coverage.xml
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ depends = py310,py311
basepython = python3.11
commands =
coverage combine
coverage report -m --skip-covered --fail-under=100
coverage html
coverage json
coverage report -m --skip-covered
coverage xml
parallel_show_output = true

[testenv:refurb]
Expand Down

0 comments on commit 145adf9

Please sign in to comment.