Skip to content

update ci-cd workflow #2

update ci-cd workflow

update ci-cd workflow #2

Workflow file for this run

name: Python CI/CD

Check failure on line 1 in .github/workflows/python-ci-cd.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/python-ci-cd.yml

Invalid workflow file

(Line: 95, Col: 12): Job 'deploy-docs' depends on unknown job 'cd'.
permissions:
contents: write
id-token: write
on:
workflow_call:
inputs:
run-deploy:
description: 'Set to "true" to run the build and deploy jobs if tests pass.'
required: false
type: boolean
default: false
jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Set up the environment
uses: ./.github/actions/setup-python-env
- name: Run checks
run: make check
tests:
name: Lint, Test & Type Check
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python-env
with:
python-version: ${{ matrix.python-version }}
- name: Run Ruff checks
run: |
uv run ruff check .
uv run ruff format . --check
- name: Run Pytest
run: |
uv run pytest
- name: Run tests
run: uv run python -m pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
# - name: Check typing
# run: uv run ty check
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
uses: codecov/codecov-action@v4
if: ${{ matrix.python-version == '3.11' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build-and-deploy:
name: Build & Deploy
needs: tests
if: ${{ inputs.run-deploy == true }}
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: ./.github/actions/setup-python-env
- name: Build sdist and wheel with uv
run: |
uv build
- name: Publish package to PyPI
run: uv publish
deploy-docs:
needs: cd
if: ${{ inputs.run-deploy == true }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up the environment
uses: ./.github/actions/setup-python-env
- name: Deploy documentation
run: uv run mkdocs gh-deploy --force