mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
added backwards compat to single build
This commit is contained in:
parent
460f4af331
commit
cc5f80b3a9
@ -108,7 +108,9 @@ type Project struct {
|
|||||||
FPM FPM `yaml:",omitempty"`
|
FPM FPM `yaml:",omitempty"`
|
||||||
Snapshot Snapshot `yaml:",omitempty"`
|
Snapshot Snapshot `yaml:",omitempty"`
|
||||||
|
|
||||||
// Build Build `yaml:",omitempty"` // deprecated, remove
|
// this is a hack ¯\_(ツ)_/¯
|
||||||
|
SingleBuild Build `yaml:"build,omitempty"`
|
||||||
|
|
||||||
// test only property indicating the path to the dist folder
|
// test only property indicating the path to the dist folder
|
||||||
Dist string `yaml:"-"`
|
Dist string `yaml:"-"`
|
||||||
}
|
}
|
||||||
@ -129,6 +131,6 @@ func LoadReader(fd io.Reader) (config Project, err error) {
|
|||||||
return config, err
|
return config, err
|
||||||
}
|
}
|
||||||
err = yaml.Unmarshal(data, &config)
|
err = yaml.Unmarshal(data, &config)
|
||||||
log.WithField("config", config).Debug("loaded")
|
log.WithField("config", config).Debug("loaded config file")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ func setBuildDefaults(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
if len(ctx.Config.Builds) == 0 {
|
if len(ctx.Config.Builds) == 0 {
|
||||||
ctx.Config.Builds = []config.Build{
|
ctx.Config.Builds = []config.Build{
|
||||||
buildWithDefaults(ctx, config.Build{}),
|
buildWithDefaults(ctx, ctx.Config.SingleBuild),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.WithField("builds", ctx.Config.Builds).Info("set")
|
log.WithField("builds", ctx.Config.Builds).Info("set")
|
||||||
|
@ -64,6 +64,21 @@ func TestFillPartial(t *testing.T) {
|
|||||||
assert.Len(ctx.Config.Archive.Files, 1)
|
assert.Len(ctx.Config.Archive.Files, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFillSingleBuild(t *testing.T) {
|
||||||
|
var assert = assert.New(t)
|
||||||
|
|
||||||
|
var ctx = &context.Context{
|
||||||
|
Config: config.Project{
|
||||||
|
SingleBuild: config.Build{
|
||||||
|
Main: "testreleaser",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
assert.NoError(Pipe{}.Run(ctx))
|
||||||
|
assert.Len(ctx.Config.Builds, 1)
|
||||||
|
assert.Equal(ctx.Config.Builds[0].Binary, "goreleaser")
|
||||||
|
}
|
||||||
|
|
||||||
func TestNotAGitRepo(t *testing.T) {
|
func TestNotAGitRepo(t *testing.T) {
|
||||||
var assert = assert.New(t)
|
var assert = assert.New(t)
|
||||||
folder, err := ioutil.TempDir("", "goreleasertest")
|
folder, err := ioutil.TempDir("", "goreleasertest")
|
||||||
|
Loading…
Reference in New Issue
Block a user