Skip to content

Commit

Permalink
Add workflow for checking if types are up-to-date
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Dec 9, 2024
1 parent 42186fe commit 38fe44a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/check-update-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test - Python

on:
workflow_dispatch:
push:
branches: ["main", "rc-*"]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
release:
types: [published]

env:
UV_VERSION: "0.4.x"
PYTHON_VERSION: 3.13

jobs:
check-types-updated:
name: Check provider types
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: 🚀 Install uv
uses: astral-sh/setup-uv@v3

- name: 🐍 Set up Python ${{ matrix.config.python-version }}
run: uv python install ${{matrix.config.python-version }}

- name: 📦 Install the project
run: uv sync --python ${{ matrix.config.python-version }} --all-extras

- name: Run type update
run: make update-types

# Fail if there are changes under chatlas/types and throw a useful error message
- name: Check for changes
run: |
git diff --exit-code chatlas/types
if [ $? -ne 0 ]; then
echo "Types are out of date. Please run 'make update-types' and commit the changes."
exit 1
fi
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ update-snaps:
@echo "📸 Updating pytest snapshots"
uv run pytest --snapshot-update

.PHONY: update-types
update-types:
@echo "📝 Updating chat provider types"
uv run python scripts/main.py

.PHONY: help
help: ## Show help messages for make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; { \
Expand Down

0 comments on commit 38fe44a

Please sign in to comment.