Skip to content

fix(dotprompt-dart,dotprompt-java,dotprompt-rs): support dotted partial names #1441

fix(dotprompt-dart,dotprompt-java,dotprompt-rs): support dotted partial names

fix(dotprompt-dart,dotprompt-java,dotprompt-rs): support dotted partial names #1441

Workflow file for this run

# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: Python checks
on:
pull_request:
branches: [main]
jobs:
check-paths:
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
python/**
spec/**
.github/workflows/python.yml
uv-lock-check:
needs: check-paths
if: needs.check-paths.outputs.any_changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v6
with:
# Use the PR head ref to allow pushing back to the branch
ref: ${{ github.head_ref }}
# Use a token that can push to the branch (for release-please PRs)
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Check if this is a release-please PR
id: check-release-please
run: |
if [[ "${GITHUB_HEAD_REF}" == release-please--* ]]; then
echo "is_release_please=true" >> $GITHUB_OUTPUT
else
echo "is_release_please=false" >> $GITHUB_OUTPUT
fi
- name: Update lockfiles for release-please PR
if: steps.check-release-please.outputs.is_release_please == 'true'
working-directory: python
run: |
echo "Updating uv.lock for release-please PR..."
uv lock
../scripts/export_requirements
- name: Commit lockfile updates
if: steps.check-release-please.outputs.is_release_please == 'true'
run: |
# Use CLA-covered maintainer identity from MAINTAINERS.yaml
git config user.name "$(yq '.ci.commit_author.name' MAINTAINERS.yaml)"
git config user.email "$(yq '.ci.commit_author.email' MAINTAINERS.yaml)"
if ! git diff --quiet python/uv.lock python/requirements.txt; then
git add python/uv.lock python/requirements.txt
git commit -m "chore: update Python lockfiles"
git push
echo "Lockfiles updated and pushed"
else
echo "No lockfile changes needed"
fi
- name: Check uv.lock is up to date
working-directory: python
run: |
uv lock --check
- name: Check requirements.txt is up to date
run: |
scripts/export_requirements
git diff --exit-code python/requirements.txt
- name: Run security scan
run: scripts/run_python_security_checks
python-checks:
needs: check-paths
if: needs.check-paths.outputs.any_changed == 'true'
runs-on: ${{ matrix.os }}
env:
PATH: ${{ github.workspace }}/go/bin:${{ github.workspace }}/.cargo/bin:${{ github.workspace }}/.local/share/pnpm:${{ github.workspace }}/.local/bin:/usr/local/bin:/usr/bin:/bin
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1
# Enable sccache for Rust builds
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
matrix:
os:
- ubuntu-latest # x86_64
- ubuntu-24.04-arm # ARM64
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
exclude:
# PyPy not available on ARM64 runners yet
- os: ubuntu-24.04-arm
python-version: "pypy-3.11"
include:
# Add PyPy only for x86_64
- os: ubuntu-latest
python-version: "pypy-3.11"
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: stable
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
env:
RUSTUP_MAX_RETRIES: 3
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install uv and setup Python version
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Format check
run: uv run --active --directory python ruff format --check --preview .
- name: Lint with ruff
run: uv run --active --directory python ruff check --select I .
- name: Static type check (ty)
run: uv run --active --directory python ty check
- name: Static type check (pyrefly)
run: uv run --active --directory python pyrefly check
# TODO(#505): Move this to a rust workflow once we have one.
- name: Run rust lint
run: pushd python/handlebarrz && cargo clippy --all-targets --all-features -- -D warnings && popd
- name: Check licenses
run: ./scripts/check_license
- name: Run Rust checks for handlebarrz
run: ./scripts/run_handlebarrz_checks
- name: Build Rust extension for Python ${{ matrix.python-version }}
working-directory: ./python
run: |
uv run --python ${{ matrix.python-version }} --active --isolated --directory handlebarrz maturin develop
- name: Run Python tests for Python ${{ matrix.python-version }}
working-directory: ./python
run: |
uv run --python ${{ matrix.python-version }} --active --isolated pytest -xvvs --log-level=DEBUG .
- name: Build distributions
run: ./scripts/build_dists
python-checks-all:
if: always()
needs: [uv-lock-check, python-checks]
runs-on: ubuntu-latest
steps:
- name: Check overall status
run: |
if [[ "${NEEDS_UV_LOCK_CHECK_RESULT}" == "failure" || "${NEEDS_PYTHON_CHECKS_RESULT}" == "failure" ]]; then
echo "Python checks failed"
exit 1
fi
echo "Python checks passed or were skipped"
exit 0
env:
NEEDS_UV_LOCK_CHECK_RESULT: ${{ needs.uv-lock-check.result }}
NEEDS_PYTHON_CHECKS_RESULT: ${{ needs.python-checks.result }}