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

feat: wasm support (#1159)

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2019-10-01 16:00:44 -03:00 committed by GitHub
parent e0ef20341a
commit 9d5f36f21b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 0 deletions

View File

@ -91,6 +91,7 @@ func TestBuild(t *testing.T) {
"darwin_amd64",
"windows_amd64",
"linux_arm_6",
"js_wasm",
},
Asmflags: []string{".=", "all="},
Gcflags: []string{"all="},
@ -107,6 +108,9 @@ func TestBuild(t *testing.T) {
if strings.HasPrefix(target, "windows") {
ext = ".exe"
}
if target == "js_wasm" {
ext = ".wasm"
}
var err = Default.Build(ctx, build, api.Options{
Target: target,
Name: build.Binary,
@ -165,6 +169,18 @@ func TestBuild(t *testing.T) {
"ID": "foo",
},
},
{
Name: "foo",
Path: filepath.Join(folder, "dist", "js_wasm", "foo"),
Goos: "js",
Goarch: "wasm",
Type: artifact.Binary,
Extra: map[string]interface{}{
"Ext": ".wasm",
"Binary": "foo",
"ID": "foo",
},
},
})
}

View File

@ -102,6 +102,7 @@ var validTargets = []string{
"freebsd386",
"freebsdamd64",
"freebsdarm",
"jswasm",
"linux386",
"linuxamd64",
"linuxarm",

View File

@ -15,12 +15,14 @@ func TestAllBuildTargets(t *testing.T) {
"darwin",
"freebsd",
"openbsd",
"js",
},
Goarch: []string{
"386",
"amd64",
"arm",
"arm64",
"wasm",
},
Goarm: []string{
"6",
@ -52,6 +54,7 @@ func TestAllBuildTargets(t *testing.T) {
"freebsd_arm_7",
"openbsd_386",
"openbsd_amd64",
"js_wasm",
}, matrix(build))
}
@ -91,6 +94,7 @@ func TestGoosGoarchCombos(t *testing.T) {
{"solaris", "amd64", true},
{"windows", "386", true},
{"windows", "amd64", true},
{"js", "wasm", true},
// invalid targets
{"darwin", "arm", false},
{"darwin", "arm64", false},

View File

@ -131,6 +131,9 @@ func extFor(target string) string {
if strings.Contains(target, "windows") {
return ".exe"
}
if target == "js_wasm" {
return ".wasm"
}
return ""
}

View File

@ -340,6 +340,10 @@ func TestExtWindows(t *testing.T) {
assert.Equal(t, ".exe", extFor("windows_386"))
}
func TestExtWasm(t *testing.T) {
assert.Equal(t, ".wasm", extFor("js_wasm"))
}
func TestExtOthers(t *testing.T) {
assert.Empty(t, "", extFor("linux_amd64"))
assert.Empty(t, "", extFor("linuxwin_386"))