1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00

Merge pull request #197 from goreleaser/builds

removed invalid builds and improved tests
This commit is contained in:
Carlos Alexandro Becker 2017-04-21 14:25:00 -03:00 committed by GitHub
commit ae11586bff
4 changed files with 63 additions and 8 deletions

View File

@ -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}}`.

View File

@ -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)

View File

@ -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",

View File

@ -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))
})
}
}