Browse Source

Use tox in CI (#37)

* Use tox in CI
anonswap
Ofek Lev 6 years ago
committed by GitHub
parent
commit
9f97b16c77
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      .coveragerc
  2. 140
      .travis.yml
  3. 4
      .travis/deploy.sh
  4. 19
      pyproject.toml
  5. 3
      requirements-dev.txt
  6. 25
      tox.ini

22
.coveragerc

@ -1,10 +1,28 @@
[run]
branch = True
source =
coincurve
tests
branch = True
omit =
*/_windows_libsecp256k1.py
*/test_bench.py
[paths]
source =
coincurve
.tox/*/lib/python*/site-packages/coincurve
.tox/pypy*/site-packages/coincurve
[report]
exclude_lines =
pragma: no cover
no cov
no qa
# Ignore missing debug-only code
def __repr__
if self\.debug
# Ignore non-runnable code
if __name__ == .__main__.:

140
.travis.yml

@ -1,86 +1,90 @@
sudo: true
dist: xenial
language: python
python:
- '2.7'
- '3.5'
- '3.6'
- 'pypy3'
cache:
directories:
- $HOME/.cache/pip
# Only build master, release branches, and version tags (which are considered
# branches by Travis, see https://github.com/travis-ci/travis-ci/issues/8518)
branches:
only:
- master
- /^release.+$/
# https://github.com/travis-ci/travis-ci/issues/8518
- /^[0-9]+\.[0-9]+\.[0-9]+.*$/
env:
global:
- LD_LIBRARY_PATH=./libsecp256k1_ext/.libs
- DYLD_FALLBACK_LIBRARY_PATH=./libsecp256k1_ext/.libs
- LIB_DIR=./libsecp256k1_ext/.libs
- INCLUDE_DIR=./libsecp256k1_ext/include
- PYPI_USERNAME=Ofekmeister
cache:
directories:
- $HOME/.cache/pip
- $HOME/.cache/python-dl
matrix:
include:
- python: 3.7
dist: xenial
sudo: true
- os: osx
language: generic
osx_image: xcode10.1
python: 2.7
env:
- TRAVIS_PYTHON_VERSION=2.7
- os: osx
language: generic
osx_image: xcode10.1
python: 3.5
env:
- TRAVIS_PYTHON_VERSION=3.5
- os: osx
language: generic
osx_image: xcode10.1
python: 3.6
env:
- NEED_SSL_FIX=true
- TRAVIS_PYTHON_VERSION=3.6
- os: osx
language: generic
osx_image: xcode10.1
python: 3.7
env:
- TRAVIS_PYTHON_VERSION=3.7
- os: linux
language: python
python: 3.5
sudo: required
services:
- docker
env:
- BUILD_LINUX_WHEELS=1
- LD_LIBRARY_PATH=./libsecp256k1_ext/.libs
- DYLD_FALLBACK_LIBRARY_PATH=./libsecp256k1_ext/.libs
- LIB_DIR=./libsecp256k1_ext/.libs
- INCLUDE_DIR=./libsecp256k1_ext/include
- PYPI_USERNAME=Ofekmeister
addons:
apt:
packages:
- git
- libtool
- autoconf
- automake
- pkg-config
- libffi-dev
- libgmp-dev
- autoconf
- automake
- git
- libffi-dev
- libgmp-dev
- libtool
- pkg-config
matrix:
include:
# - python: 3.7
# env: TOXENV=style
- python: 2.7
env: TOXENV=py27
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
- python: pypy3
env: TOXENV=pypy3
# PyPy3 isn't yet available for Xenial
dist: trusty
- os: osx
language: generic
osx_image: xcode10.1
python: 2.7
env: TOXENV=py27 TRAVIS_PYTHON_VERSION=2.7
- os: osx
language: generic
osx_image: xcode10.1
python: 3.5
env: TOXENV=py35 TRAVIS_PYTHON_VERSION=3.5
- os: osx
language: generic
osx_image: xcode10.1
python: 3.6
env: TOXENV=py36 TRAVIS_PYTHON_VERSION=3.6 NEED_SSL_FIX=true
- os: osx
language: generic
osx_image: xcode10.1
python: 3.7
env: TOXENV=py37 TRAVIS_PYTHON_VERSION=3.7
- os: linux
language: python
python: 3.5
sudo: required
services:
- docker
env: TOXENV=py35 BUILD_LINUX_WHEELS=1
before_install:
- chmod +x .travis/prepare_windows_build.sh .travis/build_windows_wheels.sh
- .travis/prepare_windows_build.sh
- source .travis/install.sh
- chmod +x .travis/prepare_windows_build.sh .travis/build_windows_wheels.sh
- .travis/prepare_windows_build.sh
- source .travis/install.sh
install:
- python setup.py install
- pip install tox
script:
- mv coincurve _coincurve
- coverage run --parallel --include="*/site-packages/*.egg/coincurve/*" -m py.test
- mv _coincurve coincurve
- coverage combine
- tox
deploy:
- provider: script

4
.travis/deploy.sh

@ -4,7 +4,9 @@ set -e -x
echo "deploy"
# remove left over files from previous steps
python setup.py install
# remove any left over files from previous steps
rm -rf build dist
mkdir dist

19
pyproject.toml

@ -0,0 +1,19 @@
[tool.black]
line-length = 120
py36 = false
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| build
| dist
)/
'''

3
requirements-dev.txt

@ -0,0 +1,3 @@
coverage
pytest
pytest-benchmark

25
tox.ini

@ -2,11 +2,28 @@
skip_missing_interpreters = true
envlist =
py{27,35,36,37},
pypy3
pypy3,
bench,
style
[testenv]
usedevelop = true
passenv = *
deps =
pytest>=2.8.7
-rrequirements-dev.txt
commands =
pytest {posargs:}
python -c "import shutil; shutil.move('coincurve', '_coincurve')"
coverage run --parallel-mode -m pytest -v --benchmark-skip {posargs}
python -c "import shutil; shutil.move('_coincurve', 'coincurve')"
coverage combine
coverage report -m
[testenv:bench]
commands =
python -c "import shutil; shutil.move('coincurve', '_coincurve')"
pytest -v --benchmark-only --benchmark-cprofile=tottime
python -c "import shutil; shutil.move('_coincurve', 'coincurve')"
[testenv:style]
skip_install = true
deps = black
commands = black --check .

Loading…
Cancel
Save