azure pipelines [skip travis] [skip appveyor]

This commit is contained in:
Anthony Sottile 2019-03-10 13:42:05 -07:00
parent 8171e47eb2
commit 8bb94f0bd4
10 changed files with 33 additions and 95 deletions

View File

@ -6,7 +6,6 @@ omit =
.tox/*
/usr/*
setup.py
get-git-lfs.py
[report]
show_missing = True

View File

@ -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

View File

@ -1,9 +1,8 @@
[![Build Status](https://travis-ci.org/pre-commit/pre-commit-hooks.svg?branch=master)](https://travis-ci.org/pre-commit/pre-commit-hooks)
[![Coverage Status](https://coveralls.io/repos/github/pre-commit/pre-commit-hooks/badge.svg?branch=master)](https://coveralls.io/github/pre-commit/pre-commit-hooks?branch=master)
[![Build status](https://ci.appveyor.com/api/projects/status/dfcpng35u4g0r0t1/branch/master?svg=true)](https://ci.appveyor.com/project/asottile/pre-commit-hooks/branch/master)
[![Build Status](https://asottile.visualstudio.com/asottile/_apis/build/status/pre-commit.pre-commit-hooks?branchName=master)](https://asottile.visualstudio.com/asottile/_build/latest?definitionId=17&branchName=master)
[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/asottile/asottile/17/master.svg)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=17&branchName=master)
pre-commit-hooks
==========
================
Some out-of-the-box hooks for pre-commit.

View File

@ -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
View 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

View File

@ -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())

View File

@ -24,8 +24,6 @@ def cmd_output(*cmd, **kwargs): # type: (*str, **Any) -> str
proc = subprocess.Popen(cmd, **kwargs)
stdout, stderr = proc.communicate()
stdout = stdout.decode('UTF-8')
if stderr is not None:
stderr = stderr.decode('UTF-8')
if retcode is not None and proc.returncode != retcode:
raise CalledProcessError(cmd, retcode, proc.returncode, stdout, stderr)
return stdout

View File

@ -1,7 +1,7 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import subprocess
import distutils.spawn
import pytest
@ -67,8 +67,7 @@ def test_integration(temp_git_dir):
def has_gitlfs():
output = cmd_output('git', 'lfs', retcode=None, stderr=subprocess.STDOUT)
return 'git lfs status' in output
return distutils.spawn.find_executable('git-lfs') is not None
xfailif_no_gitlfs = pytest.mark.xfail(

View File

@ -22,7 +22,7 @@ def f1_is_a_conflict_file(tmpdir):
cmd_output('git', 'init', '--', repo1.strpath)
with repo1.as_cwd():
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', 'clone', repo1.strpath, repo2.strpath)
@ -77,7 +77,7 @@ def repository_pending_merge(tmpdir):
cmd_output('git', 'init', repo1.strpath)
with repo1.as_cwd():
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', 'clone', repo1.strpath, repo2.strpath)
@ -90,7 +90,7 @@ def repository_pending_merge(tmpdir):
# Commit in clone and pull without committing
with repo2.as_cwd():
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', 'pull', '--no-commit', '--no-rebase')
# We should end up in a pending merge

View File

@ -1,5 +1,4 @@
[tox]
# These should match the travis env list
envlist = py27,py36,py37,pypy3
[testenv]