eadd28fac0
P01 — release/install pipeline fix (REQ-097, REQ-098; gate C-21).
release.sh (REQ-097):
- Cross-build linux-amd64 regardless of host arch (GOOS=linux GOARCH=amd64
go build, CGO_ENABLED=0). D-193: the host-arch build produced the wrong
tarball when cut from arm64 — root cause of the v0.8.x asset-less
releases.
- Hardcode tarball name to orca-${VERSION}-linux-amd64.tar.gz (not
host-arch-dependent).
- Post-create asset verification (C-21): after tea releases create, query
the Gitea API and assert the tarball appears in attachments. Retry once
via tea release edit if missing. Fail loudly if still missing. This
catches the tea CLI bug where create exits 0 without attaching the asset.
install.sh (REQ-098):
- Asset fallback walk: if the resolved release (latest or --version) lacks
the matching tarball, query /releases?limit=50, extract all
browser_download_urls from the list response (assets are inline), find
the newest release with a matching orca-*-linux-amd64.tar.gz asset, print
a WARNING, and use that release. Fixes the v0.4.5 install incident where
v0.8.15 had no asset and install.sh errored out with no fallback.
- --check dry-run mode (D-194): prints version + asset URL + install path
+ current version without writing anything.
Tests (scripts/tests/):
- install_test.bash: 5 tests (--help, --check happy path, --check fallback
walk, unknown arg rejection, --system root check).
- release_test.bash: 5 tests (script exists, syntax valid, cross-build
command present, amd64 tarball name hardcoded, asset verification present).
All 30 bats tests pass. make lint clean (no new warnings).
---ci---
project: orca
phase: 1
milestone: v0.10
status: execute
---/ci---
44 lines
1.5 KiB
Bash
44 lines
1.5 KiB
Bash
#!/usr/bin/env bats
|
|
# Tests for scripts/release.sh (REQ-097: cross-build amd64, asset verification).
|
|
# Hermetic: tests the tarball naming and cross-build logic without
|
|
# publishing a release. The full release flow requires GITEA_TOKEN + tea
|
|
# and is tested in CI.
|
|
|
|
load test_helper
|
|
|
|
@test "release.sh exists and is executable" {
|
|
[ -f "$SCRIPTS_DIR/release.sh" ]
|
|
[ -x "$SCRIPTS_DIR/release.sh" ]
|
|
}
|
|
|
|
@test "release.sh --help or usage shows required tools" {
|
|
# release.sh doesn't have a --help flag; the header comment is the
|
|
# usage. Verify the script is syntactically valid.
|
|
run bash -n "$SCRIPTS_DIR/release.sh"
|
|
assert_status 0 "$status"
|
|
}
|
|
|
|
@test "release.sh cross-builds linux-amd64 regardless of host arch" {
|
|
# Verify the script contains the cross-build command (D-193, REQ-097).
|
|
# We check the source rather than running it (which requires go + tea).
|
|
run grep -c "GOOS=linux GOARCH=amd64" "$SCRIPTS_DIR/release.sh"
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" -ge 1 ]
|
|
}
|
|
|
|
@test "release.sh hardcodes linux-amd64 tarball name" {
|
|
# The tarball name must be linux-amd64 (not host-arch-dependent).
|
|
run grep -c "orca-\${VERSION}-linux-amd64.tar.gz" "$SCRIPTS_DIR/release.sh"
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" -ge 1 ]
|
|
}
|
|
|
|
@test "release.sh has post-create asset verification (C-21)" {
|
|
# Verify the script contains the asset verification logic.
|
|
run grep -c "verifying asset" "$SCRIPTS_DIR/release.sh"
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" -ge 1 ]
|
|
run grep -c "verify_asset" "$SCRIPTS_DIR/release.sh"
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" -ge 1 ]
|
|
} |