Skip to content

Commit db76ff8

Browse files
committed
Upload code coverage from azure [skip travis]
1 parent 3fd2f43 commit db76ff8

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

appveyor.yml

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

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

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

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

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

3739
test_script:
38-
- C:\Python36\python -m tox
40+
- python -m tox
3941

4042
on_success:
4143
- 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

@@ -67,6 +71,9 @@ jobs:
6771
versionSpec: '$(python.version)'
6872
architecture: 'x64'
6973

74+
- script: echo %COVERAGE_FILE%
75+
displayName: 'test'
76+
7077
- script: choco install vcpython27
7178
condition: eq(variables['python.needs_vc'], True)
7279
displayName: 'Install VC for py27'
@@ -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)

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\appveyor-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)