From dde3447b92812715ee893fa77b1c729ac3e85323 Mon Sep 17 00:00:00 2001 From: Robert Lippmann Date: Tue, 1 Sep 2026 12:11:19 -0400 Subject: [PATCH 1/2] ci: condition validation jobs by changed paths --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b9e095..0c766a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,73 @@ on: - main jobs: + changes: + runs-on: ubuntu-latest + outputs: + python: ${{ steps.classify.outputs.python }} + typescript: ${{ steps.classify.outputs.typescript }} + markdown: ${{ steps.classify.outputs.markdown }} + steps: + - name: Check out repository + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Classify changed files + id: classify + env: + BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} + HEAD_SHA: ${{ github.sha }} + run: | + set -euo pipefail + + if [[ "${BASE_SHA:-}" =~ ^0+$ ]]; then + changed_files="$(git show --format= --name-only "${HEAD_SHA}")" + else + changed_files="$(git diff --name-only "${BASE_SHA}" "${HEAD_SHA}")" + fi + + run_python=false + run_typescript=false + run_markdown=false + run_all=false + + while IFS= read -r path; do + [[ -z "${path}" ]] && continue + case "${path}" in + .github/workflows/*|.github/actions/*|.pre-commit-config.yaml) + run_all=true + ;; + .markdownlint-cli2.jsonc|*.md) + run_markdown=true + ;; + python/*|context_compiler_example_integrations/*|pyproject.toml|uv.lock|scripts/validate_python.sh) + run_python=true + ;; + typescript/*|scripts/validate_typescript.sh|scripts/validate_typescript_fast.sh) + run_typescript=true + ;; + *) + run_all=true + ;; + esac + done <<< "${changed_files}" + + if [[ "${run_all}" == true ]]; then + run_python=true + run_typescript=true + run_markdown=true + fi + + { + echo "python=${run_python}" + echo "typescript=${run_typescript}" + echo "markdown=${run_markdown}" + } >> "${GITHUB_OUTPUT}" + markdownlint: + needs: changes + if: needs.changes.outputs.markdown == 'true' runs-on: ubuntu-latest steps: - name: Check out repository @@ -24,6 +90,8 @@ jobs: run: npx --yes markdownlint-cli2 python-validation: + needs: changes + if: needs.changes.outputs.python == 'true' runs-on: ubuntu-latest strategy: matrix: @@ -47,6 +115,8 @@ jobs: run: ./scripts/validate_python.sh typescript-validation: + needs: changes + if: needs.changes.outputs.typescript == 'true' runs-on: ubuntu-latest steps: - name: Check out repository From 0ccf6266e39dc560e20d4f24771ee10099db0b05 Mon Sep 17 00:00:00 2001 From: Robert Lippmann Date: Tue, 1 Sep 2026 12:18:31 -0400 Subject: [PATCH 2/2] ci: optimize Python validation --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c766a8..1d5dc9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,6 +89,37 @@ jobs: - name: Run Markdown lint run: npx --yes markdownlint-cli2 + python-quality: + needs: changes + if: needs.changes.outputs.python == 'true' + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v7 + + - name: Set up uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + cache-dependency-glob: uv.lock + + - name: Set up Python 3.11 + uses: actions/setup-python@v6 + with: + python-version: "3.11" + + - name: Sync Python dependencies + run: uv sync --locked --group dev --no-editable + + - name: Run Ruff check + run: uv run --no-sync ruff check + + - name: Run Ruff format check + run: uv run --no-sync ruff format --check + + - name: Run mypy + run: uv run --no-sync mypy + python-validation: needs: changes if: needs.changes.outputs.python == 'true' @@ -102,6 +133,9 @@ jobs: - name: Set up uv uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + cache-dependency-glob: uv.lock - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 @@ -109,10 +143,10 @@ jobs: python-version: ${{ matrix.python-version }} - name: Sync Python dependencies - run: uv sync --group dev --no-editable + run: uv sync --locked --group dev --no-editable - - name: Run Python validation - run: ./scripts/validate_python.sh + - name: Run Python tests + run: uv run --no-sync pytest python/tests typescript-validation: needs: changes