8000 ci: Move flake8 to GitHub Actions with reviewdog. · matplotlib/matplotlib@9dca177 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9dca177

Browse files
committed
ci: Move flake8 to GitHub Actions with reviewdog.
1 parent 30d1396 commit 9dca177

File tree

5 files changed

+47
-33
lines changed

5 files changed

+47
-33
lines changed

.github/workflows/reviewdog.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Linting
2+
on: [pull_request]
3+
4+
jobs:
5+
flake8:
6+
name: flake8
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- name: Set up Python 3
12+
uses: actions/setup-python@v1
13+
with:
14+
python-version: 3.8
15+
16+
- name: Install flake8
17+
run: pip3 install -r requirements/testing/flake8.txt
18+
19+
- name: Set up reviewdog
20+
run: |
21+
mkdir -p $HOME/bin && curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b $HOME/bin
22+
echo ::add-path::$HOME/bin
23+
24+
- name: Run flake8
25+
env:
26+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: |
28+
flake8 --docstring-convention=all | reviewdog -f=pep8 -name=flake8 -reporter=github-check

.travis.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,9 @@ env:
6262
- NO_AT_BRIDGE=1 # Necessary for GTK3 interactive test.
6363
- OPENBLAS_NUM_THREADS=1
6464
- PYTHONFAULTHANDLER=1
65-
- RUN_PYTEST=1
66-
- RUN_FLAKE8=
6765

6866
matrix:
6967
include:
70-
- name: flake8
71-
python: 3.6
72-
env:
73-
- RUN_PYTEST=
74-
- RUN_FLAKE8=1
75-
- EXTRAREQS='-r requirements/testing/travis_flake8.txt'
7668
- python: 3.6
7769
env:
7870
- PINNEDVERS='-c requirements/testing/travis36minver.txt'
@@ -165,13 +157,13 @@ install:
165157
166158
# Set flag in a delayed manner to avoid issues with installing other packages
167159
- |
168-
if [[ $TRAVIS_OS_NAME != 'osx' ]] && [[ $RUN_PYTEST == 1 ]]; then
160+
if [[ $TRAVIS_OS_NAME != 'osx' ]]; then
169161
export CPPFLAGS=--coverage
170162
fi
171163
- |
172164
python -mpip install -ve . # Install Matplotlib.
173165
- |
174-
if [[ $TRAVIS_OS_NAME != 'osx' ]] && [[ $RUN_PYTEST == 1 ]]; then
166+
if [[ $TRAVIS_OS_NAME != 'osx' ]]; then
175167
unset CPPFLAGS
176168
fi
177169
@@ -184,16 +176,10 @@ script:
184176
# Each script we want to run need to go in its own section and the program
185177
# you want to fail travis needs to be the last thing called.
186178
- |
187-
if [[ $RUN_PYTEST == 1 ]]; then
188-
# The number of processes is hardcoded (-n2), because using too many
189-
# causes the Travis VM to run out of memory (since so many copies of
190-
# inkscape and ghostscript are running at the same time).
191-
python -mpytest -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n2 --log-level=DEBUG
192-
fi
193-
- |
194-
if [[ $RUN_FLAKE8 == 1 ]]; then
195-
flake8 --docstring-convention=all --statistics && echo "Flake8 passed without any issues!"
196-
fi
179+
# The number of processes is hardcoded (-n2), because using too many
180+
# causes the Travis VM to run out of memory (since so many copies of
181+
# inkscape and ghostscript are running at the same time).
182+
python -mpytest -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n2 --log-level=DEBUG
197183
198184
before_cache: |
199185
rm -rf $HOME/.cache/matplotlib/tex.cache

doc/devel/coding_guide.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,14 @@ Automated tests
188188
Whenever a pull request is created or updated, various automated test tools
189189
will run on all supported platforms and versions of Python.
190190

191-
* Make sure the Travis, Appveyor, CircleCI, and Azure pipelines are passing
192-
before merging (All checks are listed at the bottom of the GitHub page of
193-
your pull request). Here are some tips for finding the cause of the test
194-
failure:
195-
196-
- If *Travis flake8* fails, you have a code style issue, which will be listed
197-
near the bottom of the *Travis flake8* log.
198-
- If any other Travis run fails, search the log for ``FAILURES``. The
191+
* Make sure the Linting, Travis, AppVeyor, CircleCI, and Azure pipelines are
192+
passing before merging (All checks are listed at the bottom of the GitHub
193+
page of your pull request). Here are some tips for finding the cause of the
194+
test failure:
195+
196+
- If *Linting* fails, you have a code style issue, which will be listed
197+
as annotations on the pull request's diff.
198+
- If a Travis or AppVeyor run fails, search the log for ``FAILURES``. The
199199
subsequent section will contain information on the failed tests.
200200
- If CircleCI fails, likely you have some reStructuredText style issue in
201201
the docs. Search the CircleCI log for ``WARNING``.

requirements/testing/flake8.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Extra pip requirements for the GitHub Actions flake8 build
2+
3+
flake8>=3.7
4+
pydocstyle<4.0
5+
flake8-docstrings

requirements/testing/travis_flake8.txt

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

0 commit comments

Comments
 (0)
0