Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit 4950cd2

Browse files
committed
first version
1 parent 848c64c commit 4950cd2

File tree

5 files changed

+198
-0
lines changed

5 files changed

+198
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# azure-pipelines-template
22
template for your azure pipelines
3+

merge-coverage.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
parameters:
2+
dependsOn: []
3+
coverage: 'coverage'
4+
5+
jobs:
6+
- job: report_coverage
7+
pool: {vmImage: "Ubuntu-16.04"}
8+
condition: always()
9+
dependsOn: ${{ parameters.dependsOn }}
10+
variables:
11+
TMPDIR: $(Build.BinariesDirectory)
12+
PIP_NO_WARN_SCRIPT_LOCATION: '0'
13+
TOXENV: ${{ parameters.coverage }}
14+
steps:
15+
- task: DownloadBuildArtifacts@0
16+
displayName: download coverage files for run
17+
inputs:
18+
buildType: current
19+
downloadType: specific
20+
itemPattern: coverage-*/*
21+
downloadPath: $(Build.StagingDirectory)
22+
23+
- task: UsePythonVersion@0
24+
displayName: setup python
25+
inputs:
26+
versionSpec: 3.7
27+
28+
- script: |
29+
python -c '
30+
from pathlib import Path
31+
import shutil
32+
33+
from_folder = Path("$(Build.StagingDirectory)")
34+
destination_folder = Path("$(System.DefaultWorkingDirectory)") / ".tox"
35+
destination_folder.mkdir()
36+
for coverage_file in from_folder.glob("*/.coverage"):
37+
destination = destination_folder / f".coverage.{coverage_file.parent.name[9:]}"
38+
print(f"{coverage_file} copy to {destination}")
39+
shutil.copy(str(coverage_file), str(destination))'
40+
displayName: move coverage files into .tox
41+
42+
- script: "python -m pip install tox -U --user"
43+
displayName: upgrade pip
44+
45+
- script: 'python -m tox -vv --sdistonly'
46+
displayName: run package build to ensure generated files present
47+
48+
- script: 'python -m tox --notest -vv --skip-missing-interpreters false'
49+
displayName: generate coverage tox test environment
50+
51+
- script: 'python -m tox'
52+
displayName: create coverag report via tox
53+
54+
- task: PublishCodeCoverageResults@1
55+
displayName: publish overall coverage report to Azure
56+
inputs:
57+
codeCoverageTool: 'Cobertura'
58+
summaryFileLocation: "$(System.DefaultWorkingDirectory)/.tox/coverage.xml"
59+
failIfCoverageEmpty: true

publish-pypi.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
parameters:
2+
external_feed: ''
3+
pypi_remote: ''
4+
dependsOn: []
5+
6+
jobs:
7+
- job: publish
8+
dependsOn: ${{ parameters.dependsOn }}
9+
condition: succeeded()
10+
pool: {vmImage: 'Ubuntu-16.04'}
11+
variables:
12+
TMPDIR: $(Build.BinariesDirectory)
13+
PIP_NO_WARN_SCRIPT_LOCATION: '0'
14+
steps:
15+
- task: UsePythonVersion@0
16+
displayName: setup python3.7
17+
inputs: {versionSpec: '3.7'}
18+
- task: TwineAuthenticate@0
19+
inputs:
20+
externalFeeds: ${{ parameters.external_feed}}
21+
- script: 'python -m pip install pip -U; python -m pip install twine pep517 -U'
22+
displayName: "acquire build tools"
23+
- script: 'python -m pep517.build -m --binary --source --out-dir "$(System.DefaultWorkingDirectory)/w" .'
24+
displayName: "build wheel and source distribution"
25+
- script: ${{ format('python3.7 -m twine upload -r {0} --config-file $(PYPIRC_PATH) "$(System.DefaultWorkingDirectory)/w/*"', parameters.pypi_remote) }}
26+
displayName: "upload sdist and wheel to PyPi"

