@@ -140,6 +140,14 @@ expect_refused "resolve: refuses a base above upstream's latest release" "above |
140 | 140 | echo v0.1.10 > "$root/api/upstream_latest" |
141 | 141 | expect_resolved "resolve: accepts it once upstream marks it latest" 0.1.10-fork.1 |
142 | 142 |
|
| 143 | +reset_api v0.1.10 |
| 144 | +echo '[{"id":5,"draft":false,"prerelease":false,"tag_name":"v0.1.10-fork.3"}]' > "$root/api/releases.json" |
| 145 | +new_fork v0.1.9 |
| 146 | +expect_refused "resolve: refuses a build below a published release (older ref after a newer one)" \ |
| 147 | + "v0.1.10-fork.3 is published and not below 0.1.9-fork.1" "$root/work" resolve |
| 148 | +echo '[{"id":5,"draft":true,"prerelease":false,"tag_name":"v0.1.10-fork.3"}]' > "$root/api/releases.json" |
| 149 | +expect_resolved "resolve: a higher draft does not block (updaters skip drafts)" 0.1.9-fork.1 |
| 150 | + |
143 | 151 | # --- remove-drafts ----------------------------------------------------------------------------- |
144 | 152 | new_upstream |
145 | 153 | reset_api |
|
182 | 190 | reset_api |
183 | 191 | echo '[{"id":5,"draft":false,"prerelease":false,"tag_name":"v0.1.10-fork.1"}, |
184 | 192 | {"id":9,"draft":true,"prerelease":false,"tag_name":"v0.1.9-fork.2"}]' > "$root/api/releases.json" |
185 | | -if run "$root/work" publish 9 v0.1.9-fork.2 0.1.9-fork.2 && grep -qx "patched 9 draft=false make_latest=false" "$root/api/writes"; then |
186 | | - pass "publish: an older version is published without becoming latest" |
| 193 | +expect_refused "publish: refuses a version below a published release (server takes the newest created)" \ |
| 194 | + "v0.1.10-fork.1 is published and not below 0.1.9-fork.2" "$root/work" publish 9 v0.1.9-fork.2 0.1.9-fork.2 |
| 195 | +[[ ! -e "$root/api/writes" ]] || fail "publish: nothing written for an older version" |
| 196 | + |
| 197 | +reset_api |
| 198 | +echo '[{"id":5,"draft":false,"prerelease":true,"tag_name":"v0.1.10-fork.1"}, |
| 199 | + {"id":9,"draft":true,"prerelease":false,"tag_name":"v0.1.9-fork.2"}]' > "$root/api/releases.json" |
| 200 | +expect_refused "publish: a higher prerelease also blocks (the server ignores the prerelease flag)" \ |
| 201 | + "not below" "$root/work" publish 9 v0.1.9-fork.2 0.1.9-fork.2 |
| 202 | + |
| 203 | +reset_api |
| 204 | +echo '[{"id":4,"draft":false,"prerelease":false,"tag_name":"v0.2.0-nightly.20261101.3"}, |
| 205 | + {"id":6,"draft":false,"prerelease":false,"tag_name":"notes"}, |
| 206 | + {"id":9,"draft":true,"prerelease":false,"tag_name":"v0.1.9-fork.2"}]' > "$root/api/releases.json" |
| 207 | +if run "$root/work" publish 9 v0.1.9-fork.2 0.1.9-fork.2 && grep -qx "patched 9 draft=false make_latest=true" "$root/api/writes"; then |
| 208 | + pass "publish: nightly and non-version tags are other channels and do not block" |
187 | 209 | else |
188 | | - fail "publish: an older version is published without becoming latest" |
| 210 | + fail "publish: nightly and non-version tags are other channels and do not block" |
189 | 211 | fi |
190 | 212 |
|
| 213 | +reset_api |
| 214 | +echo '[{"id":4,"draft":false,"prerelease":false,"tag_name":"v0.1.8-rc.1"}]' > "$root/api/releases.json" |
| 215 | +expect_refused "publish: a stable-channel tag it cannot order fails loudly" "cannot be ordered" \ |
| 216 | + "$root/work" publish 9 v0.1.9-fork.2 0.1.9-fork.2 |
| 217 | + |
191 | 218 | reset_api |
192 | 219 | echo '[{"id":9,"draft":true,"prerelease":false,"tag_name":"v0.1.9-fork.1"}]' > "$root/api/releases.json" |
193 | 220 | expect_refused "publish: re-checks the tag right before un-drafting" "already exists" "$root/work" publish 9 v0.1.9-fork.1 0.1.9-fork.1 |
@@ -199,17 +226,56 @@ expect_refused "publish: a failed release listing fails the step" "Could not lis |
199 | 226 | [[ ! -e "$root/api/writes" ]] || fail "publish: nothing written after a failed listing" |
200 | 227 |
|
201 | 228 | # --- check-archives ---------------------------------------------------------------------------- |
202 | | -mkdir -p "$root/arch/good/t3" "$root/arch/bad/t3" "$root/assets-good" "$root/assets-bad" "$root/assets-none" |
203 | | -printf 'x\0const repo = "me/t3code";\0' > "$root/arch/good/t3/t3" |
204 | | -printf 'x\0const repo = "up/t3code";\0' > "$root/arch/bad/t3/t3" |
205 | | -tar -czf "$root/assets-good/t3-0.1.9-fork.1-linux-x64.tar.gz" -C "$root/arch/good" t3 |
206 | | -(cd "$root/arch/good" && python3 -I -m zipfile -c "$root/assets-good/t3-0.1.9-fork.1-win-x64.zip" t3) |
207 | | -cp "$root/assets-good/"*.tar.gz "$root/assets-bad/" |
208 | | -(cd "$root/arch/bad" && python3 -I -m zipfile -c "$root/assets-bad/t3-0.1.9-fork.1-win-x64.zip" t3) |
209 | | -if run "$root" check-archives "$root/assets-good"; then pass "check-archives: archives naming this fork pass"; else fail "check-archives: archives naming this fork pass"; fi |
210 | | -expect_refused "check-archives: an archive naming upstream fails" "win-x64.zip does not name me/t3code" "$root" check-archives "$root/assets-bad" |
| 229 | +# Layout of scripts/build-cli-archive.ts: <stem>/t3 (t3.exe in the Windows zip) plus <stem>/client/. |
| 230 | +# The web client names this fork on every Actions build (upstream's apps/web/vite.config.ts), so it |
| 231 | +# must not count; only the program does. |
| 232 | +stage() { # stage DIR STEM PROGRAM PROGRAM_REPO CLIENT_REPO |
| 233 | + mkdir -p "$1/$2/client/assets" |
| 234 | + printf 'x\0const repo = "%s";\0' "$4" > "$1/$2/$3" |
| 235 | + printf 'const u = "%s";' "$5" > "$1/$2/client/assets/index.js" |
| 236 | +} |
| 237 | +pack() { # pack DIR STEM OUT |
| 238 | + case "$3" in |
| 239 | + *.tar.gz) tar -czf "$3" -C "$1" "$2" ;; |
| 240 | + *.zip) (cd "$1" && python3 -I -m zipfile -c "$3" "$2") ;; |
| 241 | + esac |
| 242 | +} |
| 243 | +lin=t3-0.1.9-fork.1-linux-x64 win=t3-0.1.9-fork.1-win-x64 |
| 244 | +mkdir -p "$root/assets-good" "$root/assets-bad" "$root/assets-repro" "$root/assets-noprog" "$root/assets-none" |
| 245 | +stage "$root/arch/good" "$lin" t3 me/t3code me/t3code |
| 246 | +stage "$root/arch/good" "$win" t3.exe me/t3code me/t3code |
| 247 | +pack "$root/arch/good" "$lin" "$root/assets-good/$lin.tar.gz" |
| 248 | +pack "$root/arch/good" "$win" "$root/assets-good/$win.zip" |
| 249 | +cp "$root/assets-good/$lin.tar.gz" "$root/assets-bad/" |
| 250 | +stage "$root/arch/bad" "$win" t3.exe up/t3code up/t3code |
| 251 | +pack "$root/arch/bad" "$win" "$root/assets-bad/$win.zip" |
| 252 | +# The review's repro: t3 names upstream, the web client names the fork. |
| 253 | +stage "$root/arch/repro" "$lin" t3 up/t3code me/t3code |
| 254 | +pack "$root/arch/repro" "$lin" "$root/assets-repro/$lin.tar.gz" |
| 255 | +# No program at all, but the client names the fork. |
| 256 | +mkdir -p "$root/arch/noprog/$lin/client" && printf '"me/t3code"' > "$root/arch/noprog/$lin/client/x.js" |
| 257 | +printf '"me/t3code"' > "$root/arch/noprog/$lin/t3.sh" |
| 258 | +pack "$root/arch/noprog" "$lin" "$root/assets-noprog/$lin.tar.gz" |
| 259 | +if run "$root" check-archives "$root/assets-good"; then pass "check-archives: archives whose program names this fork pass"; else fail "check-archives: archives whose program names this fork pass"; fi |
| 260 | +expect_refused "check-archives: an archive naming upstream fails" "$win/t3.exe in $win.zip does not name me/t3code" "$root" check-archives "$root/assets-bad" |
| 261 | +expect_refused "check-archives: t3 names upstream, client/ names the fork -> fails" "$lin/t3 in $lin.tar.gz does not name me/t3code" "$root" check-archives "$root/assets-repro" |
| 262 | +expect_refused "check-archives: a missing program fails" "has no $lin/t3" "$root" check-archives "$root/assets-noprog" |
211 | 263 | expect_refused "check-archives: no archive at all fails" "No CLI archive" "$root" check-archives "$root/assets-none" |
212 | 264 |
|
| 265 | +# --- check-bundle (apps/server/dist with the web client in dist/client) ------------------------ |
| 266 | +bundle() { # bundle NAME SERVER_REPO CLIENT_REPO |
| 267 | + mkdir -p "$root/dist-$1/client/assets" |
| 268 | + printf 'const repo = "%s";' "$2" > "$root/dist-$1/bin.mjs" |
| 269 | + printf 'const u = "%s";' "$3" > "$root/dist-$1/client/assets/index.js" |
| 270 | +} |
| 271 | +bundle good me/t3code me/t3code |
| 272 | +bundle repro up/t3code me/t3code |
| 273 | +mkdir -p "$root/dist-clientonly/client" && printf '"me/t3code"' > "$root/dist-clientonly/client/x.js" |
| 274 | +if run "$root" check-bundle "$root/dist-good"; then pass "check-bundle: a server bundle naming this fork passes"; else fail "check-bundle: a server bundle naming this fork passes"; fi |
| 275 | +expect_refused "check-bundle: server names upstream, client/ names the fork -> fails" "outside client/) does not name me/t3code" "$root" check-bundle "$root/dist-repro" |
| 276 | +expect_refused "check-bundle: only client/ files -> fails" "no files outside client/" "$root" check-bundle "$root/dist-clientonly" |
| 277 | +expect_refused "check-bundle: a missing bundle fails" "No server bundle" "$root" check-bundle "$root/dist-missing" |
| 278 | + |
213 | 279 | # --- version order ----------------------------------------------------------------------------- |
214 | 280 | check_gt() { |
215 | 281 | if (cd "$root" && "$script" version-gt "$1" "$2") 2> /dev/null; then got=gt; else got=not; fi |
|