Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): change coverage scope #66

Merged
merged 8 commits into from
Jun 20, 2022
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
11 changes: 11 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[run]
branch=True
source = .

[paths]
source = .

[report]
omit = docs/*, tests/*

[xml]
16 changes: 12 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
name: Unit-tests
name: Unit-Tests
on:
push:
branches:
- main
# TODO: remove temporary credential
- feature/sonarcloud-action
pull_request:
branches:
- '*'

jobs:
build:
name: Run Unit-Tests
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
Expand All @@ -22,9 +24,15 @@ jobs:
run: pip install -r req.txt

- name: Run tests
run: pytest --cov=emnify --cov-report=xml --cov-branch
- name: SonarCloud Scan
run: pytest --cov=. --cov-report=xml
- name: Export SonarCloud Result
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: coverage.xml
2 changes: 2 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
sonar.projectKey=EMnify_emnify-sdk-python
sonar.organization=emnify
sonar.sources=emnify
sonar.tests=tests

sonar.python.coverage.reportPaths=coverage.xml