mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
fix: snapcraft and GOAMD64
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
3e8b848e44
commit
21df724a1e
@ -187,10 +187,7 @@ func doRun(ctx *context.Context, snap config.Snapcraft) error {
|
||||
|
||||
func isValidArch(arch string) bool {
|
||||
// https://snapcraft.io/docs/architectures
|
||||
if strings.HasPrefix(arch, "amd64") {
|
||||
return true
|
||||
}
|
||||
for _, a := range []string{"s390x", "ppc64el", "arm64", "armhf", "i386"} {
|
||||
for _, a := range []string{"s390x", "ppc64el", "arm64", "armhf", "i386", "amd64"} {
|
||||
if arch == a {
|
||||
return true
|
||||
}
|
||||
@ -463,10 +460,18 @@ var archToSnap = map[string]string{
|
||||
"ppc64le": "ppc64el",
|
||||
}
|
||||
|
||||
// TODO: write tests for this
|
||||
func linuxArch(key string) string {
|
||||
// XXX: list of all linux arches: `go tool dist list | grep linux`
|
||||
arch := strings.TrimPrefix(key, "linux")
|
||||
for _, suffix := range []string{"hardfloat", "softfloat"} {
|
||||
for _, suffix := range []string{
|
||||
"hardfloat",
|
||||
"softfloat",
|
||||
"v1",
|
||||
"v2",
|
||||
"v3",
|
||||
"v4",
|
||||
} {
|
||||
arch = strings.TrimSuffix(arch, suffix)
|
||||
}
|
||||
|
||||
|
@ -613,23 +613,50 @@ func Test_processChannelsTemplates(t *testing.T) {
|
||||
func addBinaries(t *testing.T, ctx *context.Context, name, dist string) {
|
||||
t.Helper()
|
||||
for _, goos := range []string{"linux", "darwin"} {
|
||||
for _, goarch := range []string{"amd64", "386", "arm6"} {
|
||||
folder := goos + goarch
|
||||
require.NoError(t, os.MkdirAll(filepath.Join(dist, folder), 0o755))
|
||||
binPath := filepath.Join(dist, folder, name)
|
||||
for _, goarch := range []string{"amd64", "386", "arm"} {
|
||||
binPath := filepath.Join(dist, name)
|
||||
require.NoError(t, os.MkdirAll(filepath.Dir(binPath), 0o755))
|
||||
f, err := os.Create(binPath)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, f.Close())
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "subdir/" + name,
|
||||
Path: binPath,
|
||||
Goarch: goarch,
|
||||
Goos: goos,
|
||||
Type: artifact.Binary,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: name,
|
||||
},
|
||||
})
|
||||
switch goarch {
|
||||
case "arm":
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "subdir/" + name,
|
||||
Path: binPath,
|
||||
Goarch: goarch,
|
||||
Goos: goos,
|
||||
Goarm: "6",
|
||||
Type: artifact.Binary,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: name,
|
||||
},
|
||||
})
|
||||
|
||||
case "amd64":
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "subdir/" + name,
|
||||
Path: binPath,
|
||||
Goarch: goarch,
|
||||
Goos: goos,
|
||||
Goamd64: "v1",
|
||||
Type: artifact.Binary,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: name,
|
||||
},
|
||||
})
|
||||
default:
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "subdir/" + name,
|
||||
Path: binPath,
|
||||
Goarch: goarch,
|
||||
Goos: goos,
|
||||
Type: artifact.Binary,
|
||||
Extra: map[string]interface{}{
|
||||
artifact.ExtraID: name,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -659,10 +686,6 @@ func Test_isValidArch(t *testing.T) {
|
||||
{"ppc64el", true},
|
||||
{"arm64", true},
|
||||
{"armhf", true},
|
||||
{"amd64v1", true},
|
||||
{"amd64v2", true},
|
||||
{"amd64v3", true},
|
||||
{"amd64v4", true},
|
||||
{"i386", true},
|
||||
{"mips", false},
|
||||
{"armel", false},
|
||||
|
Loading…
x
Reference in New Issue
Block a user