diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f63a590..e7cd87f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,16 +22,14 @@ jobs: name: Configure pip caching with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt')}}-${{ hashFiles('**/requirements-dev.txt') }} - name: Install Python dependencies - run: | - python -m pip install -r requirements.txt - python -m pip install -r requirements-dev.txt - python -m pip install -e . + run: make venv + - name: Validate against psf/black + run: make check-black + - name: Validate against flake8 + run: make check-flake - name: Run tests - run: |- - pytest --cov=pdfplumber --cov-config=.coveragerc --cov-report xml:coverage.xml --cov-report term - - name: Codecov + run: make tests + - name: Examine code coverage uses: codecov/codecov-action@v1.0.12 diff --git a/Makefile b/Makefile index d97f20d..260f74e 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,22 @@ -.PHONY: venv tests -PYTHON=venv/bin/python -PIP=venv/bin/pip +.PHONY: venv tests check-black check-flake format +PYTHON := venv/bin/python +PIP = venv/bin/pip venv: python -m venv venv ${PIP} install --upgrade pip - ${PIP} freeze --exclude-editable | xargs ${PIP} uninstall -y | true ${PIP} install -r requirements.txt ${PIP} install -r requirements-dev.txt ${PIP} install -e . tests: - ${PYTHON} -m pytest --cov=pdfplumber --cov-config=.coveragerc --cov-report xml:coverage.xml --cov-report term + ${PYTHON} -m pytest + +check-black: + ${PYTHON} -m black pdfplumber --check + +check-flake: + ${PYTHON} -m flake8 pdfplumber format: ${PYTHON} -m black pdfplumber - ${PYTHON} -m flake8 pdfplumber diff --git a/setup.cfg b/setup.cfg index fc01c0d..ced6133 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,13 @@ [flake8] +# max-complexity = 10 max-line-length = 88 ignore = E203 # https://black.readthedocs.io/en/stable/the_black_code_style.html#slices W503 # Impossible to obey both W503 and W504 +[tool:pytest] +addopts=--cov=pdfplumber --cov-report xml:coverage.xml --cov-report term + [tox] envlist = py35,py36,py37,py38 toxworkdir={env:TOX_WORK_DIR:.tox}