Skip to content

feat: added flake8

feat: added flake8 #2

Workflow file for this run

name: Python package with Poetry and MkDocs Deploy
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Cache Poetry dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies using Poetry
run: |
poetry install
- name: Lint with flake8 using Poetry
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 80 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=80 --statistics
- name: Test with pytest using Poetry
run: |
poetry run python -m pytest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install MkDocs
run: pip install mkdocs
- name: Build MkDocs documentation
run: mkdocs build
- name: Deploy to GitHub Pages
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
mkdocs gh-deploy --force
- name: Clean up
run: |
rm -rf site