8

I'm looking for ideas on how to easily build binaries for common platforms for a Golang project, for release on Github.

I already know how to manually do releases, using Github's instructions at Creating Releases. And I'm currently doing releases using aktau/github-release, but this requires manually logging into different machines (OSX, Linux, Windows) and doing the release.

Benedikt Lang has blogged about using Travis-CI (which I'm yet to experiment with). But I presume the public Travis will only build binaries for Linux.

Any suggestions?

4
  • 2
    Do I understand you correct, you interest in cross-compile? dave.cheney.net/2012/09/08/… Commented Aug 5, 2015 at 11:34
  • The idea is to make cross-compiled binaries for all platforms and make the release on github Commented Aug 5, 2015 at 11:40
  • Yes, sounds likes cross-compilation. Commented Aug 5, 2015 at 23:52
  • FWIW Travis CI can also do Mac OS X builds: docs.travis-ci.com/user/osx-ci-environment Commented Aug 6, 2015 at 1:09

3 Answers 3

4

You are most likely right about the Travis CI only building in Linux as go cross-compilation requires you to build from source and build other go executables. Like RoninDev suggested, I would suggest that you setup your own cross-compilation build environment by following the blog post:

http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go

It is quite easy, and only takes about 10 minutes. After you have that, a build tool such as Jenkins will give you the controls to kick off a build for the desired platforms (Mac, Windows, Linux, etc) and then push out git releases for each one.

Sign up to request clarification or add additional context in comments.

Comments

4

Thanks for all the suggestions and answers that were given. Cross-compilation was what I was looking for, and Dave Cheney's blog post was a good start.

However I found a better solution - laher/goxc - "a build tool for Go, with a focus on cross-compiling, packaging and deployment". It was inspired by Dave Cheney's work, and also includes deploy tools for Github - just what I was looking for. (For example, I used it to release soniah/awsenv)

Comments

2

I created goreleaser to do just that.

You can try it out if you want :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.