Skip to content

Merge branch 'release/v0.1.5' #18

Merge branch 'release/v0.1.5'

Merge branch 'release/v0.1.5' #18

Workflow file for this run

name: Build
on:
push:
tags:
- 'v*'
branches:
- 'main'
- 'dev'
- 'feature/*'
- 'hotfix/*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.26"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install the project
run: uv sync
- name: Build the project
run: uv build
- name: Upload built artifacts
uses: actions/upload-artifact@v4
with:
name: package
path: dist/*
tests:
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.26"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set PYTHONPATH (Linux/macOS)
if: runner.os != 'Windows'
run: echo "PYTHONPATH=$PWD/src" >> $GITHUB_ENV
shell: bash
- name: Set PYTHONPATH (Windows)
if: runner.os == 'Windows'
run: echo PYTHONPATH=%CD%\src >> %GITHUB_ENV%
shell: cmd
- name: Install the project
run: uv sync --all-extras --dev
- name: Run Ruff
run: uv run ruff check
- name: Run Pytests
run: uv run pytest tests
publish:
runs-on: ubuntu-latest
needs: [build, tests]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Download built artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Get latest tag and update pyproject.toml
run: |
VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
echo "Using version: $VERSION"
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.26"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Upload to PyPI
env:
PYPI_USERNAME: ${{ secrets.PP_UN }}
PYPI_PASSWORD: ${{ secrets.PP_TK }}
UV_PUBLISH_TOKEN: ${{ secrets.PP_TK }}
run: |
uv build
uv publish
- name: Clean up
run: |
rm -rf dist