chore(typegen): add canary python types runtime #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate Python Type Generation | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| validate-python-types: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project | |
| run: npm run build | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python dependencies | |
| run: | | |
| pip install pydantic mypy | |
| - name: Start test database | |
| working-directory: test/db | |
| run: | | |
| docker compose up -d --wait | |
| - name: Wait for database to be ready | |
| run: | | |
| # Install PostgreSQL client for health check | |
| sudo apt-get update && sudo apt-get install -y postgresql-client | |
| until pg_isready -h localhost -p 5432 -U postgres; do | |
| echo "Waiting for database..." | |
| sleep 1 | |
| done | |
| echo "Database is ready!" | |
| - name: Generate Python types | |
| id: generate-types | |
| run: | | |
| node --loader ts-node/esm scripts/generate-python-types-test.ts > generated_types.py | |
| echo "Generated Python types (first 30 lines):" | |
| head -30 generated_types.py | |
| - name: Validate Python types runtime | |
| run: | | |
| python -c "import generated_types; print('✓ Generated Python types are valid and can be imported')" | |
| - name: Validate Python types with mypy | |
| run: | | |
| mypy generated_types.py --strict | |
| - name: Cleanup | |
| if: always() | |
| working-directory: test/db | |
| run: docker compose down |