Skip to content

Commit

Permalink
ci: Move flake8 to GitHub Actions with reviewdog.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Apr 17, 2020
1 parent 30d1396 commit 9dca177
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 33 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Linting
on: [pull_request]

jobs:
flake8:
name: flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install flake8
run: pip3 install -r requirements/testing/flake8.txt

- name: Set up reviewdog
run: |
mkdir -p $HOME/bin && curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b $HOME/bin
echo ::add-path::$HOME/bin
- name: Run flake8
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
flake8 --docstring-convention=all | reviewdog -f=pep8 -name=flake8 -reporter=github-check
26 changes: 6 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,9 @@ env:
- NO_AT_BRIDGE=1 # Necessary for GTK3 interactive test.
- OPENBLAS_NUM_THREADS=1
- PYTHONFAULTHANDLER=1
- RUN_PYTEST=1
- RUN_FLAKE8=

matrix:
include:
- name: flake8
python: 3.6
env:
- RUN_PYTEST=
- RUN_FLAKE8=1
- EXTRAREQS='-r requirements/testing/travis_flake8.txt'
- python: 3.6
env:
- PINNEDVERS='-c requirements/testing/travis36minver.txt'
Expand Down Expand Up @@ -165,13 +157,13 @@ install:
# Set flag in a delayed manner to avoid issues with installing other packages
- |
if [[ $TRAVIS_OS_NAME != 'osx' ]] && [[ $RUN_PYTEST == 1 ]]; then
if [[ $TRAVIS_OS_NAME != 'osx' ]]; then
export CPPFLAGS=--coverage
fi
- |
python -mpip install -ve . # Install Matplotlib.
- |
if [[ $TRAVIS_OS_NAME != 'osx' ]] && [[ $RUN_PYTEST == 1 ]]; then
if [[ $TRAVIS_OS_NAME != 'osx' ]]; then
unset CPPFLAGS
fi
Expand All @@ -184,16 +176,10 @@ script:
# Each script we want to run need to go in its own section and the program
# you want to fail travis needs to be the last thing called.
- |
if [[ $RUN_PYTEST == 1 ]]; then
# The number of processes is hardcoded (-n2), because using too many
# causes the Travis VM to run out of memory (since so many copies of
# inkscape and ghostscript are running at the same time).
python -mpytest -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n2 --log-level=DEBUG
fi
- |
if [[ $RUN_FLAKE8 == 1 ]]; then
flake8 --docstring-convention=all --statistics && echo "Flake8 passed without any issues!"
fi
# The number of processes is hardcoded (-n2), because using too many
# causes the Travis VM to run out of memory (since so many copies of
# inkscape and ghostscript are running at the same time).
python -mpytest -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n2 --log-level=DEBUG
before_cache: |
rm -rf $HOME/.cache/matplotlib/tex.cache
Expand Down
16 changes: 8 additions & 8 deletions doc/devel/coding_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ Automated tests
Whenever a pull request is created or updated, various automated test tools
will run on all supported platforms and versions of Python.

* Make sure the Travis, Appveyor, CircleCI, and Azure pipelines are passing
before merging (All checks are listed at the bottom of the GitHub page of
your pull request). Here are some tips for finding the cause of the test
failure:

- If *Travis flake8* fails, you have a code style issue, which will be listed
near the bottom of the *Travis flake8* log.
- If any other Travis run fails, search the log for ``FAILURES``. The
* Make sure the Linting, Travis, AppVeyor, CircleCI, and Azure pipelines are
passing before merging (All checks are listed at the bottom of the GitHub
page of your pull request). Here are some tips for finding the cause of the
test failure:

- If *Linting* fails, you have a code style issue, which will be listed
as annotations on the pull request's diff.
- If a Travis or AppVeyor run fails, search the log for ``FAILURES``. The
subsequent section will contain information on the failed tests.
- If CircleCI fails, likely you have some reStructuredText style issue in
the docs. Search the CircleCI log for ``WARNING``.
Expand Down
5 changes: 5 additions & 0 deletions requirements/testing/flake8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Extra pip requirements for the GitHub Actions flake8 build

flake8>=3.7
pydocstyle<4.0
flake8-docstrings
5 changes: 0 additions & 5 deletions requirements/testing/travis_flake8.txt

This file was deleted.

0 comments on commit 9dca177

Please sign in to comment.