added documentation #713
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python linting | |
on: [push, workflow_dispatch] | |
jobs: | |
check-formatting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install pipenv | |
run: | | |
python -m pip install --upgrade pip | |
pip install pipenv | |
# Cache the venv between runs. Duplicated from testing.yaml | |
- name: Cache virtualenv | |
id: cache-venv | |
uses: actions/cache@v3 | |
env: | |
CACHE_NAME: CACHE_VIRTUALENV | |
with: | |
path: .venv | |
# The cache action does not as of now (Oct. 2020) support clearing the cache. | |
# If the cache becomes stale for any reason one can clear it by changing | |
# the value of the secret `PIPENV_CACHE_VERSION` in the repository settings | |
key: > | |
cache_version_${{ secrets.PIPENV_CACHE_VERSION}}-${{ runner.os }}-${{ env.CACHE_NAME }}-python${{ matrix.python_version }}-${{ hashFiles('Pipfile.lock') }} | |
# Fallbacks to partially restore cache | |
restore-keys: | | |
cache_version_${{ secrets.PIPENV_CACHE_VERSION}}-${{ runner.os }}-${{ env.CACHE_NAME }}-python${{ matrix.python_version }}- | |
- name: Install dependencies | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
# Use copies instead of symlinks to be more portable | |
python -m venv --copies .venv | |
# Install dependencies into the newly created venv | |
pipenv install --deploy --dev | |
- name: Check for serious errors with flake8 | |
run: pipenv run make check-fatal | |
- name: Check formatting with black and isort | |
run: pipenv run make check-formatting | |
report-linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pylint bandit | |
- name: Report linting errors with flake8 | |
run: make report-flake8 | |
- name: Report linting errors with pylint | |
run: make report-pylint | |
- name: Report security audit with bandit | |
run: make report-bandit |