Repository: goreleaser/goreleaser
Pull request #2124 (2021-03-19 12:20:06)

fix: default gomips
default to hardfloat, as in `go build`.

an empty gomips was causing goreleaser to fail validation as well.

closes https://github.com/goreleaser/goreleaser/discussions/2105

vercel[bot]: This pull request is being automatically deployed with Vercel ([learn more](https://vercel.link/github-learn-more)).  
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: [https://vercel.com/goreleaser/goreleaser/5bLrpLiibPJqCSya88FC3b3F4St7](https://vercel.com/goreleaser/goreleaser/5bLrpLiibPJqCSya88FC3b3F4St7)  
✅ Preview: [https://goreleaser-git-mips-goreleaser.vercel.app](https://goreleaser-git-mips-goreleaser.vercel.app)


codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2124?src=pr&el=h1) Report
> Merging [#2124](https://codecov.io/gh/goreleaser/goreleaser/pull/2124?src=pr&el=desc) (3776c6d) into [master](https://codecov.io/gh/goreleaser/goreleaser/commit/0e689b414a133d9835e2ef9fa9d5b5f34e1105fd?el=desc) (0e689b4) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/goreleaser/goreleaser/pull/2124/graphs/tree.svg?width=650&height=150&src=pr&token=3bJvv6b7hN)](https://codecov.io/gh/goreleaser/goreleaser/pull/2124?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #2124   +/-   ##
=======================================
  Coverage   82.71%   82.72%           
=======================================
  Files          74       74           
  Lines        4010     4012    +2     
=======================================
+ Hits         3317     3319    +2     
  Misses        565      565           
  Partials      128      128           
```


| [Impacted Files](https://codecov.io/gh/goreleaser/goreleaser/pull/2124?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [internal/builders/golang/build.go](https://codecov.io/gh/goreleaser/goreleaser/pull/2124/diff?src=pr&el=tree#diff-aW50ZXJuYWwvYnVpbGRlcnMvZ29sYW5nL2J1aWxkLmdv) | `94.32% <100.00%> (+0.08%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2124?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2124?src=pr&el=footer). Last update [0e689b4...3776c6d](https://codecov.io/gh/goreleaser/goreleaser/pull/2124?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/internal/builders/golang/build.go b/internal/builders/golang/build.go
index ef972b74..dae09f26 100644
--- a/internal/builders/golang/build.go
+++ b/internal/builders/golang/build.go
@@ -57,6 +57,9 @@ func (*Builder) WithDefaults(build config.Build) (config.Build, error) {
 		if len(build.Goarm) == 0 {
 			build.Goarm = []string{"6"}
 		}
+		if len(build.Gomips) == 0 {
+			build.Gomips = []string{"hardfloat"}
+		}
 		targets, err := matrix(build)
 		build.Targets = targets
 		if err != nil {
diff --git a/internal/linux/arch.go b/internal/linux/arch.go
index 54302233..b3304aad 100644
--- a/internal/linux/arch.go
+++ b/internal/linux/arch.go
@@ -6,7 +6,10 @@ import "strings"
 // Arch converts a goarch to a linux-compatible arch.
 func Arch(key string) string {
 	// XXX: list of all linux arches: `go tool dist list | grep linux`
-	var arch = strings.TrimPrefix(key, "linux")
+	arch := strings.TrimPrefix(key, "linux")
+	for _, suffix := range []string{"hardfloat", "softfloat"} {
+		arch = strings.TrimSuffix(arch, suffix)
+	}
 	switch arch {
 	case "386":
 		return "i386"
@@ -18,7 +21,10 @@ func Arch(key string) string {
 		return "armhf"
 	case "arm7": // GOARCH + GOARM
 		return "armhf"
-	default:
-		return arch
+	case "mips64le":
+		return "mips64el"
+	case "mipsle":
+		return "mipsel"
 	}
+	return arch
 }
diff --git a/internal/pipe/docker/docker.go b/internal/pipe/docker/docker.go
index 63ae105d..15dcd98e 100644
--- a/internal/pipe/docker/docker.go
+++ b/internal/pipe/docker/docker.go
@@ -155,9 +155,6 @@ func process(ctx *context.Context, docker config.Docker, artifacts []*artifact.A
 	if ctx.SkipPublish {
 		return pipe.ErrSkipPublishEnabled
 	}
-	if ctx.Config.Release.Draft {
-		return pipe.Skip("release is marked as draft")
-	}
 	if strings.TrimSpace(docker.SkipPush) == "auto" && ctx.Semver.Prerelease != "" {
 		return pipe.Skip("prerelease detected with 'auto' push, skipping docker publish")
 	}
diff --git a/www/docs/customization/build.md b/www/docs/customization/build.md
index ba83674a..22f147db 100644
--- a/www/docs/customization/build.md
+++ b/www/docs/customization/build.md
@@ -85,7 +85,7 @@ builds:
 
     # GOMIPS and GOMIPS64 to build when GOARCH is mips, mips64, mipsle or mips64le.
     # For more info refer to: https://golang.org/doc/install/source#environment
-    # Default is empty.
+    # Default is only hardfloat.
     gomips:
       - hardfloat
       - softfloat


Test patch:
diff --git a/internal/linux/arch_test.go b/internal/linux/arch_test.go
index 86873b81..591ca757 100644
--- a/internal/linux/arch_test.go
+++ b/internal/linux/arch_test.go
@@ -9,15 +9,19 @@ import (
 
 func TestArch(t *testing.T) {
 	for from, to := range map[string]string{
-		"linuxamd64":   "amd64",
-		"linux386":     "i386",
-		"linuxarm64":   "arm64",
-		"linuxarm5":    "armel",
-		"linuxarm6":    "armhf",
-		"linuxarm7":    "armhf",
-		"linuxppc64":   "ppc64",
-		"linuxppc64le": "ppc64le",
-		"linuxwhat":    "what",
+		"linuxamd64":             "amd64",
+		"linux386":               "i386",
+		"linuxarm64":             "arm64",
+		"linuxarm5":              "armel",
+		"linuxarm6":              "armhf",
+		"linuxarm7":              "armhf",
+		"linuxppc64":             "ppc64",
+		"linuxppc64le":           "ppc64le",
+		"linuxwhat":              "what",
+		"linuxmips64lesoftfloat": "mips64el",
+		"linuxmipslehardfloat":   "mipsel",
+		"linuxmipssoftfloat":     "mips",
+		"linuxmips64hardfloat":   "mips64",
 	} {
 		t.Run(fmt.Sprintf("%s to %s", from, to), func(t *testing.T) {
 			require.Equal(t, to, Arch(from))
diff --git a/internal/pipe/build/build_test.go b/internal/pipe/build/build_test.go
index b268bfe7..c24d4672 100644
--- a/internal/pipe/build/build_test.go
+++ b/internal/pipe/build/build_test.go
@@ -266,6 +266,7 @@ func TestDefaultEmptyBuild(t *testing.T) {
 	require.Equal(t, []string{"linux", "darwin"}, build.Goos)
 	require.Equal(t, []string{"amd64", "arm64", "386"}, build.Goarch)
 	require.Equal(t, []string{"6"}, build.Goarm)
+	require.Equal(t, []string{"hardfloat"}, build.Gomips)
 	require.Len(t, build.Ldflags, 1)
 	require.Equal(t, "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser", build.Ldflags[0])
 }
diff --git a/internal/pipe/docker/docker_test.go b/internal/pipe/docker/docker_test.go
index 479f2a06..c2b85283 100644
--- a/internal/pipe/docker/docker_test.go
+++ b/internal/pipe/docker/docker_test.go
@@ -1002,6 +1002,18 @@ func TestDefaultDockerfile(t *testing.T) {
 	require.Equal(t, "Dockerfile", ctx.Config.Dockers[1].Dockerfile)
 }
 
+func TestDraftRelease(t *testing.T) {
+	var ctx = &context.Context{
+		Config: config.Project{
+			Release: config.Release{
+				Draft: true,
+			},
+		},
+	}
+
+	require.False(t, pipe.IsSkip(Pipe{}.Publish(ctx)))
+}
+
 func TestDefaultNoDockers(t *testing.T) {
 	var ctx = &context.Context{
 		Config: config.Project{