Add Gitea Actions CI pipeline
Three-stage workflow: lint/format/type-check (ruff, ty), pytest, and (master pushes only) a version-bump + uv build + publish to the Gitea package registry. Bump commit is tagged [skip ci] to avoid retriggering the workflow. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint & type check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
- run: uv sync --extra cpu --extra dev
|
||||
- run: uv run ruff check .
|
||||
- run: uv run ruff format --check .
|
||||
- run: uv run ty check .
|
||||
|
||||
test:
|
||||
name: Tests
|
||||
needs: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
- run: uv sync --extra cpu --extra dev
|
||||
- run: uv run pytest
|
||||
|
||||
build:
|
||||
name: Bump version, build & publish wheel
|
||||
needs: [lint, test]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.CI_TOKEN }}
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
- name: Bump patch version
|
||||
run: |
|
||||
git config user.name "gitea-actions"
|
||||
git config user.email "actions@git.larsbogner.de"
|
||||
uv version --bump patch --no-sync
|
||||
NEW_VERSION=$(uv version --short)
|
||||
git add pyproject.toml uv.lock
|
||||
git commit -m "chore: bump version to ${NEW_VERSION} [skip ci]"
|
||||
git push
|
||||
- run: uv build
|
||||
- name: Publish to Gitea package registry
|
||||
env:
|
||||
TWINE_USERNAME: ${{ secrets.PACKAGE_USERNAME }}
|
||||
TWINE_PASSWORD: ${{ secrets.CI_TOKEN }}
|
||||
run: uvx twine upload --repository-url https://git.larsbogner.de/api/packages/lars/pypi dist/*
|
||||
Reference in New Issue
Block a user