Skip to content

Commit

Permalink
Add VSTS integration
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Jul 11, 2018
1 parent 98d6e02 commit bb4a94c
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 98 deletions.
6 changes: 0 additions & 6 deletions .travis-osx

This file was deleted.

53 changes: 4 additions & 49 deletions .travis.yml
@@ -1,10 +1,5 @@
if: tag IS present OR type = pull_request OR (branch = master AND type = push) # we only CI the master, tags and PRs

stages:
- test
- name: deploy
if: repo = "tox-dev/tox" AND tag IS present

group: travis_latest
language: python
dist: xenial
Expand All @@ -17,69 +12,29 @@ env:

jobs:
include:
- python: 2.7 # 2.7.14 pip 9.0.1
- python: 3.4 # 3.4.6 pip 9.0.1
dist: trusty
- python: 3.5 # 3.5.5 pip 9.0.1
- python: 3.6 # 3.6.3 pip 9.0.1
- python: 3.7 # 3.7.0 pip 10.0.1
- python: 3.8-dev
- python: pypy # 2.7.13 pip 9.0.1
dist: trusty
- python: pypy3 # 3.5.3 pip 9.0.1
dist: trusty
- os: osx
language: generic
- python: 3.7
env: TOXENV=docs
- python: 3.7
env: TOXENV=fix-lint
- python: 3.7
env: TOXENV=package-description

- stage: deploy
python: '3.7'
env:
install: pip install "pip >= 10.0.0"
script: skip
after_success: python -c 'print("All done! ✨✨")'
deploy:
provider: pypi
user: toxdev
distributions: sdist bdist_wheel
skip_upload_docs: true
password:
secure: GpPLWTVHMAOpHh2Jq+cYo9hE6cwTxPJ6fMA+q+ERWHtUAqSC88kBqoZ4DQb0cyFIlN24Z9f5J2vm80Q7Qv2UWCGVKeNaWMWFqvZ+P5czGEn7ARoeTsTaiyKTCC2w/7iDsne7dPcSHT/y8V2fO/35kcwcrc0EGr4peb9GDJ4asTFpffiVzW9l5OjV2+jQn+ihWNA0ujSB3AR4TLexXGH+Gf6O5uEHK/kPJ63NEDbJVEdciWqLbDiU+OwWl5Xb5hFX1fjKQ9dP4zA7SolNsNB6pqs4rLl2aHqKYOt1RYGgjWSvANDXKP7S46Q5LFIPkmt4QbOeWxX63NUMZUmWadbjoAF65q1d9Dq41IemsLmElSqpdfPaLtLgLCbNlgHRLNVH+nJVqxjc3bvdxi28K8DZ9BB9KGmPkrbbj4NB0prsPouKiBkUS9NyoQuDt1EzJ3Rn2FzMOH41X5gIqzdsdxcy+3DV2Bb+eozNgg+51n27ESf7vwiYMW9GFENw/6AcPkxIPYakQu4joJ+327wVfK4t0gdy/m4qu2n0Lx6wOJUdSOcOAT5bPaRBQV92gXAaVUsROKMfrzwlVLuA+GXcnj8fft8aMXem30+N3r7y5FjbiAts345qnbjSWV3w9qEbNjM/Z9mt7z1OfsqCarJ2Mj5wKQyYfewddYMjdk7aPW5/9gQ=
on:
all_branches: true

matrix:
fast_finish: true
allow_failures:
- python: 3.8-dev
- python: pypy
- python: pypy3
- os: osx

# Sadly Travis at the moment does not provide as job filter option git changeset, however we emulate it via bash
# we have two type of tasks to run here
# - test (TOXENV=py) => run only if source/packaging/CI files change
# - linter and documentation -> always build
# if this is a tag build we force full build

