Skip to content

Commit

Permalink
Migrate from Travis CI and Appveyor to Github Actions (#292)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
HannahSi and oliver-leung authored Feb 2, 2021
1 parent 9d42df4 commit 8121115
Show file tree
Hide file tree
Showing 11 changed files with 489 additions and 503 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build

on: [push, pull_request]

jobs:
test-python:
runs-on: ${{ matrix.os }}

strategy:
max-parallel: 4
matrix:
python-version: [3.8, 3.9]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev
- name: Run pytests and generate coverage report
run: |
pipenv run pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true

test-docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev
pip install sphinx_rtd_theme
- name: Run doctests and build html files
run: |
cd docs
pipenv run make doctest
make html
- name: Run html-proofer
uses: chabad360/htmlproofer@master
with:
directory: docs/build/html
arguments: --allow_hash_href --file_ignore "docs/build/html/search.html"
37 changes: 37 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Documentation

on:
push:
branches:
- 'master'

jobs:
publish_docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install sphinx_rtd_theme
- name: Build Sphinx documentation
run: |
cd docs
make html
- name: Publish Sphinx documentation
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html/
publish_branch: gh-pages
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to PyPi

on:
release:
types: [published]

jobs:
publish_package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Publish package to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
pyproject.toml

# Installer logs
pip-log.txt
Expand Down
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

7 changes: 3 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ pylint = "*"
pytest = "*"
pytest-cov = "*"
pytest-runner = "*"
atomicwrites = {version = ">=1.0", sys.platform = "win32"} # pytest dependency
colorama = {version = "*", sys.platform = "win32"} # pytest dependency
requests = ">=2.20.0" # Resolves security vulnerability
rope = "*"
Sphinx = "*"
sphinx_rtd_theme = "*"

[requires]
python_version = "3.6"
sphinx_rtd_theme = "*"
Loading

0 comments on commit 8121115

Please sign in to comment.