Skip to content

Commit ab1fc5f

Browse files
authored
Setup GH Actions (jpadilla#499)
* Setup GH Actions * Remove src path changes * Add dev extras * Update USING_COVERAGE * last update * Upgrade pytest * Remove 2.7 things
1 parent 2314124 commit ab1fc5f

File tree

13 files changed

+257
-327
lines changed

13 files changed

+257
-327
lines changed

.coveragerc

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

.flake8

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[flake8]
2-
ignore = E203, E266, E501, W503
3-
max-line-length = 80
4-
max-complexity = 18
5-
select = B,C,E,F,W,T4,B9
6-
exclude = docs/conf.py,.tox
2+
max-line-length = 79
3+
extend-ignore = E203, E501

.github/workflows/main.yml

Lines changed: 90 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,101 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
4-
name: Python package
1+
---
2+
name: CI
53

64
on:
75
push:
8-
branches: [ master ]
6+
branches: ["master"]
97
pull_request:
10-
branches: [ master ]
8+
branches: ["master"]
9+
workflow_dispatch:
1110

1211
jobs:
13-
build:
12+
tests:
13+
name: "Python ${{ matrix.python-version }} on ${{ matrix.platform }}"
14+
runs-on: "${{ matrix.platform }}"
15+
env:
16+
USING_COVERAGE: '3.7,3.8'
1417

15-
runs-on: ubuntu-latest
1618
strategy:
1719
matrix:
18-
python-version: [3.5, 3.6, 3.7, 3.8]
20+
platform: ["ubuntu-latest", "windows-latest"]
21+
python-version: ["3.6", "3.7", "3.8"]
1922

2023
steps:
21-
- uses: actions/checkout@v2
22-
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v1
24-
with:
25-
python-version: ${{ matrix.python-version }}
26-
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install -r requirements.txt
30-
- name: Lint with flake8
31-
run: |
32-
pip install flake8
33-
# stop the build if there are Python syntax errors or undefined names
34-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37-
- name: Test with pytest
38-
run: |
39-
pip install pytest
40-
pytest
24+
- uses: "actions/checkout@v2"
25+
- uses: "actions/setup-python@v2"
26+
with:
27+
python-version: "${{ matrix.python-version }}"
28+
29+
- name: "Install dependencies"
30+
run: |
31+
python -VV
32+
python -m site
33+
python -m pip install --upgrade pip setuptools wheel
34+
python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions
35+
36+
- name: "Run tox targets for ${{ matrix.python-version }}"
37+
run: "python -m tox"
38+
env:
39+
PLATFORM: ${{ matrix.platform }}
40+
41+
# We always use a modern Python version for combining coverage to prevent
42+
# parsing errors in older versions for modern code.
43+
- uses: "actions/setup-python@v2"
44+
with:
45+
python-version: "3.8"
46+
47+
- name: "Combine coverage"
48+
run: |
49+
set -xe
50+
python -m pip install coverage[toml]
51+
python -m coverage combine
52+
python -m coverage xml
53+
if: "contains(env.USING_COVERAGE, matrix.python-version) && matrix.platform == 'ubuntu-latest'"
54+
55+
- name: "Upload coverage to Codecov"
56+
if: "contains(env.USING_COVERAGE, matrix.python-version) && matrix.platform == 'ubuntu-latest'"
57+
uses: "codecov/codecov-action@v1"
58+
with:
59+
fail_ci_if_error: true
60+
61+
package:
62+
name: "Build & verify package"
63+
runs-on: "ubuntu-latest"
64+
65+
steps:
66+
- uses: "actions/checkout@v2"
67+
- uses: "actions/setup-python@v2"
68+
with:
69+
python-version: "3.8"
70+
71+
- name: "Install pep517 and twine"
72+
run: "python -m pip install pep517 twine"
73+
74+
- name: "Build package"
75+
run: "python -m pep517.build --source --binary ."
76+
77+
- name: "List result"
78+
run: "ls -l dist"
79+
80+
- name: "Check long_description"
81+
run: "python -m twine check dist/*"
82+
83+
install-dev:
84+
strategy:
85+
matrix:
86+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
87+
88+
name: "Verify dev env"
89+
runs-on: "${{ matrix.os }}"
90+
91+
steps:
92+
- uses: "actions/checkout@v2"
93+
- uses: "actions/setup-python@v2"
94+
with:
95+
python-version: "3.8"
96+
97+
- name: "Install in dev mode"
98+
run: "python -m pip install -e .[dev]"
99+
100+
- name: "Import package"
101+
run: "python -c 'import jwt; print(jwt.__version__)'"

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 19.3b0
3+
rev: 19.10b0
44
hooks:
55
- id: black
6-
language_version: python3.7
6+
language_version: python3.8
77

88
- repo: https://gitlab.com/pycqa/flake8
9-
rev: 3.7.8
9+
rev: 3.7.9
1010
hooks:
1111
- id: flake8
12-
language_version: python3.7
12+
language_version: python3.8
1313

1414
- repo: https://github.com/asottile/seed-isort-config
15-
rev: v1.9.3
15+
rev: v1.9.4
1616
hooks:
1717
- id: seed-isort-config
1818

@@ -21,10 +21,10 @@ repos:
2121
hooks:
2222
- id: isort
2323
additional_dependencies: [toml]
24-
language_version: python3.7
24+
language_version: python3.8
2525

2626
- repo: https://github.com/pre-commit/pre-commit-hooks
27-
rev: v2.3.0
27+
rev: v2.4.0
2828
hooks:
2929
- id: trailing-whitespace
3030
- id: end-of-file-fixer

.travis.yml

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

appveyor.yml

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

codecov.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
comment: false
3+
coverage:
4+
status:
5+
patch:
6+
default:
7+
target: "100"
8+
project:
9+
default:
10+
target: "100"

0 commit comments

Comments
 (0)