Skip to content

Commit 37b36f2

Browse files
committed
ci: Move flake8 to GitHub Actions with reviewdog.
1 parent da6dfab commit 37b36f2

File tree

4 files changed

+39
-25
lines changed

4 files changed

+39
-25
lines changed

.github/workflows/reviewdog.yml

+28
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 | reviewdog -f=pep8 -name=flake8 -reporter=github-check

.travis.yml

+6-20
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 --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

requirements/testing/flake8.txt

+5
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

-5
This file was deleted.

0 commit comments

Comments
 (0)