Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions .codeclimate.yml

This file was deleted.

249 changes: 59 additions & 190 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,203 +1,72 @@
name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr)

variables:
"System.PreferGit": true
CI_NAME: Azure Pipelines
CI_BUILD_ID: $(Build.BuildId)
CI_BUILD_URL: "https://toxdev.visualstudio.com/tox/_build/results?buildId=$(Build.BuildId)"
GIT_BRANCH: $[ coalesce(variables['System.PullRequest.SourceBranch'], variables['Build.SourceBranchName'], 'not-found') ]
GIT_COMMIT_SHA: $[ coalesce(variables['System.PullRequest.SourceCommitId'], variables['Build.SourceVersion'], 'not-found') ]
PIP_NO_WARN_SCRIPT_LOCATION: '0'
PYTEST_ADDOPTS: "-v -v -ra --showlocals"
PYTEST_XDIST_PROC_NR: 'auto'

resources:
repositories:
- repository: tox
type: github
endpoint: toxdevorg
name: tox-dev/azure-pipelines-template
ref: master

trigger:
batch: true
branches:
include:
- master
- refs/tags/*
paths:
exclude:
- readthedocs.yml
- LICENSE
- HOWTORELEASE.rst
- CONTRIBUTORS
- CONTRIBUTING.rst
- CODE_OF_CONDUCT.md
- .gitignore
- .github/*
- tasks/*

jobs:
- job: notify_build_start
pool: {vmImage: "Ubuntu-16.04"}
steps:
- script: |
printenv && \
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && \
chmod +x ./cc-test-reporter && \
./cc-test-reporter before-build -d
displayName: notify code climate of new build

- template: azure-run-tox-env.yml
parameters: {tox: fix_lint, python: 3.7}
- template: azure-run-tox-env.yml
parameters: {tox: docs, python: 3.7}
- template: azure-run-tox-env.yml
parameters: {tox: package_description, python: 3.7}

- template: azure-run-tox-env.yml
parameters: {tox: pypy, python: pypy, os: linux}
- template: azure-run-tox-env.yml
parameters: {tox: pypy3, python: pypy3, os: linux}

- template: azure-run-tox-env.yml
parameters: {tox: py37, python: 3.7, os: windows}
- template: azure-run-tox-env.yml
parameters: {tox: py36, python: 3.6, os: windows}
- template: azure-run-tox-env.yml
parameters: {tox: py35, python: 3.5, os: windows}
- template: azure-run-tox-env.yml
parameters: {tox: py34, python: 3.4, os: windows}
- template: azure-run-tox-env.yml
parameters: {tox: py27, python: 2.7, os: windows}

- template: azure-run-tox-env.yml
parameters: {tox: py37, python: 3.7, os: linux}
- template: azure-run-tox-env.yml
parameters: {tox: py36, python: 3.6, os: linux}
- template: azure-run-tox-env.yml
parameters: {tox: py35, python: 3.5, os: linux}
- template: azure-run-tox-env.yml
parameters: {tox: py34, python: 3.4, os: linux}
- template: azure-run-tox-env.yml
parameters: {tox: py27, python: 2.7, os: linux}

- template: azure-run-tox-env.yml
parameters: {tox: py37, python: 3.7, os: macOs}
- template: azure-run-tox-env.yml
parameters: {tox: py27, python: 2.7, os: macOs}

- job: report_coverage
pool: {vmImage: "Ubuntu-16.04"}
condition: always()
dependsOn:
- windows_py37
- windows_py36
- windows_py35
- windows_py34
- windows_py27
- linux_py37
- linux_py36
- linux_py35
- linux_py34
- linux_py27
- linux_pypy3
- linux_pypy
- macOS_py37
- macOS_py27
steps:
- task: DownloadBuildArtifacts@0
displayName: download coverage files for run
inputs:
buildType: current
downloadType: specific
itemPattern: coverage-*/*
downloadPath: $(Build.StagingDirectory)

- task: UsePythonVersion@0
displayName: setup python
inputs:
versionSpec: 3.7

- script: |
python -c '
from pathlib import Path
import shutil

