Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build release binaries for all platforms #24

Merged
merged 49 commits into from Jan 13, 2023
Merged

Conversation

samsalisbury
Copy link
Contributor

@samsalisbury samsalisbury commented Dec 5, 2022

Justification

Makes it quick and easy to build actions-go-build CLI binaries for all target platforms, via new make targets make build and make release.

This is a precursor to being able to use prebuilt binaries in the action, rather than having to compile the action CLI itself every time it is run, this should speed it up quite a lot.

Summary

The core is to add targets for building for all platforms to the Makefile. See make build and make release. A lot of the build logic is moved out of the Makefile and into a script dev/build which can be invoked by itself to run builds, e.g. ./dev/build all_from_scratch to build all binaries from scratch.

Quality

This PR includes only one tiny change to behaviour: it ensures the build target directory is empty before running the build. This is essential for reproducibility, but hasn't caused issues until now (the new make targets surfaced the issue). That code path is already covered by countless tests, so I didn't add a new one.

@samsalisbury samsalisbury added the enhancement New feature or request label Jan 11, 2023
@samsalisbury samsalisbury changed the title Release binaries [WIP] release binaries Jan 11, 2023
@samsalisbury samsalisbury changed the title [WIP] release binaries build release binaries for all platforms Jan 11, 2023
@samsalisbury samsalisbury marked this pull request as ready for review January 11, 2023 16:55
@samsalisbury samsalisbury marked this pull request as draft January 11, 2023 16:56
if err := fs.MkdirEmpty(c.Paths.TargetDir()); err != nil {
return err
}
return fs.Mkdirs(c.Paths.ZipDir(), c.Paths.MetaDir)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change on line 149 above ensures that the target directory is empty at the start of the build process. This is pretty important for reproducibility. It wasn't noticed before, since we were using uniquely-named temporary directories for most builds. However, now we are building directly into dist/.../..., the issue came to light.

@samsalisbury samsalisbury marked this pull request as ready for review January 12, 2023 14:50
@samsalisbury samsalisbury requested review from a team, sarahethompson and jeanneryan and removed request for a team January 12, 2023 14:51
# 2) INTERMEDIATE_BUILD - Some build metadata.
# 3) RELEASE_BUILD - All build metadata.
# 3) BOOTSTRAPPED_BUILD - All build metadata.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed all these for hopefully the last time... I think we're consistent with naming everywhere now.

@@ -1,5 +1,7 @@
SHELL := /usr/bin/env bash -euo pipefail -c

MAKEFLAGS := --jobs=10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This speeds things up by default, on later versions of GNU Make.

@samsalisbury samsalisbury removed the enhancement New feature or request label Jan 12, 2023
@brompwnie brompwnie self-assigned this Jan 13, 2023
Copy link

@brompwnie brompwnie left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

@samsalisbury samsalisbury merged commit 2b2e0fc into main Jan 13, 2023
@samsalisbury samsalisbury deleted the release-binaries branch January 13, 2023 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants