Skip to content

chore(release): 0.0.9 #49

chore(release): 0.0.9

chore(release): 0.0.9 #49

Workflow file for this run

name: tests
on:
push:
branches: [master]
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
permissions:
contents: write
concurrency:
group: >-
${{ github.workflow }}-${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
TOX_VERSION: "4.49.1"
TOX_UV_VERSION: "1.33.4"
UV_VERSION: "0.10.11"
MIN_PYTHON_VERSION: "3.10"
MAX_PYTHON_VERSION: "3.13"
jobs:
check-commits:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # deep clone for setuptools-scm
- name: Prevent fixup/squash/WIP commits
run: |
BASE_SHA=$(git merge-base origin/main HEAD 2>/dev/null || git merge-base origin/master HEAD)
git log $BASE_SHA..HEAD --pretty=%s | grep -E '^(fixup!|squash!|WIP|wip)' && exit 1 || echo "✅ ok"
prepare:
runs-on: ubuntu-24.04
outputs:
wheel-distribution: ${{ steps.wheel-distribution.outputs.path }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # deep clone for setuptools-scm
- uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Run static analysis and format checkers
run: >-
uv tool run
--from "tox==${{ env.TOX_VERSION }}"
--with "tox-uv==${{ env.TOX_UV_VERSION }}"
tox -e lint
- name: Build package distribution files
run: >-
uv tool run
--from "tox==${{ env.TOX_VERSION }}"
--with "tox-uv==${{ env.TOX_UV_VERSION }}"
tox -e clean,build
- name: Record the path of wheel distribution
id: wheel-distribution
run: echo "path=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
- name: Extract version
id: get_version
run: |
path=$(ls dist/*.whl)
version=$(basename "$path" | sed -E 's/lob_hlpr-([^-]+)-py3-none-any\.whl/\1/')
echo "VERSION=$version" >> $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@v7
with:
name: python-distribution-files
path: dist/
retention-days: 1
test:
needs: prepare
strategy:
matrix:
python:
- "3.10"
- "3.13"
platform:
- ubuntu-24.04
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
python-version: ${{ matrix.python }}
- name: Retrieve pre-built distribution files
uses: actions/download-artifact@v8
with:
name: python-distribution-files
path: dist/
- name: Run tests
run: >-
uv tool run
--from "tox==${{ env.TOX_VERSION }}"
--with "tox-uv==${{ env.TOX_UV_VERSION }}"
tox --installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
-- -rFEx --durations 10 --color yes
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [test, prepare]
runs-on: ubuntu-24.04
steps:
- name: Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
publish-to-pypi:
name: >-
Publish Python distribution to PyPI
needs:
- release
runs-on: ubuntu-24.04
environment:
name: pypi
url: https://pypi.org/p/lob-hlpr # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-distribution-files
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1