diff options
author | Bernát Gábor <bgabor8@bloomberg.net> | 2019-05-01 05:53:35 -0400 |
---|---|---|
committer | Bernat Gabor <bgabor8@bloomberg.net> | 2019-05-01 06:17:20 -0400 |
commit | d33b803d5b17809d64644996eb4803890786a03e (patch) | |
tree | 7fee78a4ad66c1426b2bbc88a59e98aa93c72381 | |
parent | 18147f4c5af75caf40c3c2f95a0907da2db83deb (diff) | |
download | tox-git-d33b803d5b17809d64644996eb4803890786a03e.tar.gz |
simplify CI/remove code climate (#1277)
-rw-r--r-- | .codeclimate.yml | 55 | ||||
-rw-r--r-- | azure-pipelines.yml | 249 | ||||
-rw-r--r-- | azure-run-tox-env.yml | 84 | ||||
-rw-r--r-- | tox.ini | 2 |
4 files changed, 60 insertions, 330 deletions
diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 4fa9ccbe..00000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,55 +0,0 @@ -version: "2" -checks: - argument-count: - config: - threshold: 6 - complex-logic: - config: - threshold: 10 - file-lines: - config: - threshold: 500 - method-complexity: - config: - threshold: 10 - method-count: - config: - threshold: 20 - method-lines: - config: - threshold: 50 - nested-control-flow: - config: - threshold: 4 - return-statements: - config: - threshold: 10 - -plugins: - sonar-python: - enabled: true - config: - tests_patterns: - - tests/** - pep8: - enabled: false - radon: - enabled: false - -exclude_patterns: - - "docs/" - - "tasks/" - - ".github/" - - ".pre-commit-config.yml" - - "*.yml" - - "*.yaml" - - "*.rst" - - "*.ini" - - ".gitignore" - - ".codeclimate.yml" - - "CONTRIBUTORS" - - "CODE_OF_CONDUCT.md" - - "LICENSE" - - "MANIFEST.in" - - "pyproject.toml" - - "setup.cfg" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6dda9858..279df065 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,16 +1,12 @@ 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 @@ -18,186 +14,59 @@ trigger: 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 diff --git a/azure-run-tox-env.yml b/azure-run-tox-env.yml deleted file mode 100644 index 449f03a7..00000000 --- a/azure-run-tox-env.yml +++ /dev/null @@ -1,84 +0,0 @@ -parameters: - tox: "" - python: "" - os: "linux" - -jobs: -- job: ${{ format('{0}_{1}', parameters.os, parameters.tox) }} - dependsOn: notify_build_start - pool: - ${{ if eq(parameters.os, 'windows') }}: - vmImage: "windows-2019" - ${{ if eq(parameters.os, 'macOs') }}: - vmImage: "macOS-latest" - ${{ if eq(parameters.os, 'linux') }}: - vmImage: "Ubuntu-16.04" - - variables: - TMPDIR: $(Build.BinariesDirectory) - ${{ if in(parameters.tox, 'pypy', 'py27', 'py34') }}: - PYTHONWARNINGS: 'ignore:::pip._internal.cli.base_command' - ${{ if in(parameters.python, 'pypy', 'pypy3') }}: - python: ${{ parameters.python }} - ${{ if notIn(parameters.python, 'pypy', 'pypy3') }}: - python: "python" - - steps: - # ensure the required Python versions are available - - ${{ if notIn(parameters.python, 'pypy', 'pypy3') }}: - - task: UsePythonVersion@0 - displayName: setup python - inputs: - versionSpec: ${{ parameters.python }} - - - script: 'python -c "import sys; print(sys.version); print(sys.executable);"' - displayName: show python information - - - 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: ${{ format('python -m tox -e {0} --notest', parameters.tox) }} - displayName: install test dependencies - - - ${{ if startsWith(parameters.tox, 'py') }}: - - script: python -m tox -e coverage --notest - displayName: install coverage dependencies - - - script: ${{ format('python -m tox -e {0}', parameters.tox) }} - displayName: run tests - - - ${{ if startsWith(parameters.tox, 'py') }}: - - task: PublishTestResults@2 - displayName: publish test results via junit - condition: succeededOrFailed() - inputs: - testResultsFormat: "JUnit" - testResultsFiles: ${{ format('$(System.DefaultWorkingDirectory)/.tox/.test.{0}.xml', parameters.tox) }} - testRunTitle: ${{ format('{0}_{1}', parameters.os, parameters.tox) }} - - - ${{ if startsWith(parameters.tox, 'py') }}: - - script: "python -m tox -e coverage" - displayName: create coverag report - condition: succeededOrFailed() - - - ${{ if startsWith(parameters.tox, 'py') }}: - - - task: CopyFiles@2 - displayName: move coverage files into staging area - condition: succeededOrFailed() - inputs: - sourceFolder: $(System.DefaultWorkingDirectory)/.tox - contents: | - .coverage - coverage.xml - targetFolder: $(Build.StagingDirectory) - - - task: PublishBuildArtifacts@1 - displayName: publish coverage file - condition: succeededOrFailed() - inputs: - pathtoPublish: $(Build.ArtifactStagingDirectory) - ArtifactName: ${{ format('coverage-{0}-{1}', parameters.os, parameters.tox) }} @@ -25,7 +25,7 @@ extras = testing commands = pytest \ --cov "{envsitepackagesdir}/tox" \ --cov-config "{toxinidir}/tox.ini" \ - --junitxml {env:JUNIT_XML_FILE:{toxworkdir}/.test.{envname}.xml} \ + --junitxml {toxworkdir}/junit.{envname}.xml \ -n={env:PYTEST_XDIST_PROC_NR:auto} \ {posargs:.} |