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 16, 2020
1 parent da6dfab commit f01135a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 25 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: run-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 | 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 --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
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 f01135a

Please sign in to comment.