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

Setup GH Actions #499

Merged
merged 7 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .coveragerc

This file was deleted.

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
119 changes: 90 additions & 29 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,101 @@
# 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"]
workflow_dispatch:

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

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

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@v2"
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 }}

# We always use a modern Python version for combining coverage to prevent
# parsing errors in older versions for modern code.
- uses: "actions/setup-python@v2"
with:
python-version: "3.8"

- name: "Combine coverage"
run: |
set -xe
python -m pip install coverage[toml]
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@v2"
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:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]

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

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
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