1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-29 01:44:39 +02:00

fix: checksum extra_files when no builds (#2692)

This commit is contained in:
Carlos Alexandro Becker 2021-11-23 09:40:47 -03:00 committed by GitHub
parent ff0fdf3520
commit 37f8167fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -47,9 +47,6 @@ func (Pipe) Run(ctx *context.Context) (err error) {
}
artifactList := ctx.Artifacts.Filter(filter).List()
if len(artifactList) == 0 {
return nil
}
extraFiles, err := extrafiles.Find(ctx, ctx.Config.Checksum.ExtraFiles)
if err != nil {
@ -64,6 +61,10 @@ func (Pipe) Run(ctx *context.Context) (err error) {
})
}
if len(artifactList) == 0 {
return nil
}
g := semerrgroup.New(ctx.Parallelism)
sumLines := make([]string, len(artifactList))
for i, artifact := range artifactList {

View File

@ -230,6 +230,7 @@ func TestPipeCheckSumsWithExtraFiles(t *testing.T) {
tests := map[string]struct {
extraFiles []config.ExtraFile
ids []string
want []string
}{
"default": {
@ -256,6 +257,15 @@ func TestPipeCheckSumsWithExtraFiles(t *testing.T) {
extraFileBar,
},
},
"one extra file with no builds": {
extraFiles: []config.ExtraFile{
{Glob: extraFileFooRelPath},
},
ids: []string{"yada yada yada"},
want: []string{
extraFileFoo,
},
},
}
for name, tt := range tests {
@ -271,6 +281,7 @@ func TestPipeCheckSumsWithExtraFiles(t *testing.T) {
Algorithm: "sha256",
NameTemplate: "checksums.txt",
ExtraFiles: tt.extraFiles,
IDs: tt.ids,
},
},
)