run-tox-env.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
parameters:
2+
jobs: []
3+
4+
jobs:
5+
- ${{ each job in parameters.jobs }}:
6+
- job: ${{ job.key }}
7+
strategy:
8+
matrix:
9+
${{ each env in job.value.toxenvs }}:
10+
${{ env }}:
11+
TOXENV: ${{ env }}
12+
${{ if job.value.py }}:
13+
py: ${{ job.value.py }}
14+
${{ if not(job.value.py) }}:
15+
${{ if or(eq(env, 'py27'), startsWith(env, 'py27-')) }}:
16+
py: '2.7'
17+
PYTHONWARNINGS: 'ignore:::pip._internal.cli.base_command'
18+
${{ if or(eq(env, 'py34'), startsWith(env, 'py34-')) }}:
19+
py: '3.4'
20+
PYTHONWARNINGS: 'ignore:::pip._internal.cli.base_command'
21+
${{ if or(eq(env, 'py35'), startsWith(env, 'py35-')) }}:
22+
py: '3.5'
23+
${{ if or(eq(env, 'py36'), startsWith(env, 'py36-')) }}:
24+
py: '3.6'
25+
${{ if or(eq(env, 'py37'), startsWith(env, 'py37-')) }}:
26+
py: '3.7'
27+
${{ if or(eq(env, 'pypy'), startsWith(env, 'pypy-')) }}:
28+
py: 'pypy2'
29+
PYTHONWARNINGS: 'ignore:::pip._internal.cli.base_command'
30+
${{ if or(eq(env, 'pypy3'), startsWith(env, 'pypy3-')) }}:
31+
py: 'pypy3'
32+
${{ if or(eq(env, 'py38'), startsWith(env, 'py38-')) }}:
33+
py: '3.7'
34+
ispy38: true
35+
pool:
36+
${{ if job.value.image }}:
37+
vmImage: ${{ job.value.image }}
38+
${{ if not(job.value.image) }}:
39+
${{ if eq(job.key, 'linux') }}:
40+
vmImage: 'Ubuntu-16.04'
41+
${{ if eq(job.key, 'windows') }}:
42+
vmImage: 'windows-2019'
43+
${{ if eq(job.key, 'macOs') }}:
44+
vmImage: 'macOS-latest'
45+
${{ if notIn(job.key, 'macOs', 'linux', 'windows') }}:
46+
vmImage: 'Ubuntu-16.04'
47+
48+
variables:
49+
TMPDIR: $(Build.BinariesDirectory)
50+
PIP_NO_WARN_SCRIPT_LOCATION: '0'
51+
PIP_DISABLE_PIP_VERSION_CHECK: '1'
52+
53+
steps:
54+
- task: UsePythonVersion@0
55+
inputs:
56+
versionSpec: $(py)
57+
architecture: ${{ coalesce(job.value.architecture, 'x64') }}
58+
59+
- script: |
60+
sudo add-apt-repository ppa:deadsnakes
61+
sudo apt-get update
62+
sudo apt-get install -y --no-install-recommends python3.8-dev python3.8-distutils
63+
condition: variables.ispy38
64+
displayName: install python 3.8
65+
66+
- script: 'python -c "import sys; print(sys.version); print(sys.executable);"'
67+
displayName: show python information
68+
69+
- script: "python -m pip install -U tox --user"
70+
displayName: install tox
71+
72+
- script: 'python -m tox --notest -vv --skip-missing-interpreters false'
73+
displayName: generate tox test environment
74+
75+
- script: 'python -m tox'
76+
displayName: run tox test environment
77+
78+
- bash: 'printf "##vso[task.setVariable variable=junit]" && ([ -f $(System.DefaultWorkingDirectory)/.tox/junit.$(TOXENV).xml ] && printf yes || printf no) && echo ""'
79+
displayName: check if junit file present
80+
81+
- task: PublishTestResults@2
82+
displayName: publish test results via junit
83+
condition: eq(variables.junit, 'yes')
84+
inputs:
85+
testResultsFormat: "JUnit"
86+
testResultsFiles: '.tox/junit.$(TOXENV).xml'
87+
testRunTitle: ${{ format('{0}-$(TOXENV)', job.value.image) }}
88+
89+
- ${{ if job.value.coverage }}:
90+
- script: ${{ format('python -m tox -e {0}', job.value.coverage) }}
91+
displayName: create coverag report
92+
93+
- bash: 'printf "##vso[task.setVariable variable=coverage]" && ([ -f $(System.DefaultWorkingDirectory)/.tox/coverage.xml -o -f $(System.DefaultWorkingDirectory)/.tox/.coverage ] && printf yes || printf no) && echo ""'
94+
displayName: check if coverage file present
95+
96+
- task: CopyFiles@2
97+
displayName: move coverage files into staging area
98+
condition: eq(variables.coverage, 'yes')
99+
inputs:
100+
sourceFolder: $(System.DefaultWorkingDirectory)/.tox
101+
contents: |
102+
.coverage
103+
coverage.xml
104+
targetFolder: $(Build.StagingDirectory)
105+
106+
- task: PublishBuildArtifacts@1
107+
displayName: publish coverage file
108+
condition: eq(variables.coverage, 'yes')
109+
inputs:
110+
pathtoPublish: $(Build.ArtifactStagingDirectory)
111+
ArtifactName: ${{ format('coverage-{0}-$(TOXENV)', job.value.image) }}

0 commit comments

Comments
 (0)