before_install:
- python -c 'import sys; print(sys.version)'
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source .travis-osx; fi
- export BUILD="setup.py pyproject.toml MANIFEST.in setup.cfg tox.ini .travis.yml appveyor.yml"
- export SRC=$(git diff --name-only $TRAVIS_COMMIT_RANGE -- '*.py' $BUILD | grep -v conf.py | grep -v "tasks/.*.py")
- '[[ "$TOXENV"!="py" || (-n "$SRC" && "$TOXENV"="py") ]] && export RUN="YES"'

install:
- '[ -n "$RUN" ] && pip install --pre -U tox'
- '[ -n "$RUN" ] && tox --notest'
- pip install --pre -U tox
- tox --notest

script:
- '[ -n "$RUN" ] && tox'
- tox

after_success:
- '[[ -n "$RUN" && "$TOXENV"="py" ]] && tox -e coverage,codecov'
- tox -e coverage,codecov
224 changes: 224 additions & 0 deletions .vsts-ci.yml
@@ -0,0 +1,224 @@
name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr)

trigger:
branches:
include:
- '*'

phases:
- phase: lint
queue:
name: 'Hosted Linux Preview'

steps:
- task: UsePythonVersion@0
displayName: setup python
inputs:
versionSpec: '3.7.0-b2'

- script: 'python -c "import sys; import os; os.symlink(sys.executable, os.path.join(os.path.dirname(sys.executable), \"python3.7\"))"'
displayName: link python to python3.7

- script: 'python -m pip install -U tox setuptools'
displayName: install tox

- script: 'tox -e fix-lint'
displayName: run tox



- phase: docs
queue:
name: 'Hosted Linux Preview'
parallel: 2
matrix:
readthedocs:
toxenv: 'docs'
packageDescription:
toxenv: 'package-description'

steps:
- task: UsePythonVersion@0
displayName: setup python
inputs:
versionSpec: '3.7.0-b2'

- script: 'python -c "import sys; import os; os.symlink(sys.executable, os.path.join(os.path.dirname(sys.executable), \"python3.7\"))"'
displayName: link python to python3.7

- script: 'python -m pip install -U tox setuptools'
displayName: install tox

- script: 'tox -e $(toxenv)'
displayName: run tox

- phase: linux
queue:
name: 'Hosted Linux Preview'
parallel: 4
matrix:
python27:
python.version: '2.7'
python34:
python.version: '3.4'
python35:
python.version: '3.5'
python36:
python.version: '3.6'
python37:
python.version: '3.7.0-b2'

steps:
- task: UsePythonVersion@0
displayName: setup python$(python.version)
inputs:
versionSpec: '$(python.version)'

- script: 'python -m pip install -U tox setuptools'
displayName: install tox

- script: 'python -m tox -e py --notest'
displayName: acquire env dependencies

- script: 'python -m tox -e py'
displayName: run tests

- task: PublishTestResults@2
displayName: publish test results
inputs:
testResultsFiles: '.tox/test-results.*.xml'
mergeTestResults: true
testRunTitle: '$(toxenv)'
platform: linux

- script: 'python -m tox -e coverage'
displayName: generate coverage.xml

- script: 'ls . -Ra'
displayName: show

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml'
failIfCoverageEmpty: true

- script: 'python -m tox -e codecov -- -t $(CODECOV_TOKEN) --required -n "$(agent.os)-$(python.version)" --build "$(Build.DefinitionName)" --env OS=$(agent.os) python=$(python.version)'
displayName: upload codecov

- phase: windows
queue:
name: 'Hosted VS2017'
parallel: 4
matrix:
python27:
python.version: '2.7'
python34:
python.version: '3.4'
python35:
python.version: '3.5'
python36:
python.version: '3.6'
python37:
python.version: '3.7.0-b2'

steps:
- task: UsePythonVersion@0
displayName: setup python$(python.version)
inputs:
versionSpec: '$(python.version)'

- script: 'python -m pip install -U tox setuptools'
displayName: install tox

- script: 'python -m tox -e py --notest'
displayName: acquire env dependencies

- script: 'python -m tox -e py'
displayName: run tests

