Skip to content

Upgrade typer to support union types #3228

Upgrade typer to support union types

Upgrade typer to support union types #3228

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:
test:
name: Test
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- windows-2022
python-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Python and set up Poetry
uses: bakdata/ci-templates/actions/[email protected]
with:
poetry-version: "1.7.1"
python-version: ${{ matrix.python-version }}
- name: Check Poetry lock file consistency
run: poetry lock --check
- name: Install dependencies
run: poetry install --no-interaction
- name: Lint (ruff)
run: |
if [[ "$RUNNER_OS" == "Linux" && "${{ matrix.python-version }}" == "3.10" ]]
then
poetry run ruff check . --config pyproject.toml --output-format=github --no-fix
else
poetry run pre-commit run ruff-lint --all-files --show-diff-on-failure
fi;
- name: Formatting (ruff)
run: poetry run pre-commit run ruff-format --all-files --show-diff-on-failure
- name: Typing (pyright)
run: |
if [[ "$RUNNER_OS" == "Linux" && "${{ matrix.python-version }}" == "3.10" ]]
then
echo "::add-matcher::.github/pyright-matcher.json"
poetry run pre-commit run pyright --all-files
else
poetry run pre-commit run pyright --all-files
fi;
- name: Generate schema (kpops schema)
run: poetry run pre-commit run gen-schema --all-files --show-diff-on-failure
- name: Generate CLI Usage docs (typer-cli)
run: poetry run pre-commit run gen-docs-cli --all-files --show-diff-on-failure
- name: Generate Environment variable docs
run: poetry run pre-commit run gen-docs-env-vars --all-files --show-diff-on-failure
- name: Generate pipeline definitions
run: poetry run pre-commit run gen-docs-components --all-files --show-diff-on-failure
- name: Test
run: poetry run pytest tests
- name: Install docs dependencies
run: poetry install --with docs
- name: Check markdown, toml, css formatting
uses: dprint/[email protected]
if: runner.os == 'Linux'
- name: Test docs build (mkdocs)
run: poetry run mkdocs build -f docs/mkdocs.yml
publish-snapshot-version:
name: Publish snapshot to TestPyPI
needs: [test]
uses: bakdata/ci-templates/.github/workflows/[email protected]
with:
poetry-version: "1.7.1"
secrets:
pypi-token: ${{ secrets.TEST_PYPI_TOKEN }}
publish-docs-from-main:
runs-on: ubuntu-22.04
if: ${{ github.ref == 'refs/heads/main' }}
needs: [test]
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: [test]
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@v2
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