|
| 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