ci: Switch to uv
This commit is contained in:
+28
-22
@@ -7,47 +7,53 @@ on:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
enable-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m venv .venv
|
||||
.venv/bin/pip install -e ".[dev]" -q
|
||||
- name: Run unit tests
|
||||
run: uv run --extra dev pytest tests/unit/ -v --tb=short
|
||||
|
||||
- name: Run tests
|
||||
run: .venv/bin/pytest tests/ -v
|
||||
integration-tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Pull container image
|
||||
run: docker pull python:3.11-slim
|
||||
|
||||
- name: Run integration tests
|
||||
run: uv run --extra dev pytest tests/integration/ -v --tb=short
|
||||
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
needs: [unit-tests, integration-tests]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
enable-cache: true
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
pip install build -q
|
||||
python -m build
|
||||
run: uv build
|
||||
|
||||
- name: Publish to Gitea package registry
|
||||
env:
|
||||
TWINE_USERNAME: ${{ github.repository_owner }}
|
||||
TWINE_PASSWORD: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
pip install twine -q
|
||||
twine upload \
|
||||
--repository-url ${{ gitea.server_url }}/api/packages/${{ github.repository_owner }}/pypi \
|
||||
dist/*
|
||||
UV_PUBLISH_URL: ${{ gitea.server_url }}/api/packages/${{ github.repository_owner }}/pypi
|
||||
UV_PUBLISH_USERNAME: ${{ github.repository_owner }}
|
||||
UV_PUBLISH_PASSWORD: ${{ secrets.GITEA_TOKEN }}
|
||||
run: uv publish
|
||||
|
||||
Reference in New Issue
Block a user