-
Notifications
You must be signed in to change notification settings - Fork 945
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update development tools: travis ci to github actions, tox to nox, no…
…se to pytest (#704) * Replace tox with nox * Replace travis with github actions * Fix pytest, mypy and flake8 errors * Add pytest. * Run on all commits * Remove nose * Speedup slow tests to save GitHub actions minutes * Added line to CHANGELOG.md * Fix line too long in pdfdocument.py * Update .github/workflows/actions.yml Co-authored-by: Jake Stockwin <jstockwin@gmail.com> * Improve actions.yml * Fix error with nox name for mypy * Add names for jobs * Replace nose.raises with pytest.raises Co-authored-by: Jake Stockwin <jstockwin@gmail.com>
- Loading branch information
1 parent
1d1602e
commit b84cfc9
Showing
27 changed files
with
435 additions
and
312 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Continuous integration | ||
|
||
on: | ||
push: | ||
|
||
env: | ||
default-python: "3.10" | ||
|
||
jobs: | ||
|
||
check-coding-style: | ||
name: Check coding style | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python ${{ env.default-python }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.default-python }} | ||
- name: Upgrade pip, Install nox | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install nox | ||
- name: Check coding style | ||
run: | | ||
nox --error-on-missing-interpreters --non-interactive --session lint | ||
check-static-types: | ||
name: Check static types | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python ${{ env.default-python }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.default-python }} | ||
- name: Upgrade pip, Install nox | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install nox | ||
- name: Check static types | ||
run: | | ||
nox --error-on-missing-interpreters --non-interactive --session types | ||
tests: | ||
name: Run tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10" ] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Determine pip cache directory | ||
id: pip-cache | ||
run: | | ||
echo "::set-output name=dir::$(pip cache dir)" | ||
- name: Cache pip cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: ${{ runner.os }}-pip${{ matrix.python-version }} | ||
- name: Upgrade pip and install nox | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install nox | ||
- name: Run tests | ||
run: | | ||
nox --non-interactive --session tests-${{ matrix.python-version }} | ||
build-docs: | ||
name: Test building docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python ${{ env.default-python }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.default-python }} | ||
- name: Upgrade pip and install nox | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install nox | ||
- name: Build docs | ||
run: | | ||
nox --error-on-missing-interpreters --non-interactive --session docs |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ tests/*.xml | |
tests/*.txt | ||
.idea/ | ||
.tox/ | ||
.nox/ | ||
|
||
# python venv management tools | ||
Pipfile | ||
|
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import nox | ||
|
||
|
||
PYTHON_ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] | ||
|
||
|
||
@nox.session | ||
def lint(session): | ||
session.install('flake8') | ||
session.run( | ||
'flake8', | ||
'pdfminer/', | ||
'tools/', | ||
'tests/', | ||
'--count', | ||
'--statistics' | ||
) | ||
|
||
|
||
@nox.session | ||
def types(session): | ||
session.install('mypy') | ||
session.run( | ||
'mypy', | ||
'--install-types', | ||
'--non-interactive', | ||
'--show-error-codes', | ||
'.' | ||
) | ||
|
||
|
||
@nox.session(python=PYTHON_ALL_VERSIONS) | ||
def tests(session): | ||
session.install("-e", ".[dev]") | ||
session.run('pytest') | ||
|
||
|
||
@nox.session | ||
def docs(session): | ||
session.install("-e", ".[docs]") | ||
session.run( | ||
'python', | ||
'-m', | ||
'sphinx', | ||
'-b', | ||
'html', | ||
'docs/source', | ||
'docs/build/html' | ||
) | ||
session.run( | ||
'python', | ||
'-m', | ||
'sphinx', | ||
'-b', | ||
'doctest', | ||
'docs/source', | ||
'docs/build/doctest' | ||
) |
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
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
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
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
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
Oops, something went wrong.