Skip to content

Commit d5d1903

Browse files
nicoddemusblueyed
authored andcommitted
Upload code coverage from azure
1 parent 7428064 commit d5d1903

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

appveyor.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,20 @@ install:
2323
- echo Installed Pythons
2424
- dir c:\Python*
2525

26+
- set PATH=C:\Python36;C:\Python36\Scripts;%PATH%
27+
2628
- if "%TOXENV%" == "pypy" call scripts\install-pypy.bat
2729

28-
- C:\Python36\python -m pip install --upgrade pip
29-
- C:\Python36\python -m pip install --upgrade --pre tox
30+
- python -m pip install --upgrade pip
31+
- python -m pip install --upgrade --pre tox
3032

3133
build: false # Not a C# project, build stuff at the test step instead.
3234

3335
before_test:
3436
- call scripts\prepare-coverage.bat
3537

3638
test_script:
37-
- C:\Python36\python -m tox
39+
- python -m tox
3840

3941
on_success:
4042
- call scripts\upload-coverage.bat

azure-pipelines.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ variables:
66
PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml"
77
python.needs_vc: False
88
python.exe: "python"
9+
COVERAGE_FILE: "$(Build.Repository.LocalPath)/.coverage"
10+
COVERAGE_PROCESS_START: "$(Build.Repository.LocalPath)/.coveragerc"
11+
_PYTEST_TOX_COVERAGE_RUN: "coverage run -m"
12+
_PYTEST_TOX_EXTRA_DEP: "coverage-enable-subprocess"
913

1014
jobs:
1115

@@ -34,6 +38,9 @@ jobs:
3438
python.version: 'pypy'
3539
tox.env: 'pypy'
3640
python.exe: 'pypy'
41+
_PYTEST_TOX_COVERAGE_RUN: ""
42+
_PYTEST_TOX_EXTRA_DEP: ""
43+
PYTEST_NO_COVERAGE: "1"
3744
py34:
3845
python.version: '3.4'
3946
tox.env: 'py34'
@@ -99,3 +106,8 @@ jobs:
99106
testResultsFiles: 'build/test-results/$(tox.env).xml'
100107
testRunTitle: '$(tox.env)'
101108
condition: succeededOrFailed()
109+
110+
- script: call scripts\upload-coverage.bat
111+
displayName: 'Upload coverage'
112+
env:
113+
CODECOV_TOKEN: $(CODECOV_TOKEN)
File renamed without changes.

scripts/upload-coverage.bat

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
REM script called by AppVeyor to combine and upload coverage information to codecov
22
if not defined PYTEST_NO_COVERAGE (
33
echo Prepare to upload coverage information
4-
C:\Python36\Scripts\pip install codecov
5-
C:\Python36\Scripts\coverage combine
6-
C:\Python36\Scripts\coverage xml --ignore-errors
7-
C:\Python36\Scripts\coverage report -m --ignore-errors
8-
scripts\appveyor-retry C:\Python36\Scripts\codecov --required -X gcov pycov search -f coverage.xml --flags windows
4+
if defined CODECOV_TOKEN (
5+
echo CODECOV_TOKEN defined
6+
) else (
7+
echo CODECOV_TOKEN NOT defined
8+
)
9+
python -m pip install codecov
10+
coverage combine
11+
coverage xml --ignore-errors
12+
coverage report -m --ignore-errors
13+
scripts\retry codecov --required -X gcov pycov search -f coverage.xml --flags windows
914
) else (
1015
echo Skipping coverage upload, PYTEST_NO_COVERAGE is set
1116
)

0 commit comments

Comments
 (0)