Skip to content

Commit 4b255c8

Browse files
authored
Move to Github actions (#102)
* Add GitHub actions workflow * Make tests executable from top-level directory. * Add codecov to install script. * Remove Travis configuration file.
1 parent b5c4263 commit 4b255c8

22 files changed

+338
-55
lines changed

.travis-data/install_script.sh renamed to .ci/install_script.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
# Be verbose, and stop with error as soon there's one
66
set -ev
77

8-
cd ${TRAVIS_BUILD_DIR}
9-
10-
pip install -U pip
8+
pip install codecov
9+
pip install -U pip setuptools wheel
1110

1211
case "$INSTALL_TYPE" in
1312
dev)
@@ -17,4 +16,8 @@ case "$INSTALL_TYPE" in
1716
python setup.py sdist
1817
ls -1 dist/ | xargs -I % pip install dist/%[dev]
1918
;;
19+
dev_bdist_wheel)
20+
python setup.py bdist_wheel
21+
ls -1 dist/ | xargs -I % pip install dist/%[dev]
22+
;;
2023
esac
File renamed without changes.

.coveragerc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[run]
2+
source = z2pack
3+
4+
[report]
5+
exclude_lines =
6+
# Ignore lines used only for mypy runs
7+
if ty\.TYPE_CHECKING:

.github/workflows/ci.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Continuous Integration
2+
3+
on: [push, pull_request]
4+
jobs:
5+
docs:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
python-version: [3.8]
10+
install-type: [dev]
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: Install apt dependencies
16+
run: |
17+
sudo apt update -qq
18+
sudo apt install -qq graphviz
19+
20+
- uses: actions/cache@v2
21+
with:
22+
path: ~/.cache/pip
23+
key: pip-${{ matrix.python-version }}-${{ matrix.install-type }}-${{ hashFiles('**/setup.json')
24+
}}
25+
restore-keys: pip-${{ matrix.python-version }}-${{ matrix.install-type }}
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Install the python project
33+
env:
34+
INSTALL_TYPE: ${{ matrix.install-type }}
35+
run: .ci/install_script.sh
36+
37+
- name: Build documentation
38+
env:
39+
READTHEDOCS: 'True'
40+
run: SPHINXOPTS='-nW' make -C doc html
41+
- uses: actions/upload-artifact@v2
42+
with:
43+
name: doc-build
44+
path: doc/build/html
45+
46+
pre-commit:
47+
runs-on: ubuntu-latest
48+
strategy:
49+
matrix:
50+
python-version: [3.8]
51+
install-type: [dev]
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v2
55+
56+
- name: Install apt dependencies
57+
run: |
58+
sudo apt update -qq
59+
sudo apt install -qq graphviz
60+
61+
- uses: actions/cache@v2
62+
with:
63+
path: ~/.cache/pip
64+
key: pip-${{ matrix.python-version }}-${{ matrix.install-type }}-${{ hashFiles('**/setup.json')
65+
}}
66+
restore-keys: pip-${{ matrix.python-version }}-${{ matrix.install-type }}
67+
68+
- name: Set up Python
69+
uses: actions/setup-python@v2
70+
with:
71+
python-version: ${{ matrix.python-version }}
72+
73+
- name: Install the python project
74+
env:
75+
INSTALL_TYPE: ${{ matrix.install-type }}
76+
run: .ci/install_script.sh
77+
78+
- name: Run pre-commit
79+
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1
80+
)
81+
tests:
82+
runs-on: ubuntu-latest
83+
strategy:
84+
matrix:
85+
python-version: [3.6, 3.7, 3.8]
86+
install-type: [dev]
87+
include:
88+
- python-version: 3.8
89+
install-type: dev_sdist
90+
- python-version: 3.8
91+
install-type: dev_bdist_wheel
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@v2
95+
96+
- name: Install apt dependencies
97+
run: |
98+
sudo apt update -qq
99+
sudo apt install -qq graphviz
100+
101+
- uses: actions/cache@v2
102+
with:
103+
path: ~/.cache/pip
104+
key: pip-${{ matrix.python-version }}-${{ matrix.install-type }}-${{ hashFiles('**/setup.json')
105+
}}
106+
restore-keys: pip-${{ matrix.python-version }}-${{ matrix.install-type }}
107+
108+
- name: Set up Python
109+
uses: actions/setup-python@v2
110+
with:
111+
python-version: ${{ matrix.python-version }}
112+
113+
- name: Install the python project
114+
env:
115+
INSTALL_TYPE: ${{ matrix.install-type }}
116+
run: .ci/install_script.sh
117+
118+
- name: Run pytest
119+
run: pytest --cov=z2pack --cov-config=.coveragerc
120+
- name: Run codecov
121+
run: codecov