- task: PublishTestResults@2
displayName: publish test results
inputs:
testResultsFiles: '.tox/test-results.*.xml'
mergeTestResults: true
testRunTitle: '$(toxenv)'
platform: windows

- script: 'python -m tox -e coverage'
displayName: generate coverage.xml

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml'
failIfCoverageEmpty: true

- script: 'python -m tox -e codecov -- -t $(CODECOV_TOKEN) --required -n "$(agent.os)-$(python.version)" --build "$(Build.DefinitionName)" --env OS=$(agent.os) python=$(python.version)'
displayName: upload codecov

- phase: macOS
queue:
name: 'Hosted macOS Preview'
parallel: 1
matrix:
python:
toxenv: 'py3'

steps:
- script: 'python3 -m pip install -U tox setuptools'
displayName: install tox

- script: 'python3 -m tox -e $(toxenv) --notest'
displayName: acquire env dependencies

- script: 'python3 -m tox -e $(toxenv)'
displayName: run tests

- task: PublishTestResults@2
displayName: publish test results
inputs:
testResultsFiles: '.tox/test-results.*.xml'
mergeTestResults: true
testRunTitle: '$(toxenv)'
platform: windows

- script: 'python3 -m tox -e coverage'
displayName: generate coverage.xml

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml'
failIfCoverageEmpty: true

- script: 'python3 -m tox -e codecov -- -t $(CODECOV_TOKEN) --required -n "$(agent.os)-python3" --build "$(Build.DefinitionName)" --env OS=$(agent.os) python=3'
displayName: upload codecov

- phase: publish
dependsOn:
- macOs
- linux
- windows
- lint
- docs
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
queue:
name: 'Hosted Linux Preview'
parallel: 1
matrix:
python37:
python.version: '3.7.0-b2'

steps:
- task: UsePythonVersion@0
displayName: setup python$(python.version)
inputs:
versionSpec: '$(python.version)'

# - task: PyPIPublisher@0
# displayName: Package and publish to PyPI
# inputs:
# pypiConnection: pypi
# packageDirectory: '$(System.DefaultWorkingDirectory)'
# alsoPublishWheel: true
40 changes: 0 additions & 40 deletions appveyor.yml

This file was deleted.

8 changes: 5 additions & 3 deletions tox.ini
Expand Up @@ -20,7 +20,7 @@ passenv = http_proxy https_proxy no_proxy SSL_CERT_FILE TOXENV CI TRAVIS TRAVIS_
deps =
extras = testing
changedir = {toxinidir}/tests
commands = pytest {posargs:--cov="{envsitepackagesdir}/tox" --cov-config="{toxinidir}/tox.ini" --timeout=180 . -n {env:PYTEST_XDIST_PROC_NR:auto} }
commands = pytest {posargs:--cov="{envsitepackagesdir}/tox" --cov-config="{toxinidir}/tox.ini" --timeout=180 . -n {env:PYTEST_XDIST_PROC_NR:auto} --junitxml={toxworkdir}/test-results.{envname}.xml }

[testenv:docs]
description = invoke sphinx-build to build the HTML docs and check that all links are valid
Expand All @@ -37,7 +37,7 @@ deps = readme-renderer >= 21.0
changedir = {toxinidir}
skip_install = true
extras =
commands = python setup.py check -r -s
commands = python setup.py check -r -s

[testenv:fix-lint]
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
Expand Down Expand Up @@ -74,10 +74,12 @@ commands = coverage erase

[testenv:codecov]
description = [only run on CI]: upload coverage data to codecov (depends on coverage running first)
passenv = {[testenv]passenv}
CODECOV_TOKEN
deps = codecov
skip_install = True
changedir = {toxinidir}
commands = codecov --file "{toxworkdir}/coverage.xml"
commands = codecov --file "{toxworkdir}/coverage.xml" {posargs}

[testenv:exit_code]
# to see how the InvocationError is displayed, use
Expand Down

0 comments on commit bb4a94c

Please sign in to comment.