name: CI
on:
push:
branches:
- main
tags:
- "**"
pull_request: {}
env:
COLUMNS: 150
UV_PYTHON: 3.13
UV_FROZEN: "1"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- run: uv sync
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.UV_PYTHON }}|${{ hashFiles('.pre-commit-config.yaml') }}
- run: uvx pre-commit run --color=always --all-files --verbose
env:
SKIP: no-commit-to-branch
test:
name: test py${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
env:
UV_PYTHON: ${{ matrix.python-version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- run: uv sync
- run: make test
env:
COVERAGE_FILE: coverage/.coverage.py${{ matrix.python-version }}
- run: uv run mcp-run-python --deps numpy example
- name: store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: coverage
include-hidden-files: true
coverage:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
- name: get coverage files
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: coverage
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- run: uvx coverage combine coverage
- run: uvx coverage report --fail-under 95
check:
if: always()
needs: [lint, test, coverage]
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
release:
needs: [check]
if: success() && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/project/mcp-run-python/${{ steps.check-package-version.outputs.VERSION }}
permissions:
id-token: write
outputs:
package-version: ${{ steps.check-python-version.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- id: check-package-version
uses: samuelcolvin/check-python-version@v5
with:
version_file_path: pyproject.toml
- run: make build
- run: uv build
- run: uv publish --trusted-publishing always