Skip to content

Commit a781b46

Browse files
Add GitHub actions for testing (#108)
Replaces TravisCI and restores working CI.
1 parent 0312bc4 commit a781b46

File tree

9 files changed

+172
-65
lines changed

9 files changed

+172
-65
lines changed

.appveyor.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.coveragerc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ exclude_lines =
1010
if __name__ == .__main__.:
1111
ignore_errors = True
1212
omit =
13-
tests/*
13+
tests/*
14+
docs/*

.github/workflows/ci.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
lint:
11+
runs-on: ${{ matrix.platform }}
12+
strategy:
13+
matrix:
14+
platform: [ubuntu-latest]
15+
python-version: [3.9]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip setuptools wheel
28+
shell: bash
29+
30+
- name: Linter
31+
run: |
32+
python -m pip install flake8
33+
flake8 .
34+
35+
build_and_test_linux:
36+
runs-on: ${{ matrix.platform }}
37+
strategy:
38+
matrix:
39+
platform: [ubuntu-latest]
40+
python-version: [3.6, 3.7, 3.8, 3.9]
41+
42+
steps:
43+
- uses: actions/checkout@v2
44+
45+
- name: Set up Python ${{ matrix.python-version }}
46+
uses: actions/setup-python@v2
47+
with:
48+
python-version: ${{ matrix.python-version }}
49+
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade pip setuptools wheel bump2version twine
53+
shell: bash
54+
55+
- name: Linter
56+
run: |
57+
python -m pip install flake8
58+
flake8 .
59+
60+
- name: Build
61+
run: |
62+
python --version
63+
python setup.py sdist bdist_wheel
64+
twine check dist/*.whl
65+
twine check dist/*.tar.gz
66+
bump2version --dry-run --verbose --allow-dirty patch
67+
bump2version --dry-run --verbose --allow-dirty minor
68+
bump2version --dry-run --verbose --allow-dirty major
69+
70+
- name: Test
71+
run: |
72+
python -m pip install .
73+
script -q -e -c "python setup.py test"
74+
75+
test_macos:
76+
runs-on: ${{ matrix.platform }}
77+
strategy:
78+
matrix:
79+
platform: [macos-latest]
80+
python-version: [3.6, 3.7, 3.8, 3.9]
81+
82+
steps:
83+
- uses: actions/checkout@v2
84+
85+
- name: Set up Python ${{ matrix.python-version }}
86+
uses: actions/setup-python@v2
87+
with:
88+
python-version: ${{ matrix.python-version }}
89+
90+
- name: Install dependencies
91+
run: |
92+
python -m pip install --upgrade pip setuptools wheel
93+
brew install expect
94+
shell: bash
95+
96+
- name: Test Linux/MacOS
97+
run: |
98+
python -m pip install .
99+
unbuffer python setup.py test
100+
101+
# test_windows:
102+
# runs-on: ${{ matrix.platform }}
103+
# strategy:
104+
# matrix:
105+
# platform: [windows-latest]
106+
# python-version: [3.6, 3.7, 3.8, 3.9]
107+
108+
# steps:
109+
# - uses: actions/checkout@v2
110+
111+
# - name: Set up Python ${{ matrix.python-version }}
112+
# uses: actions/setup-python@v2
113+
# with:
114+
# python-version: ${{ matrix.python-version }}
115+
116+
# - name: Install dependencies
117+
# run: |
118+
# python -m pip install --upgrade pip setuptools wheel
119+
120+
# - name: Test Windows
121+
# run: |
122+
# python -m pip install .
123+
# Invoke-Expression 'python setup.py test'
124+
125+
coverage:
126+
runs-on: ${{ matrix.platform }}
127+
strategy:
128+
matrix:
129+
platform: [ubuntu-latest]
130+
python-version: [3.9]
131+
132+
steps:
133+
- uses: actions/checkout@v2
134+
135+
- name: Set up Python ${{ matrix.python-version }}
136+
uses: actions/setup-python@v2
137+
with:
138+
python-version: ${{ matrix.python-version }}
139+
140+
- name: Install dependencies
141+
run: |
142+
python -m pip install --upgrade pip setuptools wheel
143+
python -m pip install coverage
144+
145+
- name: Get Coverage
146+
run: |
147+
python -m pip install .
148+
script -q -e -c "coverage run setup.py test"
149+
150+
# from https://about.codecov.io/blog/
151+
# python-code-coverage-using-github-actions-and-codecov/
152+
- name: Upload Coverage to Codecov
153+
uses: codecov/codecov-action@v2
154+
with:
155+
fail_ci_if_error: true
156+
verbose: true

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# pdb-tools
22

33
[![PyPI version](https://badge.fury.io/py/pdb-tools.svg)](https://badge.fury.io/py/pdb-tools)
4-
[![Travis (.org) branch](https://img.shields.io/travis/haddocking/pdb-tools/master.svg?style=flat&label=TravisCI)](https://travis-ci.org/haddocking/pdb-tools)
5-
[![AppVeyor branch](https://img.shields.io/appveyor/ci/JoaoRodrigues/pdb-tools-2coq6.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/JoaoRodrigues/pdb-tools-2coq6)
4+
[![tests](https://github.com/haddocking/pdb-tools/workflows/tests/badge.svg?branch=master)](https://github.com/haddocking/pdb-tools/actions?workflow=tests)
65
[![codecov](https://codecov.io/gh/haddocking/pdb-tools/branch/master/graph/badge.svg)](https://codecov.io/gh/haddocking/pdb-tools)
76
[![DOI](https://zenodo.org/badge/27217350.svg)](https://doi.org/10.12688/f1000research.17456.1)
87

pdbtools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@
121121
'pdb_uniqname',
122122
'pdb_validate',
123123
'pdb_wc',
124-
]
124+
]

pdbtools/pdb_selaltloc.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
data to another. They are based on old FORTRAN77 code that was taking too much
4040
effort to maintain and compile. RIP.
4141
"""
42-
import operator
4342
import os
4443
import sys
4544

@@ -250,8 +249,8 @@ def is_another_altloc_group(
250249
resname,
251250
prev_resname,
252251
altloc_lines,
253-
rploc,
254-
):
252+
rploc
253+
):
255254
"""Detect if current line belongs to a new altloc group."""
256255
a0 = prev_altloc
257256
a1 = altloc
@@ -264,7 +263,7 @@ def is_another_altloc_group(
264263

265264
is_another = (
266265
all((a0, ra0, ru0)) and (
267-
(a0 != a1 and a1 == ' ' and ru1 > ru0)
266+
(a0 != a1 and a1 == ' ' and ru1 > ru0)
268267
or (a0 == ' ' and a1 != ' ' and ru1 > ru0)
269268
or (a0 == ' ' and a1 == ' ' and (ru1 != ru0 or ra1 != ra0))
270269
or (
@@ -274,9 +273,9 @@ def is_another_altloc_group(
274273
and ru1 > ru0
275274
and len(rl) > 1
276275
and all(len(v) == len(rv[0]) for v in rv[1:])
277-
)
278276
)
279277
)
278+
)
280279

281280
return is_another
282281

@@ -348,8 +347,8 @@ def flush_resloc_occ_same_residue(altloc_lines, **kw):
348347
for atom, linest in sorted_atoms:
349348
lines = linest[1]
350349

351-
atom_lines = [l for l in lines if l.startswith(("ATOM", "HETATM"))]
352-
anisou_lines = [l for l in lines if l.startswith(("ANISOU"))]
350+
atom_lines = [ln for ln in lines if ln.startswith(("ATOM", "HETATM"))]
351+
anisou_lines = [ln for ln in lines if ln.startswith(("ANISOU"))]
353352

354353
if anisou_lines:
355354
new = []
@@ -359,7 +358,7 @@ def flush_resloc_occ_same_residue(altloc_lines, **kw):
359358
"There is an error with this PDB. "
360359
"We expect one ANISOU line per ATOM/HETATM lines. "
361360
"But the number of ATOM/HETATM and ANISOU lines differ."
362-
)
361+
)
363362
raise ValueError(emsg)
364363

365364
for _a, _b in zip(atom_lines, anisou_lines):

pdbtools/pdb_tidy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ def make_TER(prev_line):
223223
in_model = True
224224
serial_offset = 0
225225

226-
227226
if serial > 99999:
228227
emsg = 'ERROR!! Structure contains more than 99.999 atoms.\n'
229228
sys.stderr.write(emsg)

tox.ini renamed to setup.cfg

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ exclude =
77
tests/,
88
setup.py
99

10-
# Ignore long lines and lambda warnings
11-
ignore = E501,E731
10+
# Ignore:
11+
# E501: long lines
12+
# E731: lambda warnings
13+
# W503/W504: line breaks before/after operators
14+
ignore = E501,E731,W503,W504
1215

1316
# Enable statistics at the end
1417
statistics = True
1518

16-
[testenv]
17-
passenv = TOXENV CI TRAVIS TRAVIS_*
18-
deps = codecov>=1.4.0
19-
commands = codecov -e TOXENV

0 commit comments

Comments
 (0)