You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-11-06 09:09:29 +02:00
fix: use universal binary id (#3028)
Ensure the new ID is set, and add a test to prevent the bug from happening again. closes #3027
This commit is contained in:
committed by
GitHub
parent
610a99f6c1
commit
02595554de
@@ -224,6 +224,7 @@ func makeUniversalBinary(ctx *context.Context, opts *build.Options, unibin confi
|
||||
extra[k] = v
|
||||
}
|
||||
extra[artifact.ExtraReplaces] = unibin.Replace
|
||||
extra[artifact.ExtraID] = unibin.ID
|
||||
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Type: artifact.UniversalBinary,
|
||||
|
||||
@@ -192,6 +192,17 @@ func TestRun(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
ctx6 := context.New(config.Project{
|
||||
Dist: dist,
|
||||
UniversalBinaries: []config.UniversalBinary{
|
||||
{
|
||||
ID: "foobar",
|
||||
IDs: []string{"foo"},
|
||||
NameTemplate: "foo",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
for arch, path := range paths {
|
||||
cmd := exec.Command("go", "build", "-o", path, src)
|
||||
cmd.Env = append(os.Environ(), "GOOS=darwin", "GOARCH="+arch)
|
||||
@@ -216,6 +227,7 @@ func TestRun(t *testing.T) {
|
||||
ctx1.Artifacts.Add(&art)
|
||||
ctx2.Artifacts.Add(&art)
|
||||
ctx5.Artifacts.Add(&art)
|
||||
ctx6.Artifacts.Add(&art)
|
||||
ctx4.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "fake",
|
||||
Path: path + "wrong",
|
||||
@@ -229,6 +241,14 @@ func TestRun(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
t.Run("ensure new artifact id", func(t *testing.T) {
|
||||
require.NoError(t, Pipe{}.Run(ctx6))
|
||||
unis := ctx6.Artifacts.Filter(artifact.ByType(artifact.UniversalBinary)).List()
|
||||
require.Len(t, unis, 1)
|
||||
checkUniversalBinary(t, unis[0])
|
||||
require.Equal(t, "foobar", unis[0].ID())
|
||||
})
|
||||
|
||||
t.Run("replacing", func(t *testing.T) {
|
||||
require.NoError(t, Pipe{}.Run(ctx1))
|
||||
require.Len(t, ctx1.Artifacts.Filter(artifact.ByType(artifact.Binary)).List(), 0)
|
||||
|
||||
Reference in New Issue
Block a user