mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #1012 from pre-commit/azure_pipelines
azure pipelines [skip travis] [skip appveyor]
This commit is contained in:
commit
fee8ddd54b
9 changed files with 72 additions and 85 deletions
34
.travis.yml
34
.travis.yml
|
|
@ -1,34 +0,0 @@
|
||||||
language: python
|
|
||||||
dist: xenial
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- env: TOXENV=py27
|
|
||||||
- env: TOXENV=py27 LATEST_GIT=1
|
|
||||||
- env: TOXENV=py36
|
|
||||||
python: 3.6
|
|
||||||
- env: TOXENV=pypy
|
|
||||||
python: pypy2.7-5.10.0
|
|
||||||
- env: TOXENV=py37
|
|
||||||
python: 3.7
|
|
||||||
install: pip install coveralls tox
|
|
||||||
script: tox
|
|
||||||
before_install:
|
|
||||||
- git --version
|
|
||||||
- |
|
|
||||||
if [ "$LATEST_GIT" = "1" ]; then
|
|
||||||
testing/latest-git.sh
|
|
||||||
export PATH="/tmp/git/bin:$PATH"
|
|
||||||
fi
|
|
||||||
- git --version
|
|
||||||
- 'testing/get-swift.sh && export PATH="/tmp/swift/usr/bin:$PATH"'
|
|
||||||
- 'curl -sSf https://sh.rustup.rs | bash -s -- -y'
|
|
||||||
- export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
after_success: coveralls
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/.cache/pip
|
|
||||||
- $HOME/.cache/pre-commit
|
|
||||||
- $HOME/.rustup
|
|
||||||
- $HOME/.swift
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
[](https://travis-ci.org/pre-commit/pre-commit)
|
[](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=21&branchName=master)
|
||||||
[](https://coveralls.io/github/pre-commit/pre-commit?branch=master)
|
[](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=21&branchName=master)
|
||||||
[](https://ci.appveyor.com/project/asottile/pre-commit/branch/master)
|
|
||||||
|
|
||||||
## pre-commit
|
## pre-commit
|
||||||
|
|
||||||
|
|
|
||||||
29
appveyor.yml
29
appveyor.yml
|
|
@ -1,29 +0,0 @@
|
||||||
environment:
|
|
||||||
global:
|
|
||||||
COVERAGE_IGNORE_WINDOWS: '# pragma: windows no cover'
|
|
||||||
TOX_TESTENV_PASSENV: COVERAGE_IGNORE_WINDOWS
|
|
||||||
matrix:
|
|
||||||
- TOXENV: py27
|
|
||||||
- TOXENV: py37
|
|
||||||
|
|
||||||
install:
|
|
||||||
- "SET PATH=C:\\Python37;C:\\Python37\\Scripts;%PATH%"
|
|
||||||
- pip install tox virtualenv --upgrade
|
|
||||||
- "mkdir -p C:\\Temp"
|
|
||||||
- "SET TMPDIR=C:\\Temp"
|
|
||||||
- "curl -sSf https://sh.rustup.rs | bash -s -- -y"
|
|
||||||
- "SET PATH=%USERPROFILE%\\.cargo\\bin;%PATH%"
|
|
||||||
|
|
||||||
# Not a C# project
|
|
||||||
build: false
|
|
||||||
|
|
||||||
before_test:
|
|
||||||
# Shut up CRLF messages
|
|
||||||
- git config --global core.autocrlf false
|
|
||||||
- git config --global core.safecrlf false
|
|
||||||
|
|
||||||
test_script: tox
|
|
||||||
|
|
||||||
cache:
|
|
||||||
- '%LOCALAPPDATA%\pip\cache'
|
|
||||||
- '%USERPROFILE%\.cache\pre-commit'
|
|
||||||
50
azure-pipelines.yml
Normal file
50
azure-pipelines.yml
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include: [master, test-me-*]
|
||||||
|
tags:
|
||||||
|
include: ['*']
|
||||||
|
|
||||||
|
resources:
|
||||||
|
repositories:
|
||||||
|
- repository: asottile
|
||||||
|
type: github
|
||||||
|
endpoint: github
|
||||||
|
name: asottile/azure-pipeline-templates
|
||||||
|
ref: refs/tags/v0.0.13
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- template: job--pre-commit.yml@asottile
|
||||||
|
- template: job--python-tox.yml@asottile
|
||||||
|
parameters:
|
||||||
|
toxenvs: [py27, py37]
|
||||||
|
os: windows
|
||||||
|
additional_variables:
|
||||||
|
COVERAGE_IGNORE_WINDOWS: '# pragma: windows no cover'
|
||||||
|
TOX_TESTENV_PASSENV: COVERAGE_IGNORE_WINDOWS
|
||||||
|
TEMP: C:\Temp # remove when dropping python2
|
||||||
|
pre_test:
|
||||||
|
- template: step--rust-install.yml
|
||||||
|
- template: job--python-tox.yml@asottile
|
||||||
|
parameters:
|
||||||
|
toxenvs: [py37]
|
||||||
|
os: linux
|
||||||
|
name_postfix: _latest_git
|
||||||
|
pre_test:
|
||||||
|
- task: UseRubyVersion@0
|
||||||
|
- template: step--git-install.yml
|
||||||
|
- template: step--rust-install.yml
|
||||||
|
- bash: |
|
||||||
|
testing/get-swift.sh
|
||||||
|
echo '##vso[task.prependpath]/tmp/swift/usr/bin'
|
||||||
|
displayName: install swift
|
||||||
|
- template: job--python-tox.yml@asottile
|
||||||
|
parameters:
|
||||||
|
toxenvs: [pypy, pypy3, py27, py36, py37]
|
||||||
|
os: linux
|
||||||
|
pre_test:
|
||||||
|
- task: UseRubyVersion@0
|
||||||
|
- template: step--rust-install.yml
|
||||||
|
- bash: |
|
||||||
|
testing/get-swift.sh
|
||||||
|
echo '##vso[task.prependpath]/tmp/swift/usr/bin'
|
||||||
|
displayName: install swift
|
||||||
|
|
@ -23,7 +23,7 @@ def _envdir(prefix, version):
|
||||||
return prefix.path(directory)
|
return prefix.path(directory)
|
||||||
|
|
||||||
|
|
||||||
def get_env_patch(venv):
|
def get_env_patch(venv): # pragma: windows no cover
|
||||||
if sys.platform == 'cygwin': # pragma: no cover
|
if sys.platform == 'cygwin': # pragma: no cover
|
||||||
_, win_venv, _ = cmd_output('cygpath', '-w', venv)
|
_, win_venv, _ = cmd_output('cygpath', '-w', venv)
|
||||||
install_prefix = r'{}\bin'.format(win_venv.strip())
|
install_prefix = r'{}\bin'.format(win_venv.strip())
|
||||||
|
|
@ -41,12 +41,14 @@ def get_env_patch(venv):
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def in_env(prefix, language_version):
|
def in_env(prefix, language_version): # pragma: windows no cover
|
||||||
with envcontext(get_env_patch(_envdir(prefix, language_version))):
|
with envcontext(get_env_patch(_envdir(prefix, language_version))):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
def install_environment(prefix, version, additional_dependencies):
|
def install_environment(
|
||||||
|
prefix, version, additional_dependencies,
|
||||||
|
): # pragma: windows no cover
|
||||||
additional_dependencies = tuple(additional_dependencies)
|
additional_dependencies = tuple(additional_dependencies)
|
||||||
assert prefix.exists('package.json')
|
assert prefix.exists('package.json')
|
||||||
envdir = _envdir(prefix, version)
|
envdir = _envdir(prefix, version)
|
||||||
|
|
@ -72,6 +74,6 @@ def install_environment(prefix, version, additional_dependencies):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def run_hook(hook, file_args):
|
def run_hook(hook, file_args): # pragma: windows no cover
|
||||||
with in_env(hook.prefix, hook.language_version):
|
with in_env(hook.prefix, hook.language_version):
|
||||||
return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
|
return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
|
||||||
|
|
|
||||||
|
|
@ -109,15 +109,15 @@ def norm_version(version):
|
||||||
if _sys_executable_matches(version):
|
if _sys_executable_matches(version):
|
||||||
return sys.executable
|
return sys.executable
|
||||||
|
|
||||||
|
version_exec = _find_by_py_launcher(version)
|
||||||
|
if version_exec:
|
||||||
|
return version_exec
|
||||||
|
|
||||||
# Try looking up by name
|
# Try looking up by name
|
||||||
version_exec = find_executable(version)
|
version_exec = find_executable(version)
|
||||||
if version_exec and version_exec != version:
|
if version_exec and version_exec != version:
|
||||||
return version_exec
|
return version_exec
|
||||||
|
|
||||||
version_exec = _find_by_py_launcher(version)
|
|
||||||
if version_exec:
|
|
||||||
return version_exec
|
|
||||||
|
|
||||||
# If it is in the form pythonx.x search in the default
|
# If it is in the form pythonx.x search in the default
|
||||||
# place on windows
|
# place on windows
|
||||||
if version.startswith('python'):
|
if version.startswith('python'):
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ def cmd_output_mocked_pre_commit_home(*args, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
skipif_cant_run_docker = pytest.mark.skipif(
|
skipif_cant_run_docker = pytest.mark.skipif(
|
||||||
docker_is_running() is False,
|
os.name == 'nt' or not docker_is_running(),
|
||||||
reason='Docker isn\'t running or can\'t be accessed',
|
reason="Docker isn't running or can't be accessed",
|
||||||
)
|
)
|
||||||
|
|
||||||
skipif_cant_run_swift = pytest.mark.skipif(
|
skipif_cant_run_swift = pytest.mark.skipif(
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ def test_argument_too_long():
|
||||||
def test_xargs_smoke():
|
def test_xargs_smoke():
|
||||||
ret, out, err = xargs.xargs(('echo',), ('hello', 'world'))
|
ret, out, err = xargs.xargs(('echo',), ('hello', 'world'))
|
||||||
assert ret == 0
|
assert ret == 0
|
||||||
assert out == b'hello world\n'
|
assert out.replace(b'\r\n', b'\n') == b'hello world\n'
|
||||||
assert err == b''
|
assert err == b''
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
15
tox.ini
15
tox.ini
|
|
@ -1,20 +1,19 @@
|
||||||
[tox]
|
[tox]
|
||||||
project = pre_commit
|
envlist = py27,py36,py37,pypy,pypy3,pre-commit
|
||||||
# These should match the travis env list
|
|
||||||
envlist = py27,py36,py37,pypy
|
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps = -rrequirements-dev.txt
|
deps = -rrequirements-dev.txt
|
||||||
passenv = LOCALAPPDATA
|
passenv = HOME LOCALAPPDATA
|
||||||
commands =
|
commands =
|
||||||
coverage erase
|
coverage erase
|
||||||
coverage run -m pytest {posargs:tests}
|
coverage run -m pytest {posargs:tests}
|
||||||
coverage report --fail-under 100
|
coverage report --fail-under 100
|
||||||
pre-commit run --all-files
|
pre-commit install
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:pre-commit]
|
||||||
envdir = venv-{[tox]project}
|
skip_install = true
|
||||||
commands =
|
deps = pre-commit
|
||||||
|
commands = pre-commit run --all-files --show-diff-on-failure
|
||||||
|
|
||||||
[pep8]
|
[pep8]
|
||||||
ignore = E265,E501,W504
|
ignore = E265,E501,W504
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue