mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
Publish pipeline: goreleaser + Maven Central + npm (#1)
* feat(cli): add Version var and version subcommand * build(gradle): introduce uatu.version property for lockstep releases * build(sdk-android): swap GitHub Packages for vanniktech Maven Central plugin * build(spec-api): make package publish-ready for npm * ci(release): add goreleaser config for cross-platform uatu CLI builds * ci: add ci and release GitHub Actions workflows * ci: restrict ci.yml to PR + workflow_dispatch (no direct push to master) * docs(release): add local release targets, env example, and install docs * build(sdk-android): make signAllPublications conditional on signing key * ci(release): stage sidecar JAR at embed path before go build * chore(spec-api): regenerate package-lock for updated package.json * ci: install protoc-gen-go plugins before buf generate * ci: bump Node to 22 (required for --experimental-strip-types)
This commit is contained in:
17 files changed
+556
-37
No files matched your search
@@ -10,6 +10,10 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Version is stamped at build time via goreleaser ldflags.
|
||||
// Default "dev" marks untagged local builds.
|
||||
var Version = "dev"
|
||||
|
||||
type testOptions struct {
|
||||
spec string
|
||||
bundleID string
|
||||
@@ -29,6 +33,7 @@ Usage:
|
||||
Commands:
|
||||
test Run a spec against an app for a fixed duration.
|
||||
doctor Check that the host environment is ready to run uatu.
|
||||
version Print the uatu version.
|
||||
|
||||
Run "uatu <command> -h" for command-specific flags.
|
||||
`
|
||||
@@ -87,6 +92,9 @@ func run(args []string, stdout, stderr io.Writer) error {
|
||||
return runTest(options, stdout)
|
||||
case "doctor":
|
||||
return runDoctor(stdout)
|
||||
case "version", "-v", "--version":
|
||||
fmt.Fprintln(stdout, Version)
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("unknown command: %q (try 'uatu help')", args[1])
|
||||
}
|
||||
|
||||
@@ -95,6 +95,22 @@ func TestRun_HelpPrintsUsage(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRun_VersionPrintsVersion(t *testing.T) {
|
||||
prev := Version
|
||||
Version = "1.2.3-test"
|
||||
defer func() { Version = prev }()
|
||||
|
||||
for _, arg := range []string{"version", "--version", "-v"} {
|
||||
var stdout bytes.Buffer
|
||||
if err := run([]string{"uatu", arg}, &stdout, io.Discard); err != nil {
|
||||
t.Fatalf("%s: %v", arg, err)
|
||||
}
|
||||
if strings.TrimSpace(stdout.String()) != "1.2.3-test" {
|
||||
t.Errorf("%s: got %q, want 1.2.3-test", arg, stdout.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRun_UnknownCommand(t *testing.T) {
|
||||
err := run([]string{"uatu", "wat"}, io.Discard, io.Discard)
|
||||
if err == nil || !strings.Contains(err.Error(), "unknown command") {
|
||||
|
||||
Reference in new issue
Block a user