Add initial plugin implementation #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '**' | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
workflow_dispatch: | |
permissions: | |
contents: read | |
id-token: write | |
pages: write | |
actions: write # Necessary to cancel workflow executions | |
checks: write # Necessary to write reports | |
pull-requests: write # Necessary to comment on PRs | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.5.27" | |
enable-cache: true | |
cache-dependency-glob: | | |
pyproject.toml | |
- name: Install Dependencies | |
run: uv venv && source .venv/bin/activate && uv sync --dev --all-extras | |
- name: Lint | |
run: .venv/bin/ruff check . | |
mypy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.5.27" | |
enable-cache: true | |
cache-dependency-glob: | | |
pyproject.toml | |
- name: Install Dependencies | |
run: uv venv && source .venv/bin/activate && uv sync --dev --all-extras | |
- name: Lint | |
run: .venv/bin/mypy . | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.13" | |
- "3.12" | |
- "3.11" | |
- "3.10" | |
fail-fast: false | |
steps: | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.5.27" | |
enable-cache: true | |
cache-dependency-glob: | | |
pyproject.toml | |
- name: Install Dependencies | |
run: uv venv && source .venv/bin/activate && uv sync --dev --all-extras | |
- run: mkdir coverage | |
- name: Test | |
run: .venv/bin/coverage run -m pytest . | |
env: | |
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }} | |
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }} | |
- name: Store coverage files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ matrix.python-version }}-${{ matrix.pydantic-version }} | |
path: coverage | |
include-hidden-files: true | |
coverage-combine: | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.5.27" | |
enable-cache: true | |
cache-dependency-glob: | | |
pyproject.toml | |
- name: Install Dependencies | |
run: uv venv && source .venv/bin/activate && uv sync --dev --all-extras | |
- name: Get coverage files | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: coverage-* | |
path: coverage | |
merge-multiple: true | |
- run: ls -la coverage | |
- run: .venv/bin/coverage combine coverage | |
- run: .venv/bin/coverage report | |
- run: .venv/bin/coverage html --title "Coverage for ${{ github.sha }}" | |
- run: .venv/bin/coverage-badge -o htmlcov/coverage.svg -f | |
- name: Store coverage HTML | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-html | |
path: htmlcov | |
include-hidden-files: true | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- coverage-combine | |
- mypy | |
- lint | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install flit | |
run: pip install flit | |
- name: Upload package to PyPI | |
env: | |
FLIT_USERNAME: "__token__" | |
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }} | |
FLIT_INDEX_URL: "https://upload.pypi.org/legacy/" | |
run: flit publish |