Skip to content

style: fix the various, mostly formatting issues reported by flake8 #21

style: fix the various, mostly formatting issues reported by flake8

style: fix the various, mostly formatting issues reported by flake8 #21

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
env:
package_name: mistletoe
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
# As long as we want to support Python 3.6-, we need to stick to an older version of Ubuntu,
# see <https://github.com/actions/setup-python/issues/544>.
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest parameterized
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# See https://www.flake8rules.com for the list of the rules.
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82,W605 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --extend-ignore=E124,E126,E127,E128,E501 --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
id: unit_tests
run: |
pytest
- name: Test CommonMark compliance
if: ${{ success() || steps.unit_tests.conclusion == 'failure' }}
run: |
python -m test.specification --ignore-known
coverage:
needs: build
runs-on: ubuntu-latest
env:
python_version: 3.11
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ env.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest parameterized
# note: the following also installs "coverage"
python -m pip install coveralls
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
- name: Get coverage report
run: |
coverage run --source=${package_name} --append -m pytest
coverage run --source=${package_name} --append -m test.specification --ignore-known
# quick local report output to console:
coverage report
- name: Upload report to Coveralls
# documentation for GitHub setup: https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls --service=github