Skip to content

Commit

Permalink
fix tests, remove binary naming template - reverting to default behav…
Browse files Browse the repository at this point in the history
…ior (based on dir of project)
  • Loading branch information
nikogura committed Jan 24, 2023
1 parent 890aa53 commit 8c6a0c0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.12.1",
"version": "2.13.0",
"package": "github.com/nikogura/gomason",
"description": "A tool for testing, building, signing, and publishing your project from a clean workspace.",
"repository": "http://localhost:8081/artifactory/generic-local",
Expand Down
6 changes: 4 additions & 2 deletions pkg/gomason/golang.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,11 @@ func (g Golang) Build(gopath string, meta Metadata, skipTargets string, local bo
logrus.Debugf("LD Flag: %s", ldflags)
}

outputTemplate := fmt.Sprintf("%s_{{.OS}}_{{.Arch}}", meta.Name)
// Interesting idea, but breaks multiple binary builds such as dbt. To properly implement, we'd have to find and handle each binary instead of relying on the './...'.
//outputTemplate := fmt.Sprintf("%s_{{.OS}}_{{.Arch}}", meta.Name)
//args := gox + cgo + ldflags + ` -osarch="` + target.Name + `"` + ` -output="` + outputTemplate + `"` + " ./..."

args := gox + cgo + ldflags + ` -osarch="` + target.Name + `"` + ` -output="` + outputTemplate + `"` + " ./..."
args := gox + cgo + ldflags + ` -osarch="` + target.Name + `"` + " ./..."

logrus.Debugf("Running gox with: %s in dir %s", args, wd)

Expand Down
16 changes: 8 additions & 8 deletions pkg/gomason/golang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestPrep(t *testing.T) {
t.Errorf("Failed to checkout module")
}

err = lang.Prep(gopath, testMetadataObj())
err = lang.Prep(gopath, testMetadataObj(), false)
if err != nil {
t.Errorf("error running prep steps: %s", err)
}
Expand Down Expand Up @@ -167,12 +167,12 @@ func TestBuild(t *testing.T) {
t.Errorf("Failed to checkout module")
}

err = lang.Prep(gopath, testMetadataObj())
err = lang.Prep(gopath, testMetadataObj(), false)
if err != nil {
t.Errorf("error running prep steps: %s", err)
}

err = lang.Build(gopath, testMetadataObj(), tc.skipTargets)
err = lang.Build(gopath, testMetadataObj(), tc.skipTargets, false)
if err != nil {
t.Errorf("Error building: %s", err)
}
Expand Down Expand Up @@ -218,12 +218,12 @@ func TestTest(t *testing.T) {
t.Errorf("Failed to checkout module")
}

err = lang.Prep(gopath, testMetadataObj())
err = lang.Prep(gopath, testMetadataObj(), false)
if err != nil {
t.Errorf("error running prep steps: %s", err)
}

err = lang.Test(gopath, testMetadataObj().Package, "10m")
err = lang.Test(gopath, testMetadataObj().Package, "10m", false)
if err != nil {
t.Errorf("error running go test: %s", err)
}
Expand Down Expand Up @@ -259,7 +259,7 @@ func TestSignVerifyBinary(t *testing.T) {
meta.Repository = fmt.Sprintf("http://localhost:%d/repo/tool", servicePort)

// build artifacts
err = lang.Build(gopath, meta, "")
err = lang.Build(gopath, meta, "", false)
if err != nil {
t.Errorf("Error building: %s", err)
}
Expand Down Expand Up @@ -338,12 +338,12 @@ Expire-Date: 0
t.Errorf("Failed to get current working directory: %s", err)
}

err = g.HandleArtifacts(meta, gopath, cwd, false, true, true, "")
err = g.HandleArtifacts(meta, gopath, cwd, false, true, true, "", false)
if err != nil {
t.Errorf("post-build processing failed: %s", err)
}

err = g.HandleExtras(meta, gopath, cwd, false, true, true)
err = g.HandleExtras(meta, gopath, cwd, false, true, true, false)
if err != nil {
t.Errorf("Extra artifact processing failed: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/gomason/gomason.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func init() {
}

// VERSION is the current gomason version
const VERSION = "2.12.1"
const VERSION = "2.13.0"

// METADATA_FILENAME The default gomason metadata file name
const METADATA_FILENAME = "metadata.json"
Expand Down
6 changes: 3 additions & 3 deletions pkg/gomason/languages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ func TestNoLanguage(t *testing.T) {
err = nl.Checkout("", Metadata{}, "")
assert.True(t, err == nil, "Checkout returned an error")

err = nl.Prep("", Metadata{})
err = nl.Prep("", Metadata{}, false)
assert.True(t, err == nil, "Prep returned an error")

err = nl.Test("", "", "")
err = nl.Test("", "", "", false)
assert.True(t, err == nil, "Test returned an error")

err = nl.Build("", Metadata{}, "")
err = nl.Build("", Metadata{}, "", false)
assert.True(t, err == nil, "Build returned an error")

}
Expand Down

0 comments on commit 8c6a0c0

Please sign in to comment.