Test cross platform pgroll
builds in the CI workflow
#525
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Building
pgroll
now requires a functioning C toolchain on each platform we aim to support, due to taking a dependency on pg_query_go for thesql2pgroll
package: pg_query_go requiresCGO_ENABLED
to build.This PR adds a new
cross-build
job in the CI workflow to buildpgroll
binaries for each of our supported platforms:linux/amd64
linux/arm64
darwin/amd64
darwin/arm64
windows/amd64
The job runs in a goreleaser/goreleaser-cross container in order to have access to a functioning C toolchain for each of the above platforms. The
builds
section of the.goreleaser.yaml
config file is extended with anoverrides
section to configure the C compiler for each platform build:The values for the
CC
env var set the C compiler to use for each OS/Arch target and are taken from the goreleaser-cross docs. The Windows build requires extra linker flags:due to having to link to the libssp stack-protection library and statically link to avoid the runtime dependency on that library.
The job runs in a
surjection/goreleaser-cross:v1.23-v2.4.8
container, which is NOT an official goreleaser/goreleaser-cross image. This image was built with thisDockerfile
:ie it installs the latest version Goreleaser
2.4.8
into the most recentgoreleaser/goreleaser-cross
image. Once agoreleaser/goreleaser-cross
image usinggoreleaser
2.4.8
is released we can switch back to the official images. Version2.4.8
is required due to a bug in earliergoreleaser
versions that prevents theoverrides
section in the.goreleaser.yaml
file from working (goreleaser/goreleaser#5298).A
.zip
file containing the binaries for each supported platform is uploaded as an artifact at the end of the job.