From 58a6ba4e301529d109810ad543c348580b7c8eff Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 17 Jul 2023 21:26:18 -0300 Subject: [PATCH] feat(scoop): support arm64 (#4193) adds arm64 support to scoops. Signed-off-by: Carlos Alexandro Becker --- internal/pipe/scoop/scoop.go | 5 ++++- internal/pipe/scoop/scoop_test.go | 14 ++++++++++++++ .../testdata/Test_buildManifest/common.json.golden | 8 ++++++++ .../gitlab_url_template.json.golden | 8 ++++++++ .../pre-post-install.json.golden | 8 ++++++++ .../Test_buildManifest/url_template.json.golden | 8 ++++++++ 6 files changed, 50 insertions(+), 1 deletion(-) diff --git a/internal/pipe/scoop/scoop.go b/internal/pipe/scoop/scoop.go index ae105361b..2bbfc7dbe 100644 --- a/internal/pipe/scoop/scoop.go +++ b/internal/pipe/scoop/scoop.go @@ -40,7 +40,7 @@ func (e ErrIncorrectArchiveCount) Error() string { _, _ = b.WriteString(fmt.Sprintf("but found %d archives ", len(e.archives))) } - _, _ = b.WriteString(fmt.Sprintf("matching the given filters: goos=windows goarch=[386 amd64] goamd64=%s ids=%s", e.goamd64, e.ids)) + _, _ = b.WriteString(fmt.Sprintf("matching the given filters: goos=windows goarch=[386 amd64 arm64] goamd64=%s ids=%s", e.goamd64, e.ids)) if len(e.archives) > 0 { names := make([]string, 0, len(e.archives)) @@ -129,6 +129,7 @@ func doRun(ctx *context.Context, scoop config.Scoop, cl client.ReleaserURLTempla artifact.ByGoarch("amd64"), artifact.ByGoamd64(scoop.Goamd64), ), + artifact.ByGoarch("arm64"), artifact.ByGoarch("386"), ), } @@ -342,6 +343,8 @@ func dataFor(ctx *context.Context, scoop config.Scoop, cl client.ReleaserURLTemp arch = "32bit" case "amd64": arch = "64bit" + case "arm64": + arch = "arm64" default: continue } diff --git a/internal/pipe/scoop/scoop_test.go b/internal/pipe/scoop/scoop_test.go index a34f7fcec..eaaeeb1fc 100644 --- a/internal/pipe/scoop/scoop_test.go +++ b/internal/pipe/scoop/scoop_test.go @@ -132,6 +132,7 @@ func Test_doRun(t *testing.T) { }, []artifact.Artifact{ {Name: "foo_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Goamd64: "v1", Path: file}, + {Name: "foo_1.0.1_windows_arm64.tar.gz", Goos: "windows", Goarch: "arm64", Path: file}, {Name: "foos_1.0.1_windows_amd64.tar.gz", Goos: "windows", Goarch: "amd64", Goamd64: "v1", Path: file}, }, func(tb testing.TB, err error) { @@ -140,6 +141,7 @@ func Test_doRun(t *testing.T) { goamd64: "v1", archives: []*artifact.Artifact{ {Name: "foo_1.0.1_windows_amd64.tar.gz"}, + {Name: "foo_1.0.1_windows_arm64.tar.gz"}, {Name: "foos_1.0.1_windows_amd64.tar.gz"}, }, }.Error()) @@ -939,6 +941,18 @@ func Test_buildManifest(t *testing.T) { }, }, }, + { + Name: "foo_1.0.1_windows_arm64.tar.gz", + Goos: "windows", + Goarch: "arm64", + Path: file, + Extra: map[string]interface{}{ + artifact.ExtraBinaries: []string{ + "foo.exe", + "bar.exe", + }, + }, + }, { Name: "foo_1.0.1_windows_386.tar.gz", Goos: "windows", diff --git a/internal/pipe/scoop/testdata/Test_buildManifest/common.json.golden b/internal/pipe/scoop/testdata/Test_buildManifest/common.json.golden index 63d433c53..e51c719de 100644 --- a/internal/pipe/scoop/testdata/Test_buildManifest/common.json.golden +++ b/internal/pipe/scoop/testdata/Test_buildManifest/common.json.golden @@ -16,6 +16,14 @@ "bar.exe" ], "hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269" + }, + "arm64": { + "url": "https://github.com/test/test/releases/download/v1.0.1/foo_1.0.1_windows_arm64.tar.gz", + "bin": [ + "foo.exe", + "bar.exe" + ], + "hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269" } }, "homepage": "https://github.com/goreleaser", diff --git a/internal/pipe/scoop/testdata/Test_buildManifest/gitlab_url_template.json.golden b/internal/pipe/scoop/testdata/Test_buildManifest/gitlab_url_template.json.golden index 2d427a474..3ee24d092 100644 --- a/internal/pipe/scoop/testdata/Test_buildManifest/gitlab_url_template.json.golden +++ b/internal/pipe/scoop/testdata/Test_buildManifest/gitlab_url_template.json.golden @@ -16,6 +16,14 @@ "bar.exe" ], "hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269" + }, + "arm64": { + "url": "http://gitlab.mycompany.com/foo/bar/-/releases/v1.0.1/downloads/foo_1.0.1_windows_arm64.tar.gz", + "bin": [ + "foo.exe", + "bar.exe" + ], + "hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269" } }, "homepage": "https://gitlab.com/goreleaser", diff --git a/internal/pipe/scoop/testdata/Test_buildManifest/pre-post-install.json.golden b/internal/pipe/scoop/testdata/Test_buildManifest/pre-post-install.json.golden index da67fd8d6..ae2aced23 100644 --- a/internal/pipe/scoop/testdata/Test_buildManifest/pre-post-install.json.golden +++ b/internal/pipe/scoop/testdata/Test_buildManifest/pre-post-install.json.golden @@ -16,6 +16,14 @@ "bar.exe" ], "hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269" + }, + "arm64": { + "url": "https://github.com/test/test/releases/download/v1.0.1/foo_1.0.1_windows_arm64.tar.gz", + "bin": [ + "foo.exe", + "bar.exe" + ], + "hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269" } }, "homepage": "https://github.com/goreleaser", diff --git a/internal/pipe/scoop/testdata/Test_buildManifest/url_template.json.golden b/internal/pipe/scoop/testdata/Test_buildManifest/url_template.json.golden index 7eb5a394f..4285c6ca7 100644 --- a/internal/pipe/scoop/testdata/Test_buildManifest/url_template.json.golden +++ b/internal/pipe/scoop/testdata/Test_buildManifest/url_template.json.golden @@ -16,6 +16,14 @@ "bar.exe" ], "hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269" + }, + "arm64": { + "url": "http://github.mycompany.com/foo/bar/v1.0.1/foo_1.0.1_windows_arm64.tar.gz", + "bin": [ + "foo.exe", + "bar.exe" + ], + "hash": "5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269" } }, "homepage": "https://github.com/goreleaser",