Skip to content

Migrate from Poetry to uv #3515

Migrate from Poetry to uv

Migrate from Poetry to uv #3515

Workflow file for this run

name: CI
on:
pull_request:
types: [opened, ready_for_review, synchronize]
push:
branches:
- main
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
lint:
name: Lint
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- windows-2022
python-version: ["3.11", "3.12"]
include:
- python-version: "3.11"
os: ubuntu-22.04
format-for-github: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
version: latest
- name: Check uv.lock
run: uv lock --check
- name: Lint (ruff)
run: |
if [[ "${{ matrix.format-for-github }}" == "true" ]]
then
uv run --frozen ruff check . --config pyproject.toml --output-format=github --no-fix
else
uv run --frozen ruff check . --config pyproject.toml --no-fix
fi;
- name: Formatting (ruff)
run: uv run --frozen ruff format
- name: Typing (pyright)
run: |
if [[ "${{ matrix.format-for-github }}" == "true" ]]
then
echo "::add-matcher::.github/pyright-matcher.json"
fi;
uv run --frozen pyright
- name: Check markdown, toml, css formatting
uses: dprint/[email protected]
if: ${{ runner.os == 'Linux' }}
test:
name: Test
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- windows-2022
python-version: ["3.11", "3.12"]
include:
- python-version: "3.11"
os: ubuntu-22.04
format-for-github: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
version: latest
- name: Test
run: uv run --frozen pytest tests
docs:
name: Docs
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.11"
version: latest
- name: Generate schema (kpops schema)
run: uv run --frozen pre-commit run gen-schema --all-files --show-diff-on-failure
- name: Generate CLI Usage docs (typer-cli)
run: uv run --frozen pre-commit run gen-docs-cli --all-files --show-diff-on-failure
- name: Generate Environment variable docs
run: uv run --frozen pre-commit run gen-docs-env-vars --all-files --show-diff-on-failure
- name: Generate pipeline definitions
run: uv run --frozen pre-commit run gen-docs-components --all-files --show-diff-on-failure
- name: Test docs build (mkdocs)
run: uv run --frozen --group=docs mkdocs build -f docs/mkdocs.yml
# TODO: publish using uv
# publish-snapshot-version:
# name: Publish snapshot to TestPyPI
# needs: [lint, test]
# uses: bakdata/ci-templates/.github/workflows/[email protected]
# with:
# python-version: "3.11"
# secrets:
# pypi-token: ${{ secrets.TEST_PYPI_TOKEN }}
publish-docs-from-main:
runs-on: ubuntu-22.04
if: ${{ github.ref == 'refs/heads/main' }}
needs: [lint, test, docs]
steps:
- uses: actions/checkout@v4
- name: Publish docs from main branch
uses: ./.github/actions/update-docs
with:
username: ${{ secrets.GH_USERNAME }}
email: ${{ secrets.GH_EMAIL }}
token: ${{ secrets.GH_TOKEN }}
version: main
publish-dev-docs-from-pr:
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'pull_request' }}
needs: [lint, test, docs]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# Checks to see if any files in the PR match one of the listed file types.
# This will return true if there's a file in docs folder that was added, deleted, or modified in the PR.
- name: Check if files in docs folder have changed
uses: dorny/paths-filter@v3
id: docs-changes
with:
filters: |
docs:
- added|deleted|modified: 'docs/**'
- name: Publish dev docs from PR
if: steps.docs-changes.outputs.docs == 'true'
uses: ./.github/actions/update-docs
with:
username: ${{ secrets.GH_USERNAME }}
email: ${{ secrets.GH_EMAIL }}
token: ${{ secrets.GH_TOKEN }}
version: dev