diff --git a/README.md b/README.md index 754469995..b083e9eaa 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ build: - amd64 ``` +PS: Invalid GOOS/GOARCH combinations will automatically be skipped. + This configuration specifies the build operating systems to Windows, Linux and MacOS using 64bit architecture, the name of the binaries is `drum-roll`. GoReleaser will then archive the result binaries of each Os/Arch into a separate file. The default format is `{{.Binary}}_{{.Os}}_{{.Arch}}`. diff --git a/pipeline/build/build.go b/pipeline/build/build.go index 7d4f3cee9..36a5f5fe8 100644 --- a/pipeline/build/build.go +++ b/pipeline/build/build.go @@ -36,6 +36,8 @@ func (Pipe) Run(ctx *context.Context) error { goos := goos goarch := goarch if !valid(goos, goarch) { + log.Printf("Skipped build for %v/%v\n", goos, goarch) + <-sem continue } name, err := nameFor(ctx, goos, goarch) diff --git a/pipeline/build/valid_os.go b/pipeline/build/valid_os.go index b3798d0ea..9dcf7534d 100644 --- a/pipeline/build/valid_os.go +++ b/pipeline/build/valid_os.go @@ -5,8 +5,8 @@ var valids = []string{ "androidarm", "darwin386", "darwinamd64", - "darwinarm", - "darwinarm64", + // "darwinarm", - requires admin rights and other ios stuff + // "darwinarm64", - requires admin rights and other ios stuff "dragonflyamd64", "freebsd386", "freebsdamd64", @@ -15,8 +15,8 @@ var valids = []string{ "linuxamd64", "linuxarm", "linuxarm64", - "linuxppc64", - "linuxppc64le", + // "linuxppc64", - https://github.com/golang/go/issues/10087 + // "linuxppc64le", - https://github.com/golang/go/issues/10087 "linuxmips", "linuxmipsle", "linuxmips64", @@ -26,7 +26,7 @@ var valids = []string{ "netbsdarm", "openbsd386", "openbsdamd64", - "openbsdarm", + // "openbsdarm", - https://github.com/golang/go/issues/10087 "plan9386", "plan9amd64", "solarisamd64", diff --git a/pipeline/build/valid_os_test.go b/pipeline/build/valid_os_test.go index 52da0296b..1c3e10298 100644 --- a/pipeline/build/valid_os_test.go +++ b/pipeline/build/valid_os_test.go @@ -1,13 +1,64 @@ package build import ( + "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestValid(t *testing.T) { - assert.True(t, valid("windows", "386")) - assert.True(t, valid("linux", "386")) - assert.False(t, valid("windows", "arm")) + var platforms = []struct { + os, arch string + }{ + {"android", "arm"}, + {"darwin", "386"}, + {"darwin", "amd64"}, + {"dragonfly", "amd64"}, + {"freebsd", "386"}, + {"freebsd", "amd64"}, + {"freebsd", "arm"}, + {"linux", "386"}, + {"linux", "amd64"}, + {"linux", "arm"}, + {"linux", "arm64"}, + {"linux", "mips"}, + {"linux", "mipsle"}, + {"linux", "mips64"}, + {"linux", "mips64le"}, + {"netbsd", "386"}, + {"netbsd", "amd64"}, + {"netbsd", "arm"}, + {"openbsd", "386"}, + {"openbsd", "amd64"}, + {"plan9", "386"}, + {"plan9", "amd64"}, + {"solaris", "amd64"}, + {"windows", "386"}, + {"windows", "amd64"}, + } + for _, p := range platforms { + t.Run(fmt.Sprintf("%v %v is valid", p.os, p.arch), func(t *testing.T) { + assert.True(t, valid(p.os, p.arch)) + }) + } +} + +func TestInvalid(t *testing.T) { + var platforms = []struct { + os, arch string + }{ + {"darwin", "arm"}, + {"darwin", "arm64"}, + {"windows", "arm"}, + {"windows", "arm64"}, + {"linux", "ppc64"}, + {"linux", "ppc64le"}, + {"openbsd", "arm"}, + } + for _, p := range platforms { + t.Run(fmt.Sprintf("%v %v is invalid", p.os, p.arch), func(t *testing.T) { + assert.False(t, valid(p.os, p.arch)) + }) + } }