Skip to content

Commit 503765c

Browse files
author
Manuel
committed
Update CI/CD
- run tests with tox - build docu with tox - run example scripts using tox - run codecoverage using tox - configure travis to use tox envs - configure appveyor to use tox envs - configure travis to deploy package to pypi on tag - update .gitignore - update requirements, docs/requirements and add requirements_dev - codecov will post change in coverage under pull requests - add pre-commit config to run common style fixes and black
1 parent 065e16f commit 503765c

File tree

9 files changed

+269
-27
lines changed

9 files changed

+269
-27
lines changed

.appveyor.yml

Lines changed: 124 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,129 @@
1+
# environment:
2+
# matrix:
3+
# - PYTHON: "C:\\Python35-x64"
4+
# TOXENV: "py35"
5+
# PYTHON_HOME: C:/Python35
6+
# PYTHON_VERSION: '3.5'
7+
# PYTHON_ARCH: '64'
8+
# TOXPYTHON: C:\Python35\python.exe
9+
10+
# - PYTHON: "C:\\Python36-x64"
11+
# TOXENV: "py36"
12+
# PYTHON_HOME: C:/Python36
13+
# PYTHON_VERSION: '3.6'
14+
# PYTHON_ARCH: '64'
15+
# TOXPYTHON: C:\Python36\python.exe
16+
17+
# - PYTHON: "C:\\Python37-x64"
18+
# TOXENV: "py37"
19+
# PYTHON_HOME: C:/Python37
20+
# PYTHON_VERSION: '3.7'
21+
# PYTHON_ARCH: '64'
22+
# TOXPYTHON: C:\Python37\python.exe
23+
24+
# - PYTHON: "C:\\Python37-x64"
25+
# TOXENV: "docu"
26+
# PYTHON_HOME: C:\Python37
27+
# PYTHON_VERSION: '3.7'
28+
# PYTHON_ARCH: '64'
29+
# TOXPYTHON: C:\Python37\python.exe
30+
31+
# - PYTHON: "C:\\Python37-x64"
32+
# TOXENV: "example_scripts"
33+
# PYTHON_HOME: C:/Python37
34+
# PYTHON_VERSION: '3.7'
35+
# PYTHON_ARCH: '64'
36+
# TOXPYTHON: C:\Python37\python.exe
37+
38+
# install:
39+
# - cmd: "%PYTHON%\\python.exe setup.py install"
40+
# - cmd: "%PYTHON%/Scripts/pip.exe install numpy"
41+
# - cmd: "%PYTHON%/Scripts/pip.exe install -r requirements.txt"
42+
# - cmd: "%PYTHON%/Scripts/tox"
43+
44+
# build: off
45+
46+
47+
148
environment:
49+
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
50+
# /E:ON and /V:ON options are not enabled in the batch script intepreter
51+
# See: http://stackoverflow.com/a/13751649/163740
52+
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
53+
# TOX_ENV: "pywin"
54+
255
matrix:
3-
- PYTHON: "C:\\Python36-x64"
56+
# - PYTHON: "C:\\Python35-x64"
57+
# PYTHON_VERSION: '3.5'
58+
# PYTHON_ARCH: '64'
59+
# TOXENV: "py35"
60+
# # PYTHON_HOME: C:\Python35
61+
# # TOXPYTHON: C:\Python35-x64\python.exe
62+
63+
# - PYTHON: "C:\\Python36-x64"
64+
# PYTHON_VERSION: '3.6'
65+
# PYTHON_ARCH: '64'
66+
# TOXENV: "py36"
67+
# # PYTHON_HOME: C:\Python36
68+
# # TOXPYTHON: C:\Python36-x64\python.exe
69+
70+
- PYTHON: "C:\\Python37-x64"
71+
PYTHON_VERSION: '3.7'
72+
PYTHON_ARCH: '64'
73+
TOXENV: "py37"
74+
# PYTHON_HOME: C:\Python37
75+
# TOXPYTHON: C:\Python37-x64\python.exe
76+
77+
- PYTHON: "C:\\Python37-x64"
78+
PYTHON_VERSION: '3.7'
79+
PYTHON_ARCH: '64'
80+
TOXENV: "docu"
81+
82+
- PYTHON: "C:\\Python37-x64"
83+
PYTHON_VERSION: '3.7'
84+
PYTHON_ARCH: '64'
85+
TOXENV: "example_scripts"
86+
# PYTHON_HOME: C:\Python37
87+
# TOXPYTHON: C:\Python37-x64\python.exe
88+
89+
90+
init:
91+
- ps: echo $env:TOXENV
92+
- ps: echo $env:PYTHON_HOME
93+
- ps: ls C:\Python*
494

