chore(go): replace releaseprep with vociferate flows
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "usage: $0 <version>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
release_date="$(date -u +%F)"
|
||||
|
||||
go run git.hrafn.xyz/aether/vociferate/cmd/releaseprep@latest \
|
||||
--root "$repo_root" \
|
||||
--version "$1" \
|
||||
--date "$release_date" \
|
||||
--version-file internal/homesick/version/version.go \
|
||||
--version-pattern 'const String = "([^"]+)"' \
|
||||
--changelog changelog.md
|
||||
@@ -1,50 +0,0 @@
|
||||
package script_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestPrepareReleaseScript_UsesVociferateReleaseprep(t *testing.T) {
|
||||
wd, err := os.Getwd()
|
||||
require.NoError(t, err)
|
||||
|
||||
repoRoot := filepath.Dir(wd)
|
||||
tempBin := t.TempDir()
|
||||
argsLog := filepath.Join(tempBin, "go-args.log")
|
||||
fakeGoPath := filepath.Join(tempBin, "go")
|
||||
|
||||
fakeGo := `#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
printf '%s\n' "$*" > "$GO_ARGS_LOG"
|
||||
`
|
||||
require.NoError(t, os.WriteFile(fakeGoPath, []byte(fakeGo), 0o755))
|
||||
|
||||
cmd := exec.Command("bash", filepath.Join(repoRoot, "script", "prepare-release.sh"), "v1.2.3")
|
||||
cmd.Dir = repoRoot
|
||||
cmd.Env = append(os.Environ(),
|
||||
"PATH="+tempBin+":"+os.Getenv("PATH"),
|
||||
"GO_ARGS_LOG="+argsLog,
|
||||
)
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
require.NoError(t, err, string(output))
|
||||
|
||||
invocationBytes, err := os.ReadFile(argsLog)
|
||||
require.NoError(t, err)
|
||||
invocation := strings.TrimSpace(string(invocationBytes))
|
||||
|
||||
require.Contains(t, invocation, "run git.hrafn.xyz/aether/vociferate/cmd/releaseprep@latest")
|
||||
require.Contains(t, invocation, "--root "+repoRoot)
|
||||
require.Contains(t, invocation, "--version v1.2.3")
|
||||
require.Contains(t, invocation, "--version-file internal/homesick/version/version.go")
|
||||
require.Contains(t, invocation, "--version-pattern const String = \"([^\"]+)\"")
|
||||
require.Contains(t, invocation, "--changelog changelog.md")
|
||||
require.Regexp(t, regexp.MustCompile(`--date [0-9]{4}-[0-9]{2}-[0-9]{2}`), invocation)
|
||||
}
|
||||
Reference in New Issue
Block a user