Merge pull request #61 from thousandeyes/feature-add-test-coverage

feature: add test coverage verification on PRs
This commit is contained in:
João Malés 2024-09-27 14:25:10 +01:00 committed by GitHub
commit 1b3bf87ed5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,7 +23,27 @@ jobs:
- name: Install and test modules - name: Install and test modules
run: | run: |
pip install pytest pip install pytest
pip install coverage
# Initialize coverage data file
coverage erase
for module in $(find . -maxdepth 1 -type d -name "thousandeyes-sdk-*" ! -name "thousandeyes-sdk-core" | cut -c 3-); do for module in $(find . -maxdepth 1 -type d -name "thousandeyes-sdk-*" ! -name "thousandeyes-sdk-core" | cut -c 3-); do
pip install -e $module pip install -e $module
pytest $module coverage run --source=$module -m pytest $module
# Move the .coverage file to a unique name
mv .coverage .coverage.$module
done done
# Combine all .coverage files
coverage combine .coverage.*
coverage report
coverage xml
- name: Get Coverage
uses: orgoro/coverage@v3.2
with:
coverageFile: ./coverage.xml
thresholdAll: 0.4
thresholdNew: 0.6
token: ${{ secrets.GITHUB_TOKEN }}