from_folder = Path("$(Build.StagingDirectory)")
destination_folder = Path("$(System.DefaultWorkingDirectory)") / ".tox"
destination_folder.mkdir()
for coverage_file in from_folder.glob("*/.coverage"):
destination = destination_folder / f".coverage.{coverage_file.parent.name[9:]}"
print(f"{coverage_file} copy to {destination}")
shutil.copy(str(coverage_file), str(destination))'
displayName: move coverage files into .tox

- script: "python -m pip install -U pip setuptools --user"
displayName: upgrade pip

- script: 'python -m pip install . -U --user'
displayName: install tox - eat our own dog food

- script: 'python -m tox -e py --sdistonly'
displayName: generate version.py

- script: 'python -m tox -e coverage'
displayName: create coverag report via tox

- task: PublishCodeCoverageResults@1
displayName: publish overall coverage report to Azure
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: "$(System.DefaultWorkingDirectory)/.tox/coverage.xml"
failIfCoverageEmpty: true
pr:
branches:
include:
- master

- script: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && \
chmod +x ./cc-test-reporter && \
python -c '
from xml.etree import ElementTree as et
from pathlib import Path
import subprocess
variables:
PYTEST_ADDOPTS: "-v -v -ra --showlocals"
PYTEST_XDIST_PROC_NR: 'auto'

from_folder = Path("$(Build.StagingDirectory)")
for counter, coverage_file in enumerate(from_folder.glob("*/coverage.xml")):
key = coverage_file.parent.name[9:]
print(f"{counter}) {coverage_file}")
try:
cmd = ["$(System.DefaultWorkingDirectory)/cc-test-reporter", "format-coverage",
str(coverage_file),
"-d", "-t", "coverage.py",
"-o", f"$(Build.StagingDirectory)/code-climate.{key}.json"]
print(f"\t{cmd}")
log = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
code = 0
except subprocess.CalledProcessError as exception:
log, code = exception.output, exception.returncode
finally:
print(code, log, "\n", sep="\n")' && \
./cc-test-reporter sum-coverage -d --output - \
--parts $(ls -1 $(Build.StagingDirectory)/code-climate.*.json | wc -l) \
$(Build.StagingDirectory)/code-climate.*.json | \
./cc-test-reporter -d -r d24f105984ab5e087773a21b8668acb0b36cb8311fc2637f78a2d9451e531e08 \
upload-coverage --input -
displayName: publish code climate
condition: succeededOrFailed()
jobs:
- template: run-tox-env.yml@tox
parameters:
jobs:
check:
py: '3.7'
toxenvs:
- fix_lint
- docs
- package_description
windows:
coverage: 'coverage'
toxenvs:
- py37
- py36
- py35
- py34
- py27
linux:
coverage: 'coverage'
toxenvs:
- py38
- py37
- py36
- py35
- py34
- py27
macOs:
coverage: 'coverage'
toxenvs:
- py37
- py27
- template: merge-coverage.yml@tox
parameters:
dependsOn:
- windows
- linux
- macOs

- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
- job: publish
dependsOn:
- report_coverage
- linux_fix_lint
- linux_docs
- linux_package_description
condition: succeeded()
pool: {vmImage: "Ubuntu-16.04"}
steps:
- task: UsePythonVersion@0
displayName: setup python3.7
inputs: {versionSpec: '3.7'}
- task: TwineAuthenticate@0
inputs:
externalFeeds: 'toxdev'
- script: 'python3.7 -m pip install -U twine pip . --user'
displayName: "acquire build tools"
- script: 'python3.7 -m pip wheel -w "$(System.DefaultWorkingDirectory)/w" --no-deps .'
displayName: "build wheel"
- script: 'python3.7 -m tox -e py --sdistonly'
displayName: "build sdist"
- script: 'python3.7 -m twine upload -r pypi-toxdev --config-file $(PYPIRC_PATH) $(System.DefaultWorkingDirectory)/w/* .tox/dist/*'
displayName: "upload sdist and wheel to PyPi"
- template: publish-pypi.yml@tox
parameters:
- external_feed: 'toxdev'
- pypi_remote: 'pypi-toxdev'
- dependsOn:
- check
- report_coverage
Loading