Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Jun 27, 2017

Now we can have several build, several binaries even, using the builds key on the goreleaser.yml file!

builds:
- binary: blah
  main: ./blah/main.go
  # etc

It is backwards compatible with the previous build field, and in the end it will releases a single archive per target (goos + goarch + goarm) and also a single brew formula, with all binaries of that given target inside.

It required some rework in the code, but, after a few hours, I was able to tackle it down and also fix some unknown/unreported bugs on the way! ( #271 )

I tested this PR on a test repo:

Everything looks good: non darwin/amd64 builds where ignored by the brew formulae, deb files are working, etc...


FWIW, here are snapshots of the latest commit:

goreleaser_Darwin_i386.tar.gz
goreleaser_Darwin_x86_64.tar.gz
goreleaser_Linux_arm64.tar.gz
goreleaser_Linux_armv6.tar.gz
goreleaser_Linux_i386.tar.gz
goreleaser_Linux_x86_64.tar.gz
goreleaser_checksums.txt
goreleaser_Windows_i386.zip
goreleaser_Windows_x86_64.zip


closes #259
refs #49 #228

@caarlos0 caarlos0 requested review from client9 and jorinvo June 28, 2017 13:42
@codecov-io
Copy link

codecov-io commented Jul 2, 2017

Codecov Report

Merging #267 into master will increase coverage by 0.01%.
The diff coverage is 98.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #267      +/-   ##
==========================================
+ Coverage   96.21%   96.23%   +0.01%     
==========================================
  Files          21       21              
  Lines         634      690      +56     
==========================================
+ Hits          610      664      +54     
- Misses         14       15       +1     
- Partials       10       11       +1
Impacted Files Coverage Δ
pipeline/build/ldflags.go 100% <100%> (ø) ⬆️
internal/name/name.go 100% <100%> (ø)
pipeline/build/build.go 100% <100%> (ø) ⬆️
pipeline/fpm/fpm.go 100% <100%> (ø) ⬆️
pipeline/defaults/defaults.go 100% <100%> (ø) ⬆️
config/config.go 100% <100%> (ø) ⬆️
pipeline/checksums/checksums.go 93.75% <100%> (ø) ⬆️
pipeline/build/target.go 100% <100%> (ø) ⬆️
pipeline/brew/brew.go 93.44% <100%> (-0.11%) ⬇️
context/context.go 100% <100%> (ø) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7068c8e...6db500f. Read the comment docs.

Binary: ctx.Config.Build.Binary,
Caveats: ctx.Config.Brew.Caveats,
File: file,
Format: ctx.Config.Archive.Format, // TODO this can be broken by format_overrides
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was finally fixed on a3c1e2b

@caarlos0
Copy link
Member Author

caarlos0 commented Jul 2, 2017

@jorinvo @client9 can you guys review?

It should work now!

BTW: I think it is a good idea to add a pre-step to remove the dist folder, maybe with a switch or something... because now I can have multiple binaries and etc, and changing the config may affect the end result by including a previous run build.

What do you guys think?

@caarlos0 caarlos0 changed the title WIP: multiple builds multiple builds Jul 2, 2017
@caarlos0 caarlos0 requested a review from jspc July 2, 2017 16:00
@caarlos0 caarlos0 merged commit 3696f74 into master Jul 3, 2017
@hellais
Copy link

hellais commented Jul 3, 2017

Thanks for working on this! I will check it out.

@caarlos0 caarlos0 deleted the builds branch July 3, 2017 12:22
- darwin
- linux
goarch:
- amd64
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the legacy build syntax also supported? If so maybe it's worth mentioning that it's also still supported.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is supported but is "deprecated"...

Copy link

@hellais hellais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know goreleaser well to provide more constructive feedback, so I left a couple of trivial comments.

t.Run("post-hook", func(t *testing.T) {
ctx.Config.Build.Hooks.Post = "exit 1"
ctx.Config.Builds[0].Hooks.Post = "exit 1"
assert.Error(Pipe{}.Run(ctx))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again if the legacy Build syntax is supported, you may want to leave the unittests for those too to ensure backward compatibility is preserved.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, this is being tested already!

https://github.com/goreleaser/goreleaser/blob/master/pipeline/defaults/defaults_test.go#L75

the single build will always become an item of the builds list :)

@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release multiple binaries
3 participants