From 2512c6ef9dc02cf0af073385ed6ae0f507d0819b Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Wed, 20 Mar 2019 10:17:10 -0400 Subject: [PATCH 1/3] coverage: workaround for XML reporting bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There’s a bug in coverage.py when using the source specifier which causes the XML reports to omit the first element of the directory name, breaking some tools (this does not affect the HTML or text format reports). Using include instead avoids this problem until the upstream bug is resolved: https://github.com/nedbat/coveragepy/issues/578 --- .coveragerc | 22 ++++++++++++++++++---- .travis.yml | 3 ++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.coveragerc b/.coveragerc index 17607abaa..d4a42e766 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,20 @@ [run] branch = true -source = - concordia - importer - exporter +include = + concordia/* + importer/* + exporter/* + omit = + */migrations/* + */tests/* + concordia/settings* + +[report] +include = + concordia/* + importer/* + exporter/* +omit = + */migrations/* + */tests/* + concordia/settings* diff --git a/.travis.yml b/.travis.yml index 63e64a847..9cb40a31d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,8 @@ script: - mkdir logs - touch ./logs/concordia-celery.log - pipenv run ./manage.py collectstatic --no-input - - pipenv run coverage run ./manage.py test concordia importer exporter + # n.b. + - pipenv run coverage run ./manage.py test - git diff --name-only $TRAVIS_COMMIT_RANGE | xargs pre-commit run --files - pipenv run safety check after_success: From c9a0686fde6b399530de28032450764a8cca590d Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Wed, 20 Mar 2019 10:45:24 -0400 Subject: [PATCH 2/3] Completely exclude coverage.xml from Sonar scans --- sonar-project.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index d7567b49d..84533d9b3 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ -sonar.exclusions=**/tests/**, node_modules/**, htmlcov/**, static-files/**, concordia/settings_dev*, concordia/settings_test* +sonar.exclusions=**/tests/**, node_modules/**, htmlcov/**, static-files/**, concordia/settings_dev*, concordia/settings_test*, coverage.xml sonar.sources=. sonar.projectKey=LibraryOfCongress_concordia sonar.organization=libraryofcongress sonar.host.url=https://sonarcloud.io sonar.python.coverage.reportPaths=coverage.xml -sonar.coverage.exclusions=cloudformation/**, coverage.xml, setup.py, **/static/**, **/templates/**, **/vendor/** +sonar.coverage.exclusions=cloudformation/**, setup.py, **/static/**, **/templates/**, **/vendor/** From 6a5947bbb308eaa659846fe3dc84c466966caa4c Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Wed, 20 Mar 2019 10:48:43 -0400 Subject: [PATCH 3/3] Travis: fetch Git tags before running code scans This allows builds to start faster but still has the full history available for code analysis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9cb40a31d..4c976d33c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,7 @@ script: - git diff --name-only $TRAVIS_COMMIT_RANGE | xargs pre-commit run --files - pipenv run safety check after_success: + - git fetch --unshallow --tags - pipenv run coverage xml - sonar-scanner - coveralls