-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overhaul of documentation and tooling.
- Loading branch information
Showing
35 changed files
with
372 additions
and
327 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,40 @@ | ||
name: Test | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code. | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }}. | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install package. | ||
run: | | ||
pip install --upgrade pip | ||
pip install .[test,docs] | ||
pip install flit | ||
- name: Lint code. | ||
run: pflake8 | ||
|
||
- name: Run tests. | ||
run: pytest | ||
|
||
- name: Build package. | ||
run: python deploy/build.py | ||
|
||
- name: Render docs. | ||
run: python deploy/docs.py | ||
|
||
- name: Clean repo. | ||
run: python deploy/clean.py |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
"""Builds the installation package.""" | ||
__license__ = 'MIT' | ||
|
||
from subprocess import run | ||
from pathlib import Path | ||
|
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 |
---|---|---|
@@ -1,16 +1,31 @@ | ||
"""Deletes cache and build artifacts.""" | ||
__license__ = 'MIT' | ||
"""Deletes build and test artifacts.""" | ||
|
||
from pathlib import Path | ||
from shutil import rmtree | ||
|
||
root = Path(__file__).resolve().parent.parent | ||
|
||
for folder in root.rglob('__pycache__'): | ||
rmtree(folder, ignore_errors=True) | ||
folders = [ | ||
root/'deploy'/'docs', | ||
root/'deploy'/'coverage', | ||
root/'deploy'/'dist', | ||
root/'dist', | ||
] | ||
folder_names = [ | ||
'__pycache__', | ||
'.pytest_cache', | ||
] | ||
for folder_name in folder_names: | ||
for folder in root.rglob(folder_name): | ||
folders.append(folder) | ||
for folder in folders: | ||
if folder.is_dir(): | ||
rmtree(folder, ignore_errors=True) | ||
|
||
for folder in root.rglob('.pytest_cache'): | ||
rmtree(folder) | ||
|
||
for folder in ('docs', 'dist', 'coverage'): | ||
rmtree(root/'deploy'/folder, ignore_errors=True) | ||
files = [ | ||
root/'.coverage', | ||
root/'coverage.xml', | ||
] | ||
for file in files: | ||
if file.is_file(): | ||
file.unlink() |
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 |
---|---|---|
@@ -1,24 +1,18 @@ | ||
"""Measures code coverage by test suite.""" | ||
__license__ = 'MIT' | ||
|
||
|
||
from subprocess import run | ||
from pathlib import Path | ||
|
||
|
||
here = Path(__file__).resolve().parent | ||
root = here.parent | ||
file = here/'coverage.sqlite' | ||
|
||
run(['pytest', '--cov'], cwd=root) | ||
print('Running test suite.') | ||
run(['python', '-m', 'pytest', '--cov'], cwd=root) | ||
|
||
print('Rendering coverage report.') | ||
print('Exporting coverage report.') | ||
folder = (here/'coverage').relative_to(root) | ||
run(['coverage', 'html', f'--directory={folder}'], cwd=root) | ||
|
||
badge = root/'tests'/file.with_suffix('.svg').name | ||
if badge.exists(): | ||
print('Coverage badge already exists.') | ||
else: | ||
print('Rendering coverage badge.') | ||
run(['coverage-badge', '-f', '-o', str(badge)], cwd=root) | ||
print('Rendering coverage badge.') | ||
badge = root/'tests'/'coverage.svg' | ||
run(['coverage-badge', '-f', '-o', str(badge)], cwd=root) |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
"""Renders the documentation.""" | ||
__license__ = 'MIT' | ||
|
||
from subprocess import run | ||
from pathlib import Path | ||
|
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
"""Publishes the package on PyPI.""" | ||
__license__ = 'MIT' | ||
|
||
from subprocess import run | ||
from pathlib import Path | ||
|
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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
Steps to take when releasing a new version: | ||
* Bump version number and enter current date in `__init__.py`. | ||
* Add a dedicated commit for the version bump. | ||
* Tag the commit with the version number, for example: `git tag -a v1.0.3`. | ||
* Enter the release notes as an annotation. | ||
* Push the commit (but not the tag): `git push origin main`. | ||
* Check that documentation built successfully on Read-the-Docs. | ||
* Add dedicated commit for the version bump. | ||
* Tag commit with version number, e.g. `git tag v1.0.3`. | ||
* Push the commit: `git push origin main`. | ||
* Check documentation build on Read-the-Docs. | ||
* Publish on PyPI by running `deploy/publish.py`. | ||
* Check that meta information is correct on PyPI. | ||
* Then push the tag: `git push --tags`. | ||
* Create a new release on GitHub and add the release notes. | ||
* Push the tag: `git push --tags`. | ||
* Create new release on GitHub and add release notes. |
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.