Because Travis-CI native windows support for Go seems to be lacking, I though about going this route.
How would I best do that?
Because Travis-CI native windows support for Go seems to be lacking, I though about going this route.
How would I best do that?
This builds natively for Linux, natively for OSX, and cross compiles for windows, as part of the linux build:
.travis.yml
:
language: go
sudo: false
matrix:
include:
- go: tip
os: linux
env: CROSS_COMPILE=true
- go: tip
os: osx
before_install:
- if [ "$CROSS_COMPILE" = "true" ]; then sudo apt update; fi
install:
- if [ "$CROSS_COMPILE" = "true" ]; then sudo apt install gcc-mingw-w64 libc6-dev-i386; fi
- go get github.com/some/go-dependency
- go get -t -v ./...
script:
- go build
- go test
- if [ "$TRAVIS_OS_NAME" = "linux" -a "$CROSS_COMPILE" = "true" ]; then env CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc go build -v; fi