Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Workflow #216

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
ignore = E231,W504,F405,F403
max-line-length = 79
ignore = E231,W504,F405,F403,W503
max-line-length = 120
select = B,C,E,F,W,T4,B9
exclude =
docs/source/conf.py,
Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Tests

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
name: 'Python ${{ matrix.python-version }}'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: "2.7"
tox-env: "py27"
- python-version: "3.6"
tox-env: "py36"
- python-version: "3.7"
tox-env: "py37"
- python-version: "3.8"
tox-env: "py38"
- python-version: "3.9"
tox-env: "py39"
- python-version: "3.10"
tox-env: "py310"
env:
TOXENV: "${{ matrix.tox-env }}"

steps:
- uses: actions/checkout@v3
- name: 'Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v3
with:
python-version: '${{ matrix.python-version }}'
- name: Install System dependencies
run: |
sudo apt update
sudo apt install -y libosmesa6-dev freeglut3-dev
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-wheel
- name: Test with tox
run: |
if [ "${{ matrix.tox-env }}" == "py27" ]; then
tox
else
tox -- coveralls --service=github
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.7"
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libosmesa6-dev freeglut3-dev
python -m pip install --upgrade pip
python -m pip install tox
- name: Linting
run: |
tox -e linting
- name: Docs
run: |
tox -e docs

deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [build, checks]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.7"
- name: Build package
run: |
python -m pip install --upgrade pip setuptools
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish package to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
repos:
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.1
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
exclude: ^setup.py
- repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black
args: [--safe, --quiet]
1 change: 1 addition & 0 deletions docs/source/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_build/