Skip to content
Constantin Konstantinidis edited this page Nov 13, 2024 · 14 revisions

Purpose is to automate build and test of Go for various platforms using Github CI.

How to start

Usage with bash using the tip of master branch is like:

    - name: Build Go from source
      uses: iwdgo/gotip-build@master
      id: gotip
      with:
        go_variables: CGO_ENABLED=1
        test_build: true

The workflows directory contain tests which can be a good start.

Set up Go language

Compiling Go language requires a base version. The use of generics requires Go 1.20 or later.
tip will use Go 1.22.
Github Actions actions/setup-go@v5 can set an appropriate version.
The official reference has the details of the required configuration.

Environment variables

Variables can configure the build of the Go installation.
go_variables can hold the values in the usual bash format: CGO_ENABLED=1; GOPATH="/my-go-path"
GOROOT_BOOTSTRAP will default to the value of go env GOROOT.
For testing GOROOT is set to /tmp/go.

Patch

If patches must be applied, the repository must be checked out using something like actions/checkout@v3.
Patch files are expected in a format like produced by git format-patch master.
Patches are applied in the sequence returned by the list function (ls or dir) using extension *.patch.
If no patch file is found, the step is skipped with a relevant message.

Test of build

Variable test_build can be set to false to skip tests. Otherwise, the run.[bash|bat] file is launched on the current container.
Github is running natively amd64 architecture.

When cross-compiling, the native version testing is skipped.
Cross-compiled build is using Docker for a subset of architectures as feasible.

The list of tested pairs of os and architectures shows results of existing tests.

Versions

Github Action gotip-build is available using bash or powershell on windows.

Versions on the master branch are tagged but tip can be selected using the branch name master.

Clone this wiki locally