Cross-Compile Go binaries across multiple operating system, architecture and Go versions in parallel
Clone or download
toolmantim Merge pull request #24 from buildkite-plugins/renovate/docker-buildki…
…te-plugin-tester-latest

Update buildkite/plugin-tester:latest Docker digest to ee0d1ad
Latest commit 57ad993 Dec 25, 2018

README.md

Golang Cross Compile Buildkite Plugin

A Buildkite plugin for building golang binaries against different operating systems, archictures and versions of golang.

This plugin creates a step for each build target and runs them in parallel. It's ideal for build matrixes against multiple architectures, operating systems and golang versions.

If you just need to build against a single target, use the simpler golang plugin, or if you want to avoid using docker you can use the the gopath checkout plugin.

Example

Build a golang binary across a set of architectures and versions.

steps:
  - plugins:
      golang-cross-compile#v1.3.0:
        build: main.go
        import: github.com/buildkite/example
        targets:
          - version: "1.11"
            goos: linux
            goarch: amd64
            gomodule: "on"
          - version: "1.11"
            goos: windows
            goarch: amd64
            gomodule: "on"
          - version: "1.11"
            goos: darwin
            goarch: amd64
            gomodule: "on"

Configuration

build (optional)

The golang file to build. Can either be a relative package like ./cmd/helloworld or a path to a file like cli/main.go. Defaults to main.go

Example: 1.10.2

import(required)

The golang package to use in the gopath in the container.

Exmaple: github.com/buildkite/agent

bin-prefix(optional)

By default the basename of the import package is used for the binary name, use bin-prefix to specify a different one.

Exmaple: buildkite-agent

static(optional)

Create a statically compiled binary, useful for alpine docker images.

targets (required)

A list of targets to run in parallel. Each target can have a version, goos, goarch and gomodule.

License

MIT (see LICENSE)