-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit 32e7570
Showing
16 changed files
with
11,942 additions
and
0 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,23 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
|
||
# Sane defaults | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
# Python files | ||
[*.py] | ||
tab_width = 4 | ||
indent_size = 4 | ||
indent_style = space | ||
|
||
# MD Files | ||
[*.md] | ||
ij_formatter_enabled = false |
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,157 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
release: | ||
types: [ "published" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: main-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
||
jobs: | ||
|
||
format-checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Install Project | ||
run: python -m pip install -e . | ||
- name: Install ruff | ||
run: | | ||
python -m pip install ruff==0.1.8 | ||
- name: Formatting Checks | ||
run: ruff format --check src tests | ||
|
||
type-checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Install Project | ||
run: python -m pip install -e . | ||
- name: Install mypy | ||
run: python -m pip install mypy==1.7.1 | ||
- name: Type Checks | ||
run: mypy src | ||
|
||
tests: | ||
name: Tests / ${{ matrix.python-version }} | ||
runs-on: ubuntu-latest | ||
needs: | ||
- format-checks | ||
- type-checks | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ "3.8", "3.9", "3.10" ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Project | ||
run: python -m pip install -e . | ||
- name: Install Coverage | ||
run: python -m pip install "coverage[toml]==7.3.3" | ||
- name: Run Tests ${{ matrix.python-version }} | ||
run: python -m coverage run -m unittest discover -s tests | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: cov-${{ matrix.python-version }} | ||
path: .coverage.* | ||
retention-days: 5 | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- tests | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Install Coverage | ||
run: python -m pip install coverage==7.3.3 | ||
- name: Download Coverage Data | ||
uses: actions/download-artifact@v3 | ||
- name: Prepare Coverage Report | ||
run: | | ||
python -m coverage combine **/.coverage.* | ||
python -m coverage report -m --skip-covered | ||
python -m coverage json | ||
- name: Output Coverage | ||
run: echo "COVERAGE_JSON=$(jq -c . < coverage.json)" >> $GITHUB_ENV | ||
- name: Get Coverage Totals | ||
run: echo "COVERAGE_TOTAL=${{ fromJson(env.COVERAGE_JSON).totals.percent_covered_display }}" >> $GITHUB_ENV | ||
- name: Create Coverage Badge | ||
if: github.ref == 'refs/heads/main' | ||
uses: schneegans/[email protected] | ||
with: | ||
auth: ${{ secrets.GIST_TOKEN }} | ||
gistID: ${{ vars.GIST_COVERAGE_ID }} | ||
filename: ${{ vars.GIST_COVERAGE_NAME }} | ||
label: Coverage | ||
message: ${{ env.COVERAGE_TOTAL }}% | ||
valColorRange: ${{ env.COVERAGE_TOTAL }} | ||
maxColorRange: 90 | ||
minColorRange: 50 | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- coverage | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install PyPa's build package | ||
run: python -m pip install build | ||
- name: Build | ||
run: python -m build | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-${{ github.sha }} | ||
path: dist | ||
retention-days: 5 | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' | ||
needs: | ||
- build | ||
permissions: | ||
contents: write | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: build-${{ github.sha }} | ||
path: dist | ||
- name: Upload to GH Release | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
GH_REPO: ${{ github.repository }} | ||
run: | | ||
gh release upload "${{ github.ref_name }}" dist/*.tar.gz | ||
gh release upload "${{ github.ref_name }}" dist/*.whl | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
Oops, something went wrong.