Skip to content

Commit 8121115

Browse files
Migrate from Travis CI and Appveyor to Github Actions (#292)
* Update pythonpackage.yml * use pipenv instead of requirements.txt in workflow * disable flake8 * activate virtual environment * run pytest in virtualenv * install development dependencies * run pytest in virtualenv again * Add documentation workflow * Added codecov action * add coverage report flag * add push, docs, and publish workflows * use html-proofer action * fix syntax error * fix syntax again * install sphinx and sphinx_rtd_theme * remove pipenv from make html * check directories in docs * switch html-proofer args order * add quotes to html-proofer args * modify search.html path * test runners, docs.yml, publish.yml * require python >=3.6 * update Pipfile.lock and publish.yml * move python requirement to setup.py * require python >=3.8 * temporarily remove windows runner * remove TODO * bump version and delete .travis.yml * add windows dependencies for pytest * add windows runner * remove appveyor * ignore pyproject.toml Co-authored-by: Oliver Leung <oal22@cornell.edu>
1 parent 9d42df4 commit 8121115

11 files changed

Lines changed: 489 additions & 503 deletions

File tree

.github/workflows/build.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test-python:
7+
runs-on: ${{ matrix.os }}
8+
9+
strategy:
10+
max-parallel: 4
11+
matrix:
12+
python-version: [3.8, 3.9]
13+
os: [ubuntu-latest, windows-latest, macOS-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install pipenv
27+
pipenv install --dev
28+
29+
- name: Run pytests and generate coverage report
30+
run: |
31+
pipenv run pytest --cov=./ --cov-report=xml
32+
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v1
35+
with:
36+
fail_ci_if_error: true
37+
38+
test-docs:
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- uses: actions/checkout@v2
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: 3.9
48+
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
pip install pipenv
53+
pipenv install --dev
54+
pip install sphinx_rtd_theme
55+
56+
- name: Run doctests and build html files
57+
run: |
58+
cd docs
59+
pipenv run make doctest
60+
make html
61+
62+
- name: Run html-proofer
63+
uses: chabad360/htmlproofer@master
64+
with:
65+
directory: docs/build/html
66+
arguments: --allow_hash_href --file_ignore "docs/build/html/search.html"

.github/workflows/docs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
publish_docs:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.9
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install sphinx_rtd_theme
24+
25+
- name: Build Sphinx documentation
26+
run: |
27+
cd docs
28+
make html
29+
30+
- name: Publish Sphinx documentation
31+
uses: peaceiris/actions-gh-pages@v3
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: docs/build/html/
35+
publish_branch: gh-pages
36+
user_name: 'github-actions[bot]'
37+
user_email: 'github-actions[bot]@users.noreply.github.com'

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to PyPi
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish_package:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.9
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install setuptools wheel
23+
24+
- name: Build package
25+
run: |
26+
python setup.py sdist bdist_wheel
27+
28+
- name: Publish package to PyPI
29+
if: startsWith(github.ref, 'refs/tags')
30+
uses: pypa/gh-action-pypi-publish@master
31+
with:
32+
user: __token__
33+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ var/
7373
*.egg-info/
7474
.installed.cfg
7575
*.egg
76+
pyproject.toml
7677

7778
# Installer logs
7879
pip-log.txt

.travis.yml

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

Pipfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ pylint = "*"
2121
pytest = "*"
2222
pytest-cov = "*"
2323
pytest-runner = "*"
24+
atomicwrites = {version = ">=1.0", sys.platform = "win32"} # pytest dependency
25+
colorama = {version = "*", sys.platform = "win32"} # pytest dependency
2426
requests = ">=2.20.0" # Resolves security vulnerability
2527
rope = "*"
2628
Sphinx = "*"
27-
sphinx_rtd_theme = "*"
28-
29-
[requires]
30-
python_version = "3.6"
29+
sphinx_rtd_theme = "*"

0 commit comments

Comments
 (0)