python-package-ci.ymlโข3.29 kB
name: CI-CD
on: push
env:
UV_SYSTEM_PYTHON: 1
jobs:
test:
name: Run ruff, mypy and pytest ๐งช
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv with cache
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install dependencies
run: uv sync --locked --dev
- name: Run ruff format
run: uv run ruff format sequential_thinking
- name: Run ruff check
run: uv run ruff check sequential_thinking
- name: Run mypy
run: uv run mypy sequential_thinking
- name: Run tests
run: uv run pytest sequential_thinking
build:
name: Build distribution ๐ฆ
if: startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install uv with cache
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install dependencies
run: uv sync --locked
- name: Build a binary wheel and a source tarball
run: uv build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: >-
Publish Python ๐ distribution ๐ฆ to PyPI
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution ๐ฆ to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-to-docker-hub:
name: >-
Publish Docker ๐ณ image ๐ฆ to Docker Hub
if: startsWith(github.ref, 'refs/tags/')
needs: publish-to-pypi
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract Docker image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_USERNAME }}/sequential-thinking-mcp
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
file: ./Dockerfile.publish
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
provenance: true
sbom: true
push: true
build-args: VERSION=${{ github.ref_name }}