-
Notifications
You must be signed in to change notification settings - Fork 3
215 lines (189 loc) · 7.22 KB
/
Copy pathsmoke-distribution.yml
File metadata and controls
215 lines (189 loc) · 7.22 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: Distribution smoke tests
# Smoke-tests each published distribution channel:
# uvx — PyPI via uvx
# docker — pull & run ulisesjeremias/create-awesome-python-app:latest
# homebrew — brew install on macos-latest
# aur — makepkg inside an archlinux container
# versions — cross-check channel versions against PyPI
on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
permissions:
contents: read
env:
PACKAGE_NAME: create-awesome-python-app
DOCKER_IMAGE: ulisesjeremias/create-awesome-python-app
concurrency:
group: smoke-distribution
cancel-in-progress: true
jobs:
uvx:
name: uvx (PyPI)
runs-on: ubuntu-latest
steps:
- uses: astral-sh/setup-uv@v7
- name: Smoke uvx
run: |
set -euo pipefail
VERSION="$(uvx "$PACKAGE_NAME@latest" --version 2>&1)"
echo "uvx version: $VERSION"
echo "$VERSION" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+' || {
echo "::error::Unexpected uvx version output: $VERSION"
exit 1
}
uvx "$PACKAGE_NAME@latest" --help > /tmp/cpa-help.txt
test -s /tmp/cpa-help.txt
python3 -c "from pathlib import Path; print('\n'.join(Path('/tmp/cpa-help.txt').read_text().splitlines()[:5]))"
docker:
name: Docker Hub
runs-on: ubuntu-latest
steps:
- name: Pull image
run: docker pull "$DOCKER_IMAGE:latest"
- name: Verify --version
run: |
VERSION=$(docker run --rm ulisesjeremias/create-awesome-python-app:latest --version 2>&1)
echo "docker version: $VERSION"
echo "$VERSION" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+' || {
echo "::error::Unexpected version output: $VERSION"
exit 1
}
- name: Verify --help
run: |
docker run --rm "$DOCKER_IMAGE:latest" --help > /tmp/cpa-help.txt
test -s /tmp/cpa-help.txt
python3 -c "from pathlib import Path; print('\n'.join(Path('/tmp/cpa-help.txt').read_text().splitlines()[:5]))"
# Image must ship git so template/extension clones work (see #219).
- name: Verify scaffold smoke
run: |
set -euo pipefail
mkdir -p /tmp/cpa-docker-smoke
docker run --rm \
-e CI=true \
-v /tmp/cpa-docker-smoke:/out \
-w /out \
--user root \
"$DOCKER_IMAGE:latest" \
--template fastapi-starter \
--addons github-setup \
--no-interactive \
--no-install \
--refresh always \
/out/app
test -d /tmp/cpa-docker-smoke/app/.github/workflows
test -d /tmp/cpa-docker-smoke/app/app
homebrew:
name: Homebrew (Create-Python-App/tap)
runs-on: macos-latest
steps:
- name: Tap and install
run: |
brew tap Create-Python-App/tap
brew trust create-python-app/tap || true
brew install create-awesome-python-app
- name: Verify --version
run: |
VERSION=$(create-awesome-python-app --version 2>&1)
echo "homebrew version: $VERSION"
echo "$VERSION" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+' || {
echo "::error::Unexpected version output: $VERSION"
exit 1
}
- name: Verify --help
run: |
create-awesome-python-app --help > /tmp/cpa-help.txt
test -s /tmp/cpa-help.txt
python3 -c "from pathlib import Path; print('\n'.join(Path('/tmp/cpa-help.txt').read_text().splitlines()[:5]))"
aur:
name: AUR (archlinux container)
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Bootstrap Arch system and non-root builder
run: |
pacman -Sy --noconfirm --needed \
python python-pip python-build python-installer python-wheel \
base-devel sudo git curl ca-certificates
useradd -m -G wheel builder
echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
- name: Clone AUR package and build
run: |
su builder -c "
set -euo pipefail
# Prefer live AUR; fall back to GitHub mirror during bootstrap.
if git clone https://aur.archlinux.org/create-awesome-python-app.git /tmp/cpa 2>/dev/null; then
cd /tmp/cpa
else
git clone https://github.com/Create-Python-App/aur-package.git /tmp/cpa
cd /tmp/cpa
fi
makepkg -si --noconfirm
"
- name: Verify --version
run: |
su builder -c "
VERSION=\$(create-awesome-python-app --version 2>&1)
echo \"aur version: \$VERSION\"
echo \"\$VERSION\" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+' || exit 1
"
- name: Verify --help
run: |
su builder -c "create-awesome-python-app --help > /tmp/cpa-help.txt && test -s /tmp/cpa-help.txt"
python3 -c "from pathlib import Path; print('\n'.join(Path('/tmp/cpa-help.txt').read_text().splitlines()[:5]))"
versions:
name: Cross-check published versions
runs-on: ubuntu-latest
if: always()
steps:
- uses: astral-sh/setup-uv@v7
- name: Gather versions from each channel
run: |
set -euo pipefail
PYPI=$(
curl -sfL https://pypi.org/pypi/create-awesome-python-app/json \
| python3 -c "import json,sys; print(json.load(sys.stdin)['info']['version'])"
)
DOCKER=$(
docker run --rm "$DOCKER_IMAGE:latest" --version 2>&1 \
| grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \
| head -1 \
|| echo "unavailable"
)
FORMULA_URL="https://raw.githubusercontent.com/Create-Python-App/homebrew-tap/main/Formula/create-awesome-python-app.rb"
HOMEBREW=$(
curl -sfL "$FORMULA_URL" \
| grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \
| head -1 \
|| echo "unavailable"
)
AUR_RPC="https://aur.archlinux.org/rpc/v5/info?arg=create-awesome-python-app"
AUR=$(
curl -sfL "$AUR_RPC" \
| python3 -c "import json,sys; d=json.load(sys.stdin); r=d.get('results') or []; print(r[0]['Version'].split('-')[0] if r else 'unavailable')" \
|| echo "unavailable"
)
echo "Channel versions:"
echo " pypi: $PYPI"
echo " docker: $DOCKER"
echo " homebrew: $HOMEBREW"
echo " aur: $AUR"
{
echo "## Distribution smoke versions"
echo
echo "| Channel | Version |"
echo "|---------|---------|"
echo "| PyPI | $PYPI |"
echo "| Docker | $DOCKER |"
echo "| Homebrew | $HOMEBREW |"
echo "| AUR | $AUR |"
} >> "$GITHUB_STEP_SUMMARY"
for CHANNEL_VER in "$DOCKER" "$HOMEBREW"; do
if [ "$CHANNEL_VER" != "unavailable" ] && [ "$CHANNEL_VER" != "$PYPI" ]; then
echo "::warning::Version mismatch vs pypi=$PYPI: $CHANNEL_VER"
fi
done
if [ "$AUR" != "unavailable" ] && [ "$AUR" != "$PYPI" ]; then
echo "::warning::Version mismatch: pypi=$PYPI aur=$AUR (AUR may lag)"
fi