Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .coveragerc

This file was deleted.

70 changes: 70 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build

on:
workflow_call:
workflow_dispatch:

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
test:
uses: ./.github/workflows/test.yml
permissions:
contents: read
build:
name: Build distribution 📦
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml

- name: Install Hatch
uses: pypa/hatch@a3c83ab3d481fbc2dc91dd0088628817488dd1d5

- name: Set package version from tag
run: hatch version $(git describe --tags --always)

- name: Build package
run: hatch build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

sign-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
needs:
- build
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Store the signature files
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
overwrite: true
39 changes: 39 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Codecov Report Upload

on:
push:
branches:
- master
pull_request:

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
cov-report:
name: Generate and publish coverage report
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml

- name: Install Hatch
uses: pypa/hatch@a3c83ab3d481fbc2dc91dd0088628817488dd1d5

- name: Run coverage
run: hatch test --cover -i python=3.13

- name: Generate coverage report
run: hatch run coverage:xml

- name: Publish coverage report to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
42 changes: 42 additions & 0 deletions .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Prepare release

on:
push:
tags:
- '*'
workflow_call:
workflow_dispatch:

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
build:
uses: ./.github/workflows/build.yml
permissions:
contents: read
id-token: write # IMPORTANT: mandatory for sigstore in build.yml

create-release:
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Release
id: create-draft-release
uses: softprops/action-gh-release@v2
with:
files: |
./dist/*
draft: true
- name: Summary
run: |
echo "# Release summary" >> $GITHUB_STEP_SUMMARY
echo "Url: ${{ steps.create-draft-release.outputs.url }}" >> $GITHUB_STEP_SUMMARY
echo "You can now publish the release on GitHub" >> $GITHUB_STEP_SUMMARY
64 changes: 34 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
name: Publish on PyPI
name: Publish

on:
release:
types:
- published
branches:
- master
workflow_call:
workflow_dispatch:

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-18.04
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/prices
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: read

steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Download all the dists from the release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release download
'${{ github.ref_name }}'
-p '*.whl'
-p '*.tar.gz'
--dir dist/
--repo '${{ github.repository }}'
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests

on:
push:
branches:
- master
pull_request:
workflow_call:
workflow_dispatch:

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml

- name: Install Hatch
uses: pypa/hatch@a3c83ab3d481fbc2dc91dd0088628817488dd1d5

- name: Run static analysis
run: hatch fmt --check

- name: Run tests
run: hatch test --all
37 changes: 0 additions & 37 deletions .github/workflows/tests.yml

This file was deleted.

Loading