mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-09 12:54:17 +00:00
Merge pull request #368 from pre-commit/azure_pipelines
azure pipelines [skip travis] [skip appveyor]
This commit is contained in:
commit
5320b1cd59
10 changed files with 33 additions and 95 deletions
|
|
@ -6,7 +6,6 @@ omit =
|
||||||
.tox/*
|
.tox/*
|
||||||
/usr/*
|
/usr/*
|
||||||
setup.py
|
setup.py
|
||||||
get-git-lfs.py
|
|
||||||
|
|
||||||
[report]
|
[report]
|
||||||
show_missing = True
|
show_missing = True
|
||||||
|
|
|
||||||
22
.travis.yml
22
.travis.yml
|
|
@ -1,22 +0,0 @@
|
||||||
dist: xenial
|
|
||||||
language: python
|
|
||||||
matrix:
|
|
||||||
include: # These should match the tox env list
|
|
||||||
- env: TOXENV=py27
|
|
||||||
- env: TOXENV=py36
|
|
||||||
python: 3.6
|
|
||||||
- env: TOXENV=py37
|
|
||||||
python: 3.7
|
|
||||||
- env: TOXENV=pypy
|
|
||||||
python: pypy2.7-5.10.0
|
|
||||||
install: pip install coveralls tox
|
|
||||||
script: tox
|
|
||||||
before_install:
|
|
||||||
# Install git-lfs for a test
|
|
||||||
- './get-git-lfs.py && export PATH="/tmp/git-lfs:$PATH"'
|
|
||||||
after_success: coveralls
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/.cache/pip
|
|
||||||
- $HOME/.cache/pre-commit
|
|
||||||
- /tmp/git-lfs
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
[](https://travis-ci.org/pre-commit/pre-commit-hooks)
|
[](https://asottile.visualstudio.com/asottile/_build/latest?definitionId=17&branchName=master)
|
||||||
[](https://coveralls.io/github/pre-commit/pre-commit-hooks?branch=master)
|
[](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=17&branchName=master)
|
||||||
[](https://ci.appveyor.com/project/asottile/pre-commit-hooks/branch/master)
|
|
||||||
|
|
||||||
pre-commit-hooks
|
pre-commit-hooks
|
||||||
==========
|
================
|
||||||
|
|
||||||
Some out-of-the-box hooks for pre-commit.
|
Some out-of-the-box hooks for pre-commit.
|
||||||
|
|
||||||
|
|
|
||||||
17
appveyor.yml
17
appveyor.yml
|
|
@ -1,17 +0,0 @@
|
||||||
environment:
|
|
||||||
matrix:
|
|
||||||
- TOXENV: py27
|
|
||||||
- TOXENV: py37
|
|
||||||
|
|
||||||
install:
|
|
||||||
- "SET PATH=C:\\Python37;C:\\Python37\\Scripts;%PATH%"
|
|
||||||
- pip install tox
|
|
||||||
|
|
||||||
# Not a C# project
|
|
||||||
build: false
|
|
||||||
|
|
||||||
test_script: tox
|
|
||||||
|
|
||||||
cache:
|
|
||||||
- '%LOCALAPPDATA%\pip\cache'
|
|
||||||
- '%USERPROFILE%\.cache\pre-commit'
|
|
||||||
25
azure-pipelines.yml
Normal file
25
azure-pipelines.yml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include: [master, test-me-*]
|
||||||
|
|
||||||
|
resources:
|
||||||
|
repositories:
|
||||||
|
- repository: asottile
|
||||||
|
type: github
|
||||||
|
endpoint: asottile-github
|
||||||
|
name: asottile/azure-pipeline-templates
|
||||||
|
ref: refs/tags/v0.0.8
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- template: job--python-tox.yml@asottile
|
||||||
|
parameters:
|
||||||
|
toxenvs: [py27, py37]
|
||||||
|
os: windows
|
||||||
|
pre_test:
|
||||||
|
- script: git lfs
|
||||||
|
- template: job--python-tox.yml@asottile
|
||||||
|
parameters:
|
||||||
|
toxenvs: [pypy, py27, py36, py37]
|
||||||
|
os: linux
|
||||||
|
pre_test:
|
||||||
|
- script: git lfs
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
"""This is a script to install git-lfs to a tempdir for use in tests"""
|
|
||||||
import io
|
|
||||||
import os.path
|
|
||||||
import shutil
|
|
||||||
import tarfile
|
|
||||||
import urllib.request
|
|
||||||
from typing import cast
|
|
||||||
from typing import IO
|
|
||||||
|
|
||||||
DOWNLOAD_PATH = (
|
|
||||||
'https://github.com/github/git-lfs/releases/download/'
|
|
||||||
'v2.2.1/git-lfs-linux-amd64-2.2.1.tar.gz'
|
|
||||||
)
|
|
||||||
PATH_IN_TAR = 'git-lfs-2.2.1/git-lfs'
|
|
||||||
DEST_PATH = '/tmp/git-lfs/git-lfs'
|
|
||||||
DEST_DIR = os.path.dirname(DEST_PATH)
|
|
||||||
|
|
||||||
|
|
||||||
def main(): # type: () -> int
|
|
||||||
if (
|
|
||||||
os.path.exists(DEST_PATH) and
|
|
||||||
os.path.isfile(DEST_PATH) and
|
|
||||||
os.access(DEST_PATH, os.X_OK)
|
|
||||||
):
|
|
||||||
print('Already installed!')
|
|
||||||
return 0
|
|
||||||
|
|
||||||
shutil.rmtree(DEST_DIR, ignore_errors=True)
|
|
||||||
os.makedirs(DEST_DIR, exist_ok=True)
|
|
||||||
|
|
||||||
contents = io.BytesIO(urllib.request.urlopen(DOWNLOAD_PATH).read())
|
|
||||||
with tarfile.open(fileobj=contents) as tar:
|
|
||||||
with cast(IO[bytes], tar.extractfile(PATH_IN_TAR)) as src_file:
|
|
||||||
with open(DEST_PATH, 'wb') as dest_file:
|
|
||||||
shutil.copyfileobj(src_file, dest_file)
|
|
||||||
os.chmod(DEST_PATH, 0o755)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
exit(main())
|
|
||||||
|
|
@ -24,8 +24,6 @@ def cmd_output(*cmd, **kwargs): # type: (*str, **Any) -> str
|
||||||
proc = subprocess.Popen(cmd, **kwargs)
|
proc = subprocess.Popen(cmd, **kwargs)
|
||||||
stdout, stderr = proc.communicate()
|
stdout, stderr = proc.communicate()
|
||||||
stdout = stdout.decode('UTF-8')
|
stdout = stdout.decode('UTF-8')
|
||||||
if stderr is not None:
|
|
||||||
stderr = stderr.decode('UTF-8')
|
|
||||||
if retcode is not None and proc.returncode != retcode:
|
if retcode is not None and proc.returncode != retcode:
|
||||||
raise CalledProcessError(cmd, retcode, proc.returncode, stdout, stderr)
|
raise CalledProcessError(cmd, retcode, proc.returncode, stdout, stderr)
|
||||||
return stdout
|
return stdout
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import subprocess
|
import distutils.spawn
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
@ -67,8 +67,7 @@ def test_integration(temp_git_dir):
|
||||||
|
|
||||||
|
|
||||||
def has_gitlfs():
|
def has_gitlfs():
|
||||||
output = cmd_output('git', 'lfs', retcode=None, stderr=subprocess.STDOUT)
|
return distutils.spawn.find_executable('git-lfs') is not None
|
||||||
return 'git lfs status' in output
|
|
||||||
|
|
||||||
|
|
||||||
xfailif_no_gitlfs = pytest.mark.xfail(
|
xfailif_no_gitlfs = pytest.mark.xfail(
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ def f1_is_a_conflict_file(tmpdir):
|
||||||
cmd_output('git', 'init', '--', repo1.strpath)
|
cmd_output('git', 'init', '--', repo1.strpath)
|
||||||
with repo1.as_cwd():
|
with repo1.as_cwd():
|
||||||
repo1_f1.ensure()
|
repo1_f1.ensure()
|
||||||
cmd_output('git', 'add', '--', repo1_f1.strpath)
|
cmd_output('git', 'add', '.')
|
||||||
cmd_output('git', 'commit', '--no-gpg-sign', '-m', 'commit1')
|
cmd_output('git', 'commit', '--no-gpg-sign', '-m', 'commit1')
|
||||||
|
|
||||||
cmd_output('git', 'clone', repo1.strpath, repo2.strpath)
|
cmd_output('git', 'clone', repo1.strpath, repo2.strpath)
|
||||||
|
|
@ -77,7 +77,7 @@ def repository_pending_merge(tmpdir):
|
||||||
cmd_output('git', 'init', repo1.strpath)
|
cmd_output('git', 'init', repo1.strpath)
|
||||||
with repo1.as_cwd():
|
with repo1.as_cwd():
|
||||||
repo1_f1.ensure()
|
repo1_f1.ensure()
|
||||||
cmd_output('git', 'add', '--', repo1_f1.strpath)
|
cmd_output('git', 'add', '.')
|
||||||
cmd_output('git', 'commit', '--no-gpg-sign', '-m', 'commit1')
|
cmd_output('git', 'commit', '--no-gpg-sign', '-m', 'commit1')
|
||||||
|
|
||||||
cmd_output('git', 'clone', repo1.strpath, repo2.strpath)
|
cmd_output('git', 'clone', repo1.strpath, repo2.strpath)
|
||||||
|
|
@ -90,7 +90,7 @@ def repository_pending_merge(tmpdir):
|
||||||
# Commit in clone and pull without committing
|
# Commit in clone and pull without committing
|
||||||
with repo2.as_cwd():
|
with repo2.as_cwd():
|
||||||
repo2_f2.write('child\n')
|
repo2_f2.write('child\n')
|
||||||
cmd_output('git', 'add', '--', repo2_f2.strpath)
|
cmd_output('git', 'add', '.')
|
||||||
cmd_output('git', 'commit', '--no-gpg-sign', '-m', 'clone commit2')
|
cmd_output('git', 'commit', '--no-gpg-sign', '-m', 'clone commit2')
|
||||||
cmd_output('git', 'pull', '--no-commit', '--no-rebase')
|
cmd_output('git', 'pull', '--no-commit', '--no-rebase')
|
||||||
# We should end up in a pending merge
|
# We should end up in a pending merge
|
||||||
|
|
|
||||||
1
tox.ini
1
tox.ini
|
|
@ -1,5 +1,4 @@
|
||||||
[tox]
|
[tox]
|
||||||
# These should match the travis env list
|
|
||||||
envlist = py27,py36,py37,pypy3
|
envlist = py27,py36,py37,pypy3
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue