Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[run]
relative_files = true
source =
genesis/
omit = tests/*
Expand Down
43 changes: 41 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,47 @@ jobs:
- name: Run Type Checker (Mypy)
run: poetry run mypy

- name: Run tests
run: poetry run py.test
- name: Run tests (with coverage)
run: poetry run pytest --cov=genesis --cov-report=xml:coverage.xml --cov-report=term

- name: Upload coverage report
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: coverage.xml
if-no-files-found: warn
retention-days: 3

# SonarCloud analysis. Fails the job if the quality gate fails.
sonar:
name: SonarCloud
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
needs: [check-commit, test]
if: |
needs.check-commit.outputs.should-run == 'true' &&
(github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-xml

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.qualitygate.wait=true

# Version bump (only runs on push to main, not on PRs)
# Runs after contributors to avoid infinite loops
Expand Down
17 changes: 17 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sonar.projectKey=Genesis
sonar.organization=otoru
sonar.projectName=Genesis

# Source + tests
sonar.sources=genesis
sonar.tests=tests,examples
sonar.test.inclusions=tests/**/*.py,examples/**/*.py

# Python
sonar.python.version=3.12
sonar.sourceEncoding=UTF-8
sonar.python.coverage.reportPaths=coverage.xml

# Exclude non-source paths from analysis/coverage
sonar.exclusions=**/__pycache__/**,**/*.pyc,tests/**,examples/**,docs/**,scripts/**,docker/**,freeswitch/**,.github/**
sonar.coverage.exclusions=tests/**,examples/**,docs/**,scripts/**,docker/**,freeswitch/**,genesis/cli/**
Loading