Skip to content

Commit

Permalink
Setup GH Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jpadilla committed Jun 19, 2020
1 parent dc8dc7d commit 78c1af4
Show file tree
Hide file tree
Showing 11 changed files with 234 additions and 322 deletions.
7 changes: 2 additions & 5 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[flake8]
ignore = E203, E266, E501, W503
max-line-length = 80
max-complexity = 18
select = B,C,E,F,W,T4,B9
exclude = docs/conf.py,.tox
max-line-length = 79
extend-ignore = E203, E501
105 changes: 76 additions & 29 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,87 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package
---
name: CI

on:
push:
branches: [ master ]
branches: ["master"]
pull_request:
branches: [ master ]
branches: ["master"]
# Allow rebuilds via API.
repository_dispatch:
types: rebuild

jobs:
build:
tests:
name: "Python ${{ matrix.python-version }} on ${{ matrix.platform }}"
runs-on: "${{ matrix.platform }}"
env:
USING_COVERAGE: '3.8'

strategy:
matrix:
platform: ["ubuntu-latest", "windows-latest"]
python-version: ["3.5", "3.6", "3.7", "3.8"]

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: |
python -VV
python -m site
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions
- name: "Run tox targets for ${{ matrix.python-version }}"
run: "python -m tox"
env:
PLATFORM: ${{ matrix.platform }}

runs-on: ubuntu-latest
- name: "Combine coverage"
run: |
python -m coverage combine
python -m coverage xml
if: "contains(env.USING_COVERAGE, matrix.python-version) && matrix.platform == 'ubuntu-latest'"
- name: "Upload coverage to Codecov"
if: "contains(env.USING_COVERAGE, matrix.python-version) && matrix.platform == 'ubuntu-latest'"
uses: "codecov/codecov-action@v1"
with:
fail_ci_if_error: true

package:
name: "Build & verify package"
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
with:
python-version: "3.8"

- name: "Install pep517 and twine"
run: "python -m pip install pep517 twine"
- name: "Build package"
run: "python -m pep517.build --source --binary ."
- name: "List result"
run: "ls -l dist"
- name: "Check long_description"
run: "python -m twine check dist/*"

install-dev:
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]

name: "Verify dev env"
runs-on: "${{ matrix.os }}"

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest
pytest
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
with:
python-version: "3.8"
- name: "Install in dev mode"
run: "python -m pip install -e .[dev]"
- name: "Import package"
run: "python -c 'import jwt; print(jwt.__version__)'"
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
repos:
- repo: https://github.com/psf/black
rev: 19.3b0
rev: 19.10b0
hooks:
- id: black
language_version: python3.7
language_version: python3.8

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.8
rev: 3.7.9
hooks:
- id: flake8
language_version: python3.7
language_version: python3.8

- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
rev: v1.9.4
hooks:
- id: seed-isort-config

Expand All @@ -21,10 +21,10 @@ repos:
hooks:
- id: isort
additional_dependencies: [toml]
language_version: python3.7
language_version: python3.8

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v2.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

38 changes: 0 additions & 38 deletions appveyor.yml

This file was deleted.

10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
comment: false
coverage:
status:
patch:
default:
target: "100"
project:
default:
target: "100"
Loading

0 comments on commit 78c1af4

Please sign in to comment.