Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish coverage to sonarcloud
Browse files Browse the repository at this point in the history
jcoelho93 committed Jun 9, 2024
1 parent f277dea commit cf2473e
Showing 7 changed files with 176 additions and 2 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Python tests

on:
- push
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
@@ -28,3 +32,23 @@ jobs:
with:
name: coverage
path: coverage.xml
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.12"
- name: Install tox and other packages
run: pip install tox
- name: Run tox
run: tox -e py
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,3 +5,4 @@ __pycache__
.coverage
.pytest_cache
dist/
coverage.xml
131 changes: 130 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ pyyaml = "^6.0.1"
[tool.poetry.group.dev.dependencies]
pytest = "^8.2.2"
coverage = "^7.5.3"
tox = "^4.15.1"

[build-system]
requires = ["poetry-core"]
6 changes: 6 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sonar.projectKey=jcoelho93_steer
sonar.organization=jcoelho93
sonar.sources=steer

sonar.python.version=3.12
sonar.python.coverage.reportPaths=coverage.xml
Empty file added tests/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tox]
envlist = py312
skipdist = True

[testenv]
deps =
pytest
pytest-cov
commands = pytest --cov=steer --cov-report=xml --cov-config=tox.ini --cov-branch

[coverage:run]
omit =
__init__.py

0 comments on commit cf2473e

Please sign in to comment.