feat: implement CI/CD workflows for testing, linting, and publishing to PyPI

This commit is contained in:
bohd4nx
2026-03-15 21:45:24 +02:00
parent d2d046a2b9
commit 9a090e3dbc
21 changed files with 438 additions and 57 deletions
+31
View File
@@ -0,0 +1,31 @@
name: Lint
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
lint:
name: Lint & format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7.5.0
- name: Install dev dependencies
run: uv pip install --system ".[dev]"
- name: Run ruff
run: ruff check .
- name: Run black
run: black --check . --target-version py312
+49
View File
@@ -0,0 +1,49 @@
name: Publish to PyPI
on:
push:
branches: [master]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7.5.0
- name: Build distribution
run: uv build
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/*
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/fragmentapi/
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v8.0.1
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.13.0
+7 -4
View File
@@ -8,18 +8,21 @@ on:
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
cache: "pip"
- name: Install uv
uses: astral-sh/setup-uv@v7.5.0
- name: Install dependencies
run: pip install -r requirements.txt pytest pytest-asyncio
run: uv pip install --system ".[dev]"
- name: Write cookies.json
if: ${{ env.COOKIES_JSON != '' }}