fix(ci): real source archive via git export-ignore, current stamping docs

This commit is contained in:
2026-08-20 22:06:15 +01:00
parent 64eef947a7
commit fcad24c2f0
5 changed files with 50 additions and 32 deletions
+15
View File
@@ -0,0 +1,15 @@
# export-ignore controls what `git archive` leaves out of the tree it
# packs. GoReleaser's `source:` block runs `git archive` under the hood
# (.goreleaser.yaml), so these entries are the actual filter for the
# release source tarball — not the archive block's own file globs, which
# have no negation syntax and cannot exclude anything.
vendor/ export-ignore
integration/ export-ignore
tools/ export-ignore
docs/ export-ignore
examples/ export-ignore
testdata/ export-ignore
.superpowers/ export-ignore
.github/ export-ignore
*_test.go export-ignore
.gitattributes export-ignore
+1
View File
@@ -1,6 +1,7 @@
.superpowers/ .superpowers/
*.wasm *.wasm
tools/yaegi-check/llmgw-yaegi-check tools/yaegi-check/llmgw-yaegi-check
dist/
# Rendered from integration/traefik/dynamic.yml.tmpl by `make integration-up` # Rendered from integration/traefik/dynamic.yml.tmpl by `make integration-up`
# (INTEGRATION_REAL_BASEURL substitution) — generated, not source. # (INTEGRATION_REAL_BASEURL substitution) — generated, not source.
+15 -21
View File
@@ -5,27 +5,21 @@ version: 2
builds: builds:
- skip: true - skip: true
# Create source archive for GitHub releases # Source archive for GitHub releases, built with `git archive` under the
archives: # hood. `git archive` reads .gitattributes export-ignore at the archived
- formats: [tar.gz] # commit — that is the real filter for test files and non-shipped dirs
name_template: "{{ .ProjectName }}_v{{ .Version }}_source" # (vendor/, tools/, integration/, docs/, examples/, testdata/,
files: # .superpowers/, .github/); see .gitattributes at the repo root.
- "*.go" #
- "**/*.go" # An `archives:` files-list with `!glob` excludes looked equivalent but was
- go.mod # not: GoReleaser's archive fileglob has no negation, so every `!`-prefixed
- go.sum # entry was a silent no-op and the tarball shipped every file the plain
- .traefik.yml # globs matched, tests and vendor included. `source:` avoids that trap
- LICENSE* # entirely because it does not use the archive fileglob at all.
- README* source:
# Exclude test files and non-shipped dirs from release archive enabled: true
- "!**/*_test.go" format: tar.gz
- "!testdata/**" name_template: "{{ .ProjectName }}_v{{ .Version }}_source"
- "!tools/**"
- "!integration/**"
- "!docs/**"
- "!examples/**"
- "!vendor/**"
- "!.superpowers/**"
checksum: checksum:
name_template: "{{ .ProjectName }}_v{{ .Version }}_checksums.txt" name_template: "{{ .ProjectName }}_v{{ .Version }}_checksums.txt"
+10 -2
View File
@@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"net/url" "net/url"
"regexp"
"strings" "strings"
"testing" "testing"
"time" "time"
@@ -216,8 +217,15 @@ func TestAdminOverview_SortedShapeAndVersion(t *testing.T) {
t.Fatalf("decode: %v", err) t.Fatalf("decode: %v", err)
} }
if got.Version != pluginVersion { // Assert shape, not identity: comparing against the pluginVersion const
t.Errorf("version = %q, want %q", got.Version, pluginVersion) // itself is tautological (it would pass even if the overview handler
// stopped reading pluginVersion at all, as long as it echoed some other
// copy of the same string). The real invariant is what version.go's
// stamping contract promises: either the unstamped dev sentinel, or a
// release semver a build stamped in.
versionShape := regexp.MustCompile(`^(0\.0\.0-dev|\d+\.\d+\.\d+)$`)
if got.Version == "" || !versionShape.MatchString(got.Version) {
t.Errorf("version = %q, want non-empty and matching %s", got.Version, versionShape)
} }
if len(got.Providers) != 2 || got.Providers[0].Name != "alpha" || got.Providers[1].Name != "zeta" { if len(got.Providers) != 2 || got.Providers[0].Name != "alpha" || got.Providers[1].Name != "zeta" {
+9 -9
View File
@@ -12,16 +12,16 @@
# $VERSION $VERSION_TAG $SEMVER $NEW_VERSION $RELEASE_VERSION # $VERSION $VERSION_TAG $SEMVER $NEW_VERSION $RELEASE_VERSION
# A leading "v"/"V" is stripped. # A leading "v"/"V" is stripped.
# #
# NOTE: go-release.yaml @main does not yet pass the computed version into this # go-release.yaml's release job already exposes the computed version to this
# step's environment. Add it to the "Run workflow prepare script" step, e.g.: # script's environment (shared-actions commit 58ab34e, "Run workflow prepare
# env: # script" step): VERSION carries the bare semver, VERSION_TAG the v-prefixed
# VERSION: ${{ needs.version.outputs.version }} # bare, no leading v # form. Stamping works end-to-end with no extra wiring in this repo.
# #
# The shared workflow runs this script in its test, version AND release jobs, # The shared workflow runs this script in its test, version AND release jobs,
# but only the release job has a computed version. So a missing version is a # but only the release job's step sets that env — the test/version jobs run
# no-op (leave the dev sentinel) — NOT a hard failure, otherwise the test/version # it with no version at all. So a missing version is a no-op (leave the dev
# jobs would break. A malformed version that IS provided is a hard error. Wire # sentinel) — NOT a hard failure, otherwise the test/version jobs would
# the env only on the release job's prepare step (see header note above). # break. A malformed version that IS provided is a hard error.
set -euo pipefail set -euo pipefail
FILE="version.go" FILE="version.go"
@@ -33,7 +33,7 @@ VER="${VER#V}"
if [ -z "$VER" ]; then if [ -z "$VER" ]; then
if [ "${GITHUB_ACTIONS:-}" = "true" ]; then if [ "${GITHUB_ACTIONS:-}" = "true" ]; then
echo "workflow-prepare: WARNING no version provided; leaving ${FILE} at the dev placeholder. If this is the release build, set 'env: VERSION: \${{ needs.version.outputs.version }}' on the release job's prepare step — otherwise the release ships 0.0.0-dev and the admin overview reports it." >&2 echo "workflow-prepare: WARNING no version provided; leaving ${FILE} at the dev placeholder. Expected on the test/version jobs. If this is the release job, the shared workflow's VERSION wiring (shared-actions commit 58ab34e) has broken — the release will ship 0.0.0-dev and the admin overview will report it." >&2
else else
echo "workflow-prepare: no version provided; leaving dev placeholder in ${FILE} (local build)" echo "workflow-prepare: no version provided; leaving dev placeholder in ${FILE} (local build)"
fi fi