|
5 | 5 | pull_request: |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - template-quality: |
| 8 | + test: |
9 | 9 | runs-on: ubuntu-latest |
10 | 10 | steps: |
11 | 11 | - uses: actions/checkout@v4 |
12 | | - with: |
13 | | - fetch-depth: 0 |
14 | 12 | - uses: astral-sh/setup-uv@v6 |
15 | 13 | with: |
16 | 14 | enable-cache: true |
17 | 15 | - run: uv python install 3.14 |
18 | 16 | - run: uv sync --all-groups |
19 | | - - name: Template static checks |
20 | | - run: uv run python scripts/lint_template.py |
21 | | - - name: Migration goldens are append-only |
22 | | - if: github.event_name == 'pull_request' |
23 | | - run: uv run python scripts/check_migration_goldens.py ${{ github.event.pull_request.base.sha }} |
24 | | - - name: Migration goldens are append-only on push |
25 | | - if: github.event_name == 'push' && github.event.before != '0000000000000000000000000000000000000000' |
26 | | - run: uv run python scripts/check_migration_goldens.py ${{ github.event.before }} |
| 17 | + - run: uv run python scripts/lint_template.py |
27 | 18 | - run: uv run ruff check . |
28 | 19 | - run: uv run ruff format --check . |
29 | 20 | - run: uv run ty check |
30 | 21 | - run: uv run pytest |
31 | | - |
32 | | - generated-projects: |
33 | | - runs-on: ubuntu-latest |
34 | | - services: |
35 | | - postgres: |
36 | | - image: postgres:17-alpine |
37 | | - env: |
38 | | - POSTGRES_DB: app |
39 | | - POSTGRES_USER: postgres |
40 | | - POSTGRES_PASSWORD: postgres |
41 | | - ports: |
42 | | - - 5432:5432 |
43 | | - options: >- |
44 | | - --health-cmd "pg_isready -U postgres -d app" |
45 | | - --health-interval 2s |
46 | | - --health-timeout 3s |
47 | | - --health-retries 15 |
48 | | - redis: |
49 | | - image: redis:8-alpine |
50 | | - ports: |
51 | | - - 6379:6379 |
52 | | - options: >- |
53 | | - --health-cmd "redis-cli ping" |
54 | | - --health-interval 2s |
55 | | - --health-timeout 3s |
56 | | - --health-retries 15 |
57 | | - strategy: |
58 | | - fail-fast: false |
59 | | - matrix: |
60 | | - include: |
61 | | - - name: default |
62 | | - data: '{}' |
63 | | - migrate: false |
64 | | - - name: postgresql-sqlalchemy-logfire |
65 | | - data: '{"database":"postgresql","orm_type":"sqlalchemy","enable_logfire":true,"include_example_crud":true}' |
66 | | - migrate: true |
67 | | - - name: postgresql-sqlmodel |
68 | | - data: '{"database":"postgresql","orm_type":"sqlmodel","enable_docker":false,"include_example_crud":true}' |
69 | | - migrate: true |
70 | | - - name: taskiq-redis-consumers |
71 | | - data: '{"background_tasks":"taskiq","enable_redis":true,"enable_caching":true,"enable_rate_limiting":true,"rate_limit_storage":"redis","rate_limit_requests":2,"rate_limit_period":1}' |
72 | | - migrate: false |
73 | | - - name: pydantic-ai-logfire |
74 | | - data: '{"ai_framework":"pydantic_ai","enable_logfire":true,"enable_docker":false}' |
75 | | - migrate: false |
76 | | - - name: full-nginx |
77 | | - data: '{"database":"postgresql","orm_type":"sqlalchemy","background_tasks":"taskiq","ai_framework":"pydantic_ai","enable_logfire":true,"enable_redis":true,"enable_caching":true,"enable_rate_limiting":true,"rate_limit_storage":"redis","rate_limit_requests":2,"rate_limit_period":1,"enable_docker":true,"reverse_proxy":"nginx_external"}' |
78 | | - migrate: true |
79 | | - - name: docker-ci-off |
80 | | - data: '{"enable_docker":false,"ci_type":"none","enable_rate_limiting":true,"rate_limit_storage":"memory","rate_limit_requests":2,"rate_limit_period":1}' |
81 | | - migrate: false |
82 | | - name: generated-${{ matrix.name }} |
83 | | - env: |
84 | | - POSTGRES_HOST: 127.0.0.1 |
85 | | - POSTGRES_PORT: 5432 |
86 | | - POSTGRES_USER: postgres |
87 | | - POSTGRES_PASSWORD: postgres |
88 | | - POSTGRES_DB: app |
89 | | - REDIS_HOST: 127.0.0.1 |
90 | | - REDIS_PORT: 6379 |
91 | | - LOGFIRE_SEND_TO_LOGFIRE: 'false' |
92 | | - steps: |
93 | | - - uses: actions/checkout@v4 |
94 | | - - uses: astral-sh/setup-uv@v6 |
95 | | - with: |
96 | | - enable-cache: true |
97 | | - - run: uv python install 3.14 |
98 | | - - run: uv sync --all-groups |
99 | | - - name: Copier render |
100 | | - env: |
101 | | - COPIER_DATA: ${{ matrix.data }} |
102 | | - run: | |
103 | | - uv run python -c "import json, os, pathlib; pathlib.Path('.ci-data.json').write_text(json.dumps(json.loads(os.environ['COPIER_DATA'])), encoding='utf-8')" |
104 | | - uv run copier copy --defaults --data-file .ci-data.json . generated |
105 | | - - name: Generated project uv sync |
106 | | - working-directory: generated |
107 | | - run: uv sync --all-groups |
108 | | - - name: Apply database migrations |
109 | | - if: matrix.migrate |
110 | | - working-directory: generated |
111 | | - run: uv run alembic upgrade head |
112 | | - - name: Generated project quality |
113 | | - working-directory: generated |
114 | | - run: | |
115 | | - uv run ruff check . |
116 | | - uv run ruff format --check . |
117 | | - uv run ty check |
118 | | - uv run pytest |
119 | | - - name: Runtime smoke |
120 | | - working-directory: generated |
121 | | - run: | |
122 | | - uv run uvicorn app.main:app --host 127.0.0.1 --port 8000 & |
123 | | - server_pid=$! |
124 | | - trap 'kill "$server_pid"' EXIT |
125 | | - for attempt in {1..30}; do |
126 | | - curl --fail --silent http://127.0.0.1:8000/health/live && exit 0 |
127 | | - sleep 1 |
128 | | - done |
129 | | - exit 1 |
0 commit comments