-
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
Showing
5 changed files
with
170 additions
and
57 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Publish to PyPI | ||
on: | ||
workflow_dispatch: | ||
release: | ||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release | ||
types: [prereleased] | ||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
|
||
build: | ||
needs: ['test'] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install Hatch | ||
run: pip install hatch | ||
|
||
- name: Build package distributions | ||
run: hatch build | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist | ||
|
||
# https://docs.pypi.org/trusted-publishers/using-a-publisher/ | ||
pypi-publish: | ||
needs: ['build'] | ||
environment: 'publish' | ||
|
||
name: upload release to PyPI | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# Mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: artifact/ | ||
print-hash: true | ||
repository-url: https://test.pypi.org/legacy/ |
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,47 @@ | ||
name: Publish to PyPI | ||
on: | ||
release: | ||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release | ||
types: [released] | ||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
|
||
build: | ||
needs: ['test'] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install Hatch | ||
run: pip install hatch | ||
|
||
- name: Build package distributions | ||
run: hatch build | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist | ||
|
||
# https://docs.pypi.org/trusted-publishers/using-a-publisher/ | ||
pypi-publish: | ||
needs: ['build'] | ||
environment: 'publish' | ||
|
||
name: upload release to PyPI | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# Mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: artifact/ | ||
print-hash: true |
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,74 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
defaults: | ||
run: | ||
working-directory: ./src | ||
|
||
jobs: | ||
linting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install hatch | ||
run: pip install hatch | ||
|
||
- name: Run linting | ||
run: hatch fmt --check | ||
|
||
testing: | ||
runs-on: ubuntu-latest | ||
continue-on-error: ${{ matrix.experimental }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python: ["3.9", "3.10", "3.11", "3.12"] | ||
experimental: [false] | ||
toxenv: ["py"] | ||
include: | ||
# Test against future django-crispy-forms. Allowed to fail. | ||
- python: "3.12" | ||
toxenv: crispymain | ||
experimental: true | ||
# Test against future django-tables2. Allowed to fail. | ||
- python: "3.12" | ||
toxenv: tables2main | ||
experimental: true | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '${{ matrix.python }}' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install tox coverage | ||
- name: Run tox targets for Python ${{ matrix.python }} | ||
run: | | ||
# Run only the tox environments that match the Python version | ||
tox run -f py$(echo ${{ matrix.python }} | tr -d .) | ||
coverage combine | ||
coverage report | ||
# Codecov does not support the .coverage file generated by coverage, so we convert it to xml | ||
coverage xml | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v4 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |