diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 303eaf4..fb371af 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 0 # To ensure non-shallow git clones for sonar - - name: Set up Python ${{ matrix.python-version }} + - name: Set up python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} @@ -29,13 +29,13 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[dev] + pip install -e .[dev] - name: Run pytest run: | - pytest --cov=objdictgen --cov-report=xml --cov-branch -p no:logging --tb=no + pytest --cov --cov-report=xml --cov-report=term --tb=line - - name: SonarCloud Scan + - name: Sonar scan uses: SonarSource/sonarqube-scan-action@v6.0.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -60,7 +60,7 @@ jobs: - name: Run mypy run: | - mypy src/objdictgen + mypy src continue-on-error: true diff --git a/pyproject.toml b/pyproject.toml index b9a1d1a..42d6dc8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,6 +69,14 @@ testpaths = [ ] filterwarnings = "ignore::DeprecationWarning" +# Configuration for coverage.py which is used by pytest-cov and SonarQube +[tool.coverage.run] +relative_files = true +branch = true +source = [ + "src/objdictgen", +] + [tool.ruff] line-length = 120 exclude = [ diff --git a/sonar-project.properties b/sonar-project.properties index 56a2cd5..469b06c 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,4 +2,5 @@ sonar.projectKey=Laerdal_python-objdictgen sonar.organization=laerdal-foss sonar.python.coverage.reportPaths=coverage.xml sonar.exclusions = packaging +sonar.sources = src sonar.tests = tests