.github/workflows_source/ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Continuous Integration
2+
3+
on: [push, pull_request]
4+
5+
_anchors:
6+
checkout: &CHECKOUT
7+
name: Checkout code
8+
uses: actions/checkout@v2
9+
10+
apt-dependencies: &APT_DEPENDENCIES
11+
name: Install apt dependencies
12+
run: |
13+
sudo apt update -qq
14+
sudo apt install -qq graphviz
15+
16+
pip-cache: &PIP_CACHE
17+
uses: actions/cache@v2
18+
with:
19+
path: ~/.cache/pip
20+
key: pip-${{ matrix.python-version }}-${{ matrix.install-type }}-${{ hashFiles('**/setup.json') }}
21+
restore-keys: pip-${{ matrix.python-version }}-${{ matrix.install-type }}
22+
23+
python-setup: &PYTHON_SETUP
24+
name: Set up Python
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
install-project: &INSTALL_PROJECT
30+
name: Install the python project
31+
env:
32+
INSTALL_TYPE: ${{ matrix.install-type }}
33+
run: .ci/install_script.sh
34+
35+
jobs:
36+
docs:
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
python-version: [3.8]
41+
install-type: [dev]
42+
steps:
43+
- *CHECKOUT
44+
- *APT_DEPENDENCIES
45+
- *PIP_CACHE
46+
- *PYTHON_SETUP
47+
- *INSTALL_PROJECT
48+
- name: Build documentation
49+
env:
50+
READTHEDOCS: "True"
51+
run: SPHINXOPTS='-nW' make -C doc html
52+
- uses: actions/upload-artifact@v2
53+
with:
54+
name: doc-build
55+
path: doc/build/html
56+
57+
pre-commit:
58+
runs-on: ubuntu-latest
59+
strategy:
60+
matrix:
61+
python-version: [3.8]
62+
install-type: [dev]
63+
steps:
64+
- *CHECKOUT
65+
- *APT_DEPENDENCIES
66+
- *PIP_CACHE
67+
- *PYTHON_SETUP
68+
- *INSTALL_PROJECT
69+
- name: Run pre-commit
70+
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
71+
tests:
72+
runs-on: ubuntu-latest
73+
strategy:
74+
matrix:
75+
python-version: [3.6, 3.7, 3.8]
76+
install-type: [dev]
77+
include:
78+
- python-version: 3.8
79+
install-type: dev_sdist
80+
- python-version: 3.8
81+
install-type: dev_bdist_wheel
82+
steps:
83+
- *CHECKOUT
84+
- *APT_DEPENDENCIES
85+
- *PIP_CACHE
86+
- *PYTHON_SETUP
87+
- *INSTALL_PROJECT
88+
- name: Run pytest
89+
run: pytest --cov=z2pack --cov-config=.coveragerc
90+
- name: Run codecov
91+
run: codecov

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ tests/.pytest_cache
5151
.pytest_cache/v/cache
5252
.coverage
5353
.coverage*
54+
!.coveragerc
5455
htmlcov
5556

5657
# editors

.pre-commit-config.yaml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,22 @@ repos:
55
- id: yapf
66
language: system
77

8-
- repo: git://github.com/guykisel/prospector-mirror
9-
rev: 7ff847e779347033ebbd9e3b88279e7f3a998b45
8+
- repo: local
109
hooks:
11-
- id: prospector
10+
- id: pylint
11+
name: pylint
12+
entry: pylint
1213
language: system
13-
exclude: '^(doc/)|(examples/)|(futures/)'
14+
types: [python]
15+
exclude: '^(doc/)|(examples/)|(futures/)|(utils/)'
16+
17+
- id: interpolate-workflows
18+
name: Interpolate Github workflows
19+
entry: python ./utils/interpolate_yaml_anchors.py
20+
language: system
21+
files: |
22+
(?x)^(
23+
.github/(.)*|
24+
utils/interpolate_yaml_anchors.py
25+
)$
26+
pass_filenames: false

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ confidence=
5050
# --enable=similarities". If you want to run only the classes checker, but have
5151
# no Warning level messages displayed, use"--disable=all --enable=classes
5252
# --disable=W"
53-
disable=too-few-public-methods,too-many-public-methods,bad-continuation,wrong-import-position,line-too-long,locally-disabled,wildcard-import,locally-enabled,too-many-instance-attributes,cyclic-import
53+
disable=too-few-public-methods,too-many-public-methods,bad-continuation,wrong-import-position,line-too-long,locally-disabled,wildcard-import,locally-enabled,too-many-instance-attributes,cyclic-import,duplicate-code
5454

5555
# Enable the message, report, category or checker with the given id(s). You can
5656
# either give multiple identifier separated by comma (,) or put this option

.travis.yml

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

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools >= 46.4.0", "wheel"]
3+
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)