595
install:
6-
- cmd: "%PYTHON%\\python.exe setup.py install"
7-
- cmd: "%PYTHON%/Scripts/pip.exe install numpy"
8-
- cmd: "%PYTHON%/Scripts/pip.exe install -r requirements.txt"
9-
- cmd: "%PYTHON%/Scripts/nosetests.exe"
96+
# - python -u ci\appveyor-bootstrap.py
97+
# Download setup scripts and unzip
98+
- ps: "wget https://github.com/cloudify-cosmo/appveyor-utils/archive/master.zip -OutFile ./master.zip"
99+
- "7z e master.zip */appveyor/* -oappveyor"
100+
101+
# Install Python (from the official .msi of http://python.org) and pip when
102+
# not already installed.
103+
- "powershell ./appveyor/install.ps1"
104+
105+
# Prepend newly installed Python to the PATH of this build (this cannot be
106+
# done from inside the powershell script as it would require to restart
107+
# the parent CMD process).
108+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
109+
110+
# Check that we have the expected version and architecture for Python
111+
- "python --version"
112+
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
113+
114+
115+
build: false # Not a C# project, build stuff at the test step instead.
116+
117+
before_test:
118+
- "%CMD_IN_ENV% pip install tox"
119+
- ps: 'ls C:\Python35\Scripts'
120+
121+
test_script:
122+
- "%CMD_IN_ENV% tox -e %TOXENV%"
123+
124+
# on_failure:
125+
# - ps: dir "env:"
126+
# - ps: get-content .tox\*\log\*
10127

11-
build: off
128+
artifacts:
129+
- path: dist\*

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ test.dat
1313
*.html
1414
dist
1515
*.log
16+
.coverage
17+
.scannerwork
18+
.tox
19+
pymzml.egg-info
20+
docs/source/code_inc/

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.1.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: debug-statements
9+
- repo: https://github.com/ambv/black
10+
rev: 18.9b0
11+
hooks:
12+
- id: black
13+
language_version: python
14+
exclude: ^docs/, ^tests/

.travis.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
language: python
22
python:
3-
- "3.4"
4-
- "3.5"
5-
- "3.6"
3+
- '3.6'
64
sudo: false
7-
8-
before_install: pip install codecov
9-
after_success: codecov
10-
11-
install:
12-
- pip install -r requirements.txt
13-
14-
script: nosetests --with-coverage
5+
branches:
6+
only:
7+
- master
8+
matrix:
9+
include:
10+
- python: 3.5
11+
env: TOXENV=py35
12+
- python: 3.6
13+
env: TOXENV=py36
14+
- python: 3.7
15+
env: TOXENV=py37
16+
dist: xenial
17+
- python: 3.6
18+
env: TOXENV=docu
19+
- python: 3.6
20+
env: TOXENV=coverage
21+
- python: 3.6
22+
env: TOXENV=example_scripts
23+
script:
24+
echo
25+
deploy:
26+
provider: pypi
27+
user: pyratez
28+
password:
29+
secure: HKI1+vjzjYohYeLFC9BmlZGmpG5Y0zbBiwHjTvTI4Uy6g3KrmP+Lkj2Ean+r9LVrzghcLWu7ze4mN+33jR4ke2DLpryFSQCP3+V1GLBuNk4SYfFmE9VKcGhSmPrHWEgClj1BK6jV5Fiun2dqGcj3oCFXMXiqPLuqlzmYh1MtSG3OefRMUAb1jFz2griQYDVa+qmU7LSHj9oCzJqo6NID1pt/V9vXXl2J+F1zY7Ag7dWbcKFbiPT30rIo2BLvPCQl9XjEvOudixbsvaOPAvD9Cdl5xU9BtieHhBJEBhV+oUiT0fuee0hbEW1mVLg/N8vSpbWxbXoSosZoVCVRzYzl1o+33y85zCjdTECPkiTyEVjhJ8HlWWQie5CKFT04jLypA3RgR9ms+SEmx4v49tvuorVZCosJrF5J0JCD29PBu1gKOL0Mpy3ysUf4veytaYhgJMqBldJTk0LHwfR/hCHX+kFQbZPY/Ge5TyA3NXdfSYeJA5tBqVcXAQprKvGJmKcjyEPUhO5JgX/A0kMussyNyvguTE4oW7CSoErSEQcOgwPkej7DhurqLaYI/C6unFpGBT/YBbR6Isv4YOD8KSzyxpJqmTsRgZohn/Wnn5IfeoxqVoVTSdEW/qQ3LJMRMpUvwcDLQGtW/2X3eaXZI54BNO5zdXWniSuxaPHUBBiv2DE=
30+
distributions: sdist bdist_wheel bdist_egg
31+
on:
32+
tags: true

