Files
coder/scripts/releaser/docs_test.go
T
Garrett Delfosse 591f357574 chore: remove releaser v2 flow and drop v1 naming (#27421)
## Summary

Removes the GitHub Actions-driven releaser **v2** pipeline so the
interactive release wizard is the only release path, and drops the `v1`
naming now that it is the sole implementation.

## Changes

- Delete `.github/workflows/tag-and-release.yaml` (the v2 workflow).
- Delete `scripts/releaser/v2/`.
- Move `scripts/releaser/v1/` into `scripts/releaser/` as `package
main`.
- Rewrite `scripts/releaser/main.go` to a single wizard command: drop
the `--legacy` flag and the v2 `rc`/`branch`/`release` subcommands and
hidden CI compat commands. `--dry-run` is preserved.
- Update `scripts/release.sh` to run `go run ./scripts/releaser "$@"`
(no `--legacy`).

The legacy `release.yaml` workflow (triggered by `scripts/release.sh`)
is unchanged and remains the release pipeline.

## Validation

- `go build ./scripts/releaser/...`
- `go test ./scripts/releaser/...`
- `go vet` + `golangci-lint run ./scripts/releaser/...`
- `gofmt -l` clean

> [!NOTE]
> The GPG signing key check removal is handled in a stacked follow-up PR
based on this branch.

<details>
<summary>Implementation plan</summary>

- v2 flow = `scripts/releaser/v2/` +
`.github/workflows/tag-and-release.yaml` (uses `go run
./scripts/releaser prepare-release|generate-notes`). `v2` was imported
only by `main.go`; the workflow was referenced nowhere else.
- v1 flow = interactive wizard in `scripts/releaser/v1/`, reached via
`--legacy`, driving `release.yaml` (triggered by `scripts/release.sh`).
- No `docs/` referenced the releaser tool or these workflows.
- Steps: delete the v2 workflow and package; move `v1/*` up to
`scripts/releaser/` (`package main`, including test files); rewrite
`main.go` to a single wizard command; update `release.sh`.

</details>

---
Generated by Coder Agents on behalf of @f0ssel.
2026-07-24 12:52:01 -04:00

86 lines
2.3 KiB
Go

package main //nolint:testpackage // Tests unexported release helpers.
import "testing"
// TestUpdateCalendarLatestReleaseVersionPrefix checks the formatting of the
// "Latest Release" cell produced by updateCalendar. version.String() already
// includes a leading "v", so the link label must not add a second one, while
// the release tag URL keeps the "v" because tags are prefixed with it.
func TestUpdateCalendarLatestReleaseVersionPrefix(t *testing.T) {
t.Parallel()
tests := []struct {
name string
newVer version
channel string
want string
}{
{
name: "patch release",
newVer: version{Major: 2, Minor: 35, Patch: 1},
channel: "mainline",
want: "[v2.35.1](https://github.com/coder/coder/releases/tag/v2.35.1)",
},
{
name: "minor release",
newVer: version{Major: 2, Minor: 35, Patch: 0},
channel: "mainline",
want: "[v2.35.0](https://github.com/coder/coder/releases/tag/v2.35.0)",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
rows := []calendarRow{{
ReleaseName: "2.35",
Major: 2,
Minor: 35,
ReleaseDate: "February 03, 2026",
Status: "Mainline",
LatestRelease: "N/A",
}}
got := updateCalendar(rows, tt.newVer, tt.channel)
var cell string
for _, r := range got {
if r.Major == tt.newVer.Major && r.Minor == tt.newVer.Minor {
cell = r.LatestRelease
break
}
}
if cell != tt.want {
t.Fatalf("LatestRelease = %q, want %q", cell, tt.want)
}
})
}
}
// TestUpdateCalendarNotReleasedRowName checks that a "Not Released" row is
// promoted to "Mainline" with a major.minor "Release name" link (patch
// omitted) once its minor version is released.
func TestUpdateCalendarNotReleasedRowName(t *testing.T) {
t.Parallel()
rows := []calendarRow{{
ReleaseName: "2.36",
Major: 2,
Minor: 36,
Status: "Not Released",
LatestRelease: "N/A",
}}
got := updateCalendar(rows, version{Major: 2, Minor: 36, Patch: 0}, "mainline")
if got[0].Status != "Mainline" {
t.Errorf("Status = %q, want %q", got[0].Status, "Mainline")
}
const want = "[2.36](https://coder.com/changelog/coder-2-36)"
if got[0].ReleaseName != want {
t.Fatalf("ReleaseName = %q, want %q", got[0].ReleaseName, want)
}
}