mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-12 20:10:21 -06:00
azure pipelines [skip travis] [skip appveyor]
This commit is contained in:
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://coveralls.io/github/pre-commit/pre-commit?branch=master)
|
||||
[](https://ci.appveyor.com/project/asottile/pre-commit/branch/master)
|
||||
[](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=21&branchName=master)
|
||||
[](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=21&branchName=master)
|
||||
|
||||
## 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)
|
||||
|
||||
|
||||
def get_env_patch(venv):
|
||||
def get_env_patch(venv): # pragma: windows no cover
|
||||
if sys.platform == 'cygwin': # pragma: no cover
|
||||
_, win_venv, _ = cmd_output('cygpath', '-w', venv)
|
||||
install_prefix = r'{}\bin'.format(win_venv.strip())
|
||||
@@ -41,12 +41,14 @@ def get_env_patch(venv):
|
||||
|
||||
|
||||
@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))):
|
||||
yield
|
||||
|
||||
|
||||
def install_environment(prefix, version, additional_dependencies):
|
||||
def install_environment(
|
||||
prefix, version, additional_dependencies,
|
||||
): # pragma: windows no cover
|
||||
additional_dependencies = tuple(additional_dependencies)
|
||||
assert prefix.exists('package.json')
|
||||
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):
|
||||
return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
|
||||
|
||||
@@ -109,15 +109,15 @@ def norm_version(version):
|
||||
if _sys_executable_matches(version):
|
||||
return sys.executable
|
||||
|
||||
version_exec = _find_by_py_launcher(version)
|
||||
if version_exec:
|
||||
return version_exec
|
||||
|
||||
# Try looking up by name
|
||||
version_exec = find_executable(version)
|
||||
if version_exec and version_exec != version:
|
||||
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
|
||||
# place on windows
|
||||
if version.startswith('python'):
|
||||
|
||||
@@ -30,8 +30,8 @@ def cmd_output_mocked_pre_commit_home(*args, **kwargs):
|
||||
|
||||
|
||||
skipif_cant_run_docker = pytest.mark.skipif(
|
||||
docker_is_running() is False,
|
||||
reason='Docker isn\'t running or can\'t be accessed',
|
||||
os.name == 'nt' or not docker_is_running(),
|
||||
reason="Docker isn't running or can't be accessed",
|
||||
)
|
||||
|
||||
skipif_cant_run_swift = pytest.mark.skipif(
|
||||
|
||||
@@ -145,7 +145,7 @@ def test_argument_too_long():
|
||||
def test_xargs_smoke():
|
||||
ret, out, err = xargs.xargs(('echo',), ('hello', 'world'))
|
||||
assert ret == 0
|
||||
assert out == b'hello world\n'
|
||||
assert out.replace(b'\r\n', b'\n') == b'hello world\n'
|
||||
assert err == b''
|
||||
|
||||
|
||||
|
||||
15
tox.ini
15
tox.ini
@@ -1,20 +1,19 @@
|
||||
[tox]
|
||||
project = pre_commit
|
||||
# These should match the travis env list
|
||||
envlist = py27,py36,py37,pypy
|
||||
envlist = py27,py36,py37,pypy,pypy3,pre-commit
|
||||
|
||||
[testenv]
|
||||
deps = -rrequirements-dev.txt
|
||||
passenv = LOCALAPPDATA
|
||||
passenv = HOME LOCALAPPDATA
|
||||
commands =
|
||||
coverage erase
|
||||
coverage run -m pytest {posargs:tests}
|
||||
coverage report --fail-under 100
|
||||
pre-commit run --all-files
|
||||
pre-commit install
|
||||
|
||||
[testenv:venv]
|
||||
envdir = venv-{[tox]project}
|
||||
commands =
|
||||
[testenv:pre-commit]
|
||||
skip_install = true
|
||||
deps = pre-commit
|
||||
commands = pre-commit run --all-files --show-diff-on-failure
|
||||
|
||||
[pep8]
|
||||
ignore = E265,E501,W504
|
||||
|
||||
Reference in New Issue
Block a user