-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
410 additions
and
31 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,127 @@ | ||
# GitHub Actions configuration **EXAMPLE**, | ||
# MODIFY IT ACCORDING TO YOUR NEEDS! | ||
# Reference: https://docs.github.com/en/actions | ||
|
||
name: tests | ||
|
||
on: | ||
push: | ||
# Avoid using all the resources/limits available by checking only | ||
# relevant branches and tags. Other branches can be checked via PRs. | ||
branches: [main] | ||
tags: ['v[0-9]*', '[0-9]+.[0-9]+*'] # Match tags that resemble a version | ||
pull_request: # Run in every PR | ||
workflow_dispatch: # Allow manually triggering the workflow | ||
# schedule: | ||
# Run roughly every 15 days at 00:00 UTC | ||
# (useful to check if updates on dependencies break the package) | ||
# - cron: '0 0 1,16 * *' | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: >- | ||
${{ github.workflow }}-${{ github.ref_type }}- | ||
${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
wheel-distribution: ${{ steps.wheel-distribution.outputs.path }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: {fetch-depth: 0} # deep clone for setuptools-scm | ||
- uses: actions/setup-python@v4 | ||
id: setup-python | ||
with: {python-version: "3.11"} | ||
- name: Run static analysis and format checkers | ||
run: pipx run pre-commit run --all-files --show-diff-on-failure | ||
- name: Build package distribution files | ||
run: >- | ||
pipx run --python '${{ steps.setup-python.outputs.python-path }}' | ||
tox -e clean,build | ||
- name: Record the path of wheel distribution | ||
id: wheel-distribution | ||
run: echo "path=$(ls dist/*.whl)" >> $GITHUB_OUTPUT | ||
- name: Store the distribution files for use in other stages | ||
# `tests` and `publish` will use the same pre-built distributions, | ||
# so we make sure to release the exact same package that was tested | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-distribution-files | ||
path: dist/ | ||
retention-days: 1 | ||
|
||
test: | ||
needs: prepare | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.10" # oldest Python supported by PSF | ||
- "3.11" # newest Python that is stable | ||
platform: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
id: setup-python | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Retrieve pre-built distribution files | ||
uses: actions/download-artifact@v3 | ||
with: {name: python-distribution-files, path: dist/} | ||
- name: Run tests | ||
run: >- | ||
pipx run --python '${{ steps.setup-python.outputs.python-path }}' | ||
tox --installpkg '${{ needs.prepare.outputs.wheel-distribution }}' | ||
-- -rFEx --durations 10 --color yes # pytest args | ||
- name: Generate coverage report | ||
run: pipx run coverage lcov -o coverage.lcov | ||
- name: Upload partial coverage report | ||
uses: coverallsapp/github-action@master | ||
with: | ||
path-to-lcov: coverage.lcov | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
flag-name: ${{ matrix.platform }} - py${{ matrix.python }} | ||
parallel: true | ||
|
||
finalize: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Finalize coverage report | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel-finished: true | ||
|
||
publish: | ||
environment: | ||
name: pypi-publish | ||
needs: finalize | ||
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: {python-version: "3.11"} | ||
- name: Retrieve pre-built distribution files | ||
uses: actions/download-artifact@v3 | ||
with: {name: python-distribution-files, path: dist/} | ||
- name: Publish Package | ||
env: | ||
# TODO: Set your PYPI_TOKEN as a secret using GitHub UI | ||
# - https://pypi.org/help/#apitoken | ||
# - https://docs.github.com/en/actions/security-guides/encrypted-secrets | ||
TWINE_REPOSITORY: pypi | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: pipx run tox -e publish |
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,76 @@ | ||
exclude: '^docs/conf.py' | ||
|
||
default_install_hook_types: [pre-commit, commit-msg] | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: requirements-txt-fixer | ||
- id: mixed-line-ending | ||
args: ['--fix=lf'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows | ||
|
||
## If you want to automatically "modernize" your Python code: | ||
# - repo: https://github.com/asottile/pyupgrade | ||
# rev: v3.7.0 | ||
# hooks: | ||
# - id: pyupgrade | ||
# args: ['--py37-plus'] | ||
|
||
## If you want to avoid flake8 errors due to unused vars or imports: | ||
# - repo: https://github.com/PyCQA/autoflake | ||
# rev: v2.1.1 | ||
# hooks: | ||
# - id: autoflake | ||
# args: [ | ||
# --in-place, | ||
# --remove-all-unused-imports, | ||
# --remove-unused-variables, | ||
# ] | ||
|
||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 23.11.0 | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
|
||
## If like to embrace black styles even in the docs: | ||
# - repo: https://github.com/asottile/blacken-docs | ||
# rev: v1.13.0 | ||
# hooks: | ||
# - id: blacken-docs | ||
# additional_dependencies: [black] | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 | ||
## You can add flake8 plugins via `additional_dependencies`: | ||
# additional_dependencies: [flake8-bugbear] | ||
|
||
## Check for misspells in documentation files: | ||
# - repo: https://github.com/codespell-project/codespell | ||
# rev: v2.2.5 | ||
# hooks: | ||
# - id: codespell | ||
|
||
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook | ||
rev: v9.10.0 | ||
hooks: | ||
- id: commitlint | ||
stages: [commit-msg] | ||
additional_dependencies: ['conventional-changelog-conventionalcommits'] |
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,135 @@ | ||
module.exports = { | ||
parserPreset: 'conventional-changelog-conventionalcommits', | ||
rules: { | ||
'body-leading-blank': [1, 'always'], | ||
'body-max-line-length': [2, 'always', 100], | ||
'footer-leading-blank': [1, 'always'], | ||
'footer-max-line-length': [2, 'always', 100], | ||
'header-max-length': [2, 'always', 100], | ||
'subject-case': [ | ||
2, | ||
'never', | ||
['sentence-case', 'start-case', 'pascal-case', 'upper-case'], | ||
], | ||
'subject-empty': [2, 'never'], | ||
'subject-full-stop': [2, 'never', '.'], | ||
'type-case': [2, 'always', 'lower-case'], | ||
'type-empty': [2, 'never'], | ||
'type-enum': [ | ||
2, | ||
'always', | ||
[ | ||
'build', | ||
'chore', | ||
'ci', | ||
'docs', | ||
'feat', | ||
'fix', | ||
'perf', | ||
'refactor', | ||
'revert', | ||
'style', | ||
'test', | ||
], | ||
], | ||
}, | ||
prompt: { | ||
questions: { | ||
type: { | ||
description: "Select the type of change that you're committing", | ||
enum: { | ||
feat: { | ||
description: 'A new feature', | ||
title: 'Features', | ||
emoji: '✨', | ||
}, | ||
fix: { | ||
description: 'A bug fix', | ||
title: 'Bug Fixes', | ||
emoji: '🐛', | ||
}, | ||
docs: { | ||
description: 'Documentation only changes', | ||
title: 'Documentation', | ||
emoji: '📚', | ||
}, | ||
style: { | ||
description: | ||
'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)', | ||
title: 'Styles', | ||
emoji: '💎', | ||
}, | ||
refactor: { | ||
description: | ||
'A code change that neither fixes a bug nor adds a feature', | ||
title: 'Code Refactoring', | ||
emoji: '📦', | ||
}, | ||
perf: { | ||
description: 'A code change that improves performance', | ||
title: 'Performance Improvements', | ||
emoji: '🚀', | ||
}, | ||
test: { | ||
description: 'Adding missing tests or correcting existing tests', | ||
title: 'Tests', | ||
emoji: '🚨', | ||
}, | ||
build: { | ||
description: | ||
'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)', | ||
title: 'Builds', | ||
emoji: '🛠', | ||
}, | ||
ci: { | ||
description: | ||
'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)', | ||
title: 'Continuous Integrations', | ||
emoji: '⚙️', | ||
}, | ||
chore: { | ||
description: "Other changes that don't modify src or test files", | ||
title: 'Chores', | ||
emoji: '♻️', | ||
}, | ||
revert: { | ||
description: 'Reverts a previous commit', | ||
title: 'Reverts', | ||
emoji: '🗑', | ||
}, | ||
}, | ||
}, | ||
scope: { | ||
description: | ||
'What is the scope of this change (e.g. component or file name)', | ||
}, | ||
subject: { | ||
description: | ||
'Write a short, imperative tense description of the change', | ||
}, | ||
body: { | ||
description: 'Provide a longer description of the change', | ||
}, | ||
isBreaking: { | ||
description: 'Are there any breaking changes?', | ||
}, | ||
breakingBody: { | ||
description: | ||
'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself', | ||
}, | ||
breaking: { | ||
description: 'Describe the breaking changes', | ||
}, | ||
isIssueAffected: { | ||
description: 'Does this change affect any open issues?', | ||
}, | ||
issuesBody: { | ||
description: | ||
'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself', | ||
}, | ||
issues: { | ||
description: 'Add issue references (e.g. "fix #123", "re #123".)', | ||
}, | ||
}, | ||
}, | ||
}; |
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,7 +1,6 @@ | ||
# Requirements file for ReadTheDocs, check .readthedocs.yml. | ||
# To build the module reference correctly, make sure every external package | ||
# under `install_requires` in `setup.cfg` is also listed here! | ||
aiohttp | ||
sphinx>=3.2.1 | ||
sphinx_rtd_theme | ||
sphinx-github-changelog>=1.2.0 | ||
sphinx_rtd_theme |
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.