-
Notifications
You must be signed in to change notification settings - Fork 3
116 lines (105 loc) · 3.59 KB
/
Copy pathscaffold-cross-platform.yml
File metadata and controls
116 lines (105 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Cross-platform scaffold smoke
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Monday 06:00 UTC (CNA parity)
- cron: "0 6 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: scaffold-cross-platform-${{ github.ref }}
cancel-in-progress: true
env:
# Full registry URLs: published PyPI 0.1.0 does not resolve catalog slugs.
# After create-awesome-python-app>=0.2.0 ships resolve_catalog_spec, slugs also work.
CPA_TEMPLATE_FASTAPI: https://github.com/Create-Python-App/cpa-templates?subdir=templates/fastapi-starter
CPA_ADDON_DOCKER: https://github.com/Create-Python-App/cpa-templates?subdir=extensions/fastapi-docker
CPA_ADDON_GITHUB: https://github.com/Create-Python-App/cpa-templates?subdir=extensions/all-github-setup
jobs:
scaffold:
name: ${{ matrix.os }} / fastapi-starter
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Scaffold FastAPI starter from PyPI CLI
env:
TARGET: ${{ runner.temp }}/cpa-fastapi-starter
shell: bash
run: |
set -euo pipefail
# Options before project_directory — Typer treats a leading path as the
# positional arg; trailing options after a bare path can be misparsed.
uvx create-awesome-python-app@latest \
--template "$CPA_TEMPLATE_FASTAPI" \
--no-interactive \
--no-install \
--force \
"$TARGET"
- name: Verify scaffolded project
env:
TARGET: ${{ runner.temp }}/cpa-fastapi-starter
shell: bash
run: |
set -euo pipefail
python - <<'PY'
import os
from pathlib import Path
target = Path(os.environ["TARGET"])
required = [
target / "pyproject.toml",
target / "app" / "main.py",
target / "README.md",
]
missing = [str(path) for path in required if not path.exists()]
if missing:
raise SystemExit(f"Missing scaffolded files: {missing}")
print(f"Verified scaffold at {target}")
PY
addon-smoke:
name: ${{ matrix.os }} / fastapi-starter + docker + github-setup
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Scaffold with compatible addon combination
env:
TARGET: ${{ runner.temp }}/cpa-fastapi-addons
shell: bash
run: |
set -euo pipefail
uvx create-awesome-python-app@latest \
--template "$CPA_TEMPLATE_FASTAPI" \
--addons "$CPA_ADDON_DOCKER" \
--addons "$CPA_ADDON_GITHUB" \
--no-interactive \
--no-install \
--force \
"$TARGET"
- name: Verify extension files
env:
TARGET: ${{ runner.temp }}/cpa-fastapi-addons
shell: bash
run: |
set -euo pipefail
test -f "$TARGET/Dockerfile"
test -f "$TARGET/.dockerignore"
test -d "$TARGET/.github"