diff --git a/appveyor.yml b/appveyor.yml index da4def8f1..d00cd143f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,10 +23,12 @@ install: - echo Installed Pythons - dir c:\Python* + - set PATH=C:\Python36;C:\Python36\Scripts;%PATH% + - if "%TOXENV%" == "pypy" call scripts\install-pypy.bat - - C:\Python36\python -m pip install --upgrade pip - - C:\Python36\python -m pip install --upgrade --pre tox + - python -m pip install --upgrade pip + - python -m pip install --upgrade --pre tox build: false # Not a C# project, build stuff at the test step instead. @@ -34,7 +36,7 @@ before_test: - call scripts\prepare-coverage.bat test_script: - - C:\Python36\python -m tox + - python -m tox on_success: - call scripts\upload-coverage.bat diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 049980efb..881f7dc22 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,6 +6,10 @@ variables: PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml" python.needs_vc: False python.exe: "python" + COVERAGE_FILE: "$(Build.Repository.LocalPath)/.coverage" + COVERAGE_PROCESS_START: "$(Build.Repository.LocalPath)/.coveragerc" + _PYTEST_TOX_COVERAGE_RUN: "coverage run -m" + _PYTEST_TOX_EXTRA_DEP: "coverage-enable-subprocess" jobs: @@ -34,6 +38,9 @@ jobs: python.version: 'pypy' tox.env: 'pypy' python.exe: 'pypy' + _PYTEST_TOX_COVERAGE_RUN: "" + _PYTEST_TOX_EXTRA_DEP: "" + PYTEST_NO_COVERAGE: "1" py34: python.version: '3.4' tox.env: 'py34' @@ -99,3 +106,8 @@ jobs: testResultsFiles: 'build/test-results/$(tox.env).xml' testRunTitle: '$(tox.env)' condition: succeededOrFailed() + + - script: call scripts\upload-coverage.bat + displayName: 'Upload coverage' + env: + CODECOV_TOKEN: $(CODECOV_TOKEN) diff --git a/scripts/appveyor-retry.cmd b/scripts/retry.cmd similarity index 100% rename from scripts/appveyor-retry.cmd rename to scripts/retry.cmd diff --git a/scripts/upload-coverage.bat b/scripts/upload-coverage.bat index 7391f817c..b51d4060f 100644 --- a/scripts/upload-coverage.bat +++ b/scripts/upload-coverage.bat @@ -1,11 +1,16 @@ REM script called by AppVeyor to combine and upload coverage information to codecov if not defined PYTEST_NO_COVERAGE ( echo Prepare to upload coverage information - C:\Python36\Scripts\pip install codecov - C:\Python36\Scripts\coverage combine - C:\Python36\Scripts\coverage xml --ignore-errors - C:\Python36\Scripts\coverage report -m --ignore-errors - scripts\appveyor-retry C:\Python36\Scripts\codecov --required -X gcov pycov search -f coverage.xml --flags windows + if defined CODECOV_TOKEN ( + echo CODECOV_TOKEN defined + ) else ( + echo CODECOV_TOKEN NOT defined + ) + python -m pip install codecov + coverage combine + coverage xml --ignore-errors + coverage report -m --ignore-errors + scripts\retry codecov --required -X gcov pycov search -f coverage.xml --flags windows ) else ( echo Skipping coverage upload, PYTEST_NO_COVERAGE is set )