Skip to content

DEMO: CI codegen check #2

DEMO: CI codegen check

DEMO: CI codegen check #2

Workflow file for this run

name: Check Python codegen
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
jobs:
check-python-codegen:
name: Check Python codegen
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.x"
- name: Set up uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
- name: Install dependencies
run: |
uv venv
source .venv/bin/activate
uv pip install ".[dev_codegen]"
- name: Run codegen
run: |
source .venv/bin/activate
python commands.py codegen
- name: Check for changes
run: |
# Fail if codegen produced any changes to the working directory.
# This means the committed generated files are out of date and codegen
# needs to be re-run locally and the results committed.
if [ -n "$(git status --porcelain)" ]; then
echo "::error::Generated files are out of date. Please run 'python commands.py codegen' locally and commit the result."
echo "The following files differ after running codegen:"
git status --porcelain
echo ""
exit 1
fi
echo "Generated files are up to date."