Skip to content

Commit

Permalink
Use matrix for lint
Browse files Browse the repository at this point in the history
Added a matrix for lint action
Added caching for packages from requirements.txt
  • Loading branch information
Mogost authored and codingjoe committed Feb 14, 2021
1 parent 175f094 commit 023cf4f
Showing 1 changed file with 20 additions and 41 deletions.
61 changes: 20 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,28 @@ on:

jobs:

bandit:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/checkout@v2
- run: python -m pip install `cat requirements.txt | grep bandit`
- run: bandit -r hijack -x hijack/tests

black:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/checkout@v2
- run: python -m pip install `cat requirements.txt | grep black`
- run: black --check --diff .

flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/checkout@v2
- run: python -m pip install `cat requirements.txt | grep flake8`
- run: flake8 .

isort:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/checkout@v2
- run: python -m pip install `cat requirements.txt | grep isort`
- run: isort --check-only --diff .

pydocstyle:
lint:
strategy:
fail-fast: false
matrix:
lint-command:
- "bandit -r hijack -x hijack/tests"
- "black --check --diff ."
- "flake8 ."
- "isort --check-only --diff ."
- "pydocstyle ."
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
- uses: actions/checkout@v2
- run: python -m pip install `cat requirements.txt | grep pydocstyle`
- run: pydocstyle .
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: python -m pip install -r requirements.txt
- run: ${{ matrix.lint-command }}

dist:
runs-on: ubuntu-latest
Expand All @@ -60,12 +43,8 @@ jobs:
pytest:
runs-on: ubuntu-latest
needs:
- bandit
- black
- dist
- flake8
- isort
- pydocstyle
- lint
strategy:
matrix:
python-version:
Expand Down

0 comments on commit 023cf4f

Please sign in to comment.