Skip to content

Commit

Permalink
Revamp CI (#14)
Browse files Browse the repository at this point in the history
* Adopt GitHub Actions and problem matchers for annotations
  • Loading branch information
achimnol committed Jan 25, 2020
1 parent 3712c41 commit d8e0055
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 13 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/flake8-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "flake8",
"pattern": [
{
"regexp": "^([^:]*):(\\d+):(\\d+): (([a-z]+): )?(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 5,
"message": 6
}
]
}
]
}
27 changes: 27 additions & 0 deletions .github/workflows/lint-flake8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint with flake8

on: [push, pull_request]

jobs:
lint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install -U pip setuptools
python -m pip install -U -r requirements/lint.txt
- name: Lint with flake8
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" -a -n "$GITHUB_HEAD_REF" ]; then
echo "(skipping matchers for pull request from local branches)"
else
echo "::add-matcher::.github/workflows/flake8-matcher.json"
fi
python -m flake8 src/aiotools tests
16 changes: 16 additions & 0 deletions .github/workflows/mypy-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"problemMatcher": [
{
"owner": "mypy",
"pattern": [
{
"regexp": "^([^:]*):(\\d+): ([^:]+): (.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
]
}
]
}
27 changes: 27 additions & 0 deletions .github/workflows/typecheck-mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Type check with mypy

on: [push, pull_request]

jobs:
typecheck:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install -U pip setuptools
python -m pip install -U -r requirements/typecheck.txt
- name: Type check with mypy
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" -a -n "$GITHUB_HEAD_REF" ]; then
echo "(skipping matchers for pull request from local branches)"
else
echo "::add-matcher::.github/workflows/mypy-matcher.json"
fi
python -m mypy --no-color-output src/aiotools tests
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requirements_file: requirements-docs.txt
requirements_file: requirements/docs.txt
build:
image: latest
python:
Expand Down
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ matrix:
# default test job
install:
- pip install -U pip setuptools
- pip install -r requirements-ci.txt
- pip install -r requirements/test.txt
script:
- python -m flake8 src tests
# Run type checks only for Python 3.7+
- UNDER_PY37=$(python -c 'import sys; print(int(sys.version_info < (3,7,0)), end="")'); if [ "$UNDER_PY37" -eq 0 ]; then python -m mypy src/aiotools; fi
- python -m pytest --cov=src -v tests
after_success:
- codecov
Expand Down
1 change: 0 additions & 1 deletion requirements-ci.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements-dev.txt

This file was deleted.

1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-e .[lint,typecheck,build,test,dev,docs]
File renamed without changes.
1 change: 1 addition & 0 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-e .[lint]
File renamed without changes.
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-e .[test]
1 change: 1 addition & 0 deletions requirements/typecheck.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-e .[test,typecheck]
16 changes: 10 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,29 @@ package_dir =
packages = find:
python_requires = >=3.6
setup_requires =
setuptools>=41.6.0
setuptools>=45.0.0
install_requires =
typing-extensions~=3.7; python_version<"3.8"
zip_safe = false
include_package_data = true

[options.extras_require]
build =
setuptools>=41.6.0
setuptools>=45.0.0
wheel>=0.33.6
twine>=2.0.0
test =
pytest~=5.2.4
pytest~=5.3.3
pytest-asyncio~=0.10.0
pytest-cov
pytest-mock
codecov
mypy>=0.740
flake8>=3.7.9
dev =
pytest-sugar
ci =
lint =
flake8>=3.7.9
typecheck =
mypy>=0.760
docs =
sphinx
sphinx-autodoc-typehints
Expand All @@ -80,3 +81,6 @@ exclude = .git,.cache,.idea,.egg,__pycache__,venv,build,dist,docs

[mypy]
mypy_path = src

[mypy-pytest.*]
ignore_missing_imports = true

0 comments on commit d8e0055

Please sign in to comment.