codecov.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
codecov:
2+
notify:
3+
require_ci_to_pass: yes
4+
coverage:
5+
precision: 2
6+
round: down
7+
range: "70...100"
8+
9+
status:
10+
project: yes
11+
patch: yes
12+
changes: no
13+
14+
parsers:
15+
gcov:
16+
branch_detection:
17+
conditional: True
18+
loop: True
19+
method: False
20+
changes: False
21+
macro: False
22+
23+
comment:
24+
layout: "head, diff"
25+
behaviour: default
26+
require_change: no
27+

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
sphinx >= 1.3.0
22
sphinx_rtd_theme >= 0.1.9
3+
regex

requirements.txt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
# Installation
2-
numpy >= 1.8.0
3-
plotly < 2.0
2+
numpy
3+
plotly
44
pynumpress >= 0.0.4
55
regex
6-
7-
# Testing and dev
8-
cython
9-
coverage >= 4.2
10-
nose >= 1.3.7
11-
sphinx
12-
sphinx_rtd_theme
13-
6+
tox

requirements_dev.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# install requirements
2+
-r requirements.txt
3+
4+
# Testing and Development
5+
cython
6+
coverage >= 4.2
7+
codecov
8+
pytest
9+
tox
10+
regex

tox.ini

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[tox]
2+
envlist = py35,py36,py37,coverage,example_scripts,docu
3+
4+
[testenv]
5+
deps =
6+
numpy
7+
pytest
8+
whitelist_externals = pytest
9+
commands =
10+
pip install -r {toxinidir}/requirements_dev.txt
11+
pytest tests/
12+
13+
[testenv:docu]
14+
whitelist_externals =
15+
make
16+
/bin/bash
17+
/usr/bin/bash
18+
deps =
19+
-Ur{toxinidir}/docs/requirements.txt
20+
changedir = {toxinidir}/docs
21+
commands =
22+
sphinx-build source build
23+
sphinx-build -b latex source build
24+
25+
#[testenv:format]
26+
#deps =
27+
# black
28+
#commands =
29+
# #pycodestyle -qq --statistics --count --ignore=E221,E203,E402 --max-line-length=90 pymzml
30+
# black --check pymzml
31+
32+
[testenv:coverage]
33+
passenv =
34+
CI TRAVIS TRAVIS_*
35+
deps =
36+
numpy
37+
commands =
38+
pip install -e .
39+
pip install -q -r {toxinidir}/requirements_dev.txt
40+
coverage erase
41+
coverage run {envbindir}/pytest
42+
coverage report --omit=".tox/*","tests/*"
43+
codecov
44+
45+
[testenv:example_scripts]
46+
deps =
47+
numpy
48+
commands =
49+
pip install -Ur{toxinidir}/requirements.txt
50+
python example_scripts/access_run_info.py
51+
python example_scripts/compare_spectra.py
52+
python example_scripts/extract_ion_chromatogram.py
53+
python example_scripts/extreme_values.py
54+
python example_scripts/get_precursors.py
55+
python example_scripts/has_peak.py
56+
python example_scripts/highest_peaks.py

0 commit comments

Comments
 (0)