forked from TrueCloudLab/restic
CI: Use gox with -osarch
This allows not to cross-compile to darwin/arm, which fails at the moment.
This commit is contained in:
parent
20afed4058
commit
f928b30caa
1 changed files with 16 additions and 15 deletions
|
@ -45,9 +45,8 @@ type CIEnvironment interface {
|
||||||
|
|
||||||
// TravisEnvironment is the environment in which Travis tests run.
|
// TravisEnvironment is the environment in which Travis tests run.
|
||||||
type TravisEnvironment struct {
|
type TravisEnvironment struct {
|
||||||
goxArch []string
|
goxOSArch []string
|
||||||
goxOS []string
|
minio string
|
||||||
minio string
|
|
||||||
|
|
||||||
minioSrv *Background
|
minioSrv *Background
|
||||||
minioTempdir string
|
minioTempdir string
|
||||||
|
@ -175,24 +174,27 @@ func (env *TravisEnvironment) Prepare() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
env.goxArch = []string{"386", "amd64"}
|
env.goxOSArch = []string{
|
||||||
if !strings.HasPrefix(runtime.Version(), "go1.3") {
|
"linux/386", "linux/amd64",
|
||||||
env.goxArch = append(env.goxArch, "arm")
|
"windows/386", "windows/amd64",
|
||||||
|
"darwin/386", "darwin/amd64",
|
||||||
|
"freebsd/386", "freebsd/amd64",
|
||||||
|
"opendbsd/386", "opendbsd/amd64",
|
||||||
|
}
|
||||||
|
if !strings.HasPrefix(runtime.Version(), "go1.3") {
|
||||||
|
env.goxOSArch = append(env.goxOSArch,
|
||||||
|
"linux/arm", "darwin/arm", "freebsd/arm")
|
||||||
}
|
}
|
||||||
|
|
||||||
env.goxOS = []string{"linux", "darwin", "freebsd", "openbsd", "windows"}
|
|
||||||
} else {
|
} else {
|
||||||
env.goxArch = []string{runtime.GOARCH}
|
env.goxOSArch = []string{runtime.GOOS + "/" + runtime.GOARCH}
|
||||||
env.goxOS = []string{runtime.GOOS}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg("gox: OS %v, ARCH %v\n", env.goxOS, env.goxArch)
|
msg("gox: OS/ARCH %v\n", env.goxOSArch)
|
||||||
|
|
||||||
v := runtime.Version()
|
v := runtime.Version()
|
||||||
if !strings.HasPrefix(v, "go1.5") && !strings.HasPrefix(v, "go1.6") {
|
if !strings.HasPrefix(v, "go1.5") && !strings.HasPrefix(v, "go1.6") {
|
||||||
err := run("gox", "-build-toolchain",
|
err := run("gox", "-build-toolchain",
|
||||||
"-os", strings.Join(env.goxOS, " "),
|
"-osarch", strings.Join(env.goxOSArch, " "))
|
||||||
"-arch", strings.Join(env.goxArch, " "))
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -320,8 +322,7 @@ func (env *TravisEnvironment) RunTests() error {
|
||||||
// compile for all target architectures with tags
|
// compile for all target architectures with tags
|
||||||
for _, tags := range []string{"release", "debug"} {
|
for _, tags := range []string{"release", "debug"} {
|
||||||
runWithEnv(env.env, "gox", "-verbose",
|
runWithEnv(env.env, "gox", "-verbose",
|
||||||
"-os", strings.Join(env.goxOS, " "),
|
"-osarch", strings.Join(env.goxOSArch, " "),
|
||||||
"-arch", strings.Join(env.goxArch, " "),
|
|
||||||
"-tags", tags,
|
"-tags", tags,
|
||||||
"-output", "/tmp/{{.Dir}}_{{.OS}}_{{.Arch}}",
|
"-output", "/tmp/{{.Dir}}_{{.OS}}_{{.Arch}}",
|
||||||
"cmds/restic")
|
"cmds/restic")
|
||||||
|
|
Loading…
Reference in a new issue