2021-12-08 12:45:23 +01:00
|
|
|
#!/bin/bash
|
2021-06-06 19:28:02 +02:00
|
|
|
#
|
|
|
|
# Build on all supported architectures & operating systems
|
2017-06-18 15:40:38 +02:00
|
|
|
|
2021-12-08 12:45:23 +01:00
|
|
|
function build {
|
|
|
|
# Discard resulting binary by writing to /dev/null
|
|
|
|
go build -tags without_openssl -o /dev/null
|
|
|
|
}
|
2017-06-18 15:40:38 +02:00
|
|
|
|
2021-12-08 18:53:15 +01:00
|
|
|
function compile_tests {
|
|
|
|
for i in $(go list ./...) ; do
|
|
|
|
go test -c -tags without_openssl -o /dev/null "$i" > /dev/null
|
|
|
|
done
|
|
|
|
}
|
2017-06-18 15:40:38 +02:00
|
|
|
|
2021-12-08 18:53:15 +01:00
|
|
|
set -eux
|
2018-05-15 23:04:52 +02:00
|
|
|
|
2021-12-08 12:45:23 +01:00
|
|
|
export GO111MODULE=on
|
2021-06-06 19:28:02 +02:00
|
|
|
export CGO_ENABLED=0
|
|
|
|
|
2021-12-08 12:45:23 +01:00
|
|
|
GOOS=linux GOARCH=amd64 build
|
2021-06-06 19:28:02 +02:00
|
|
|
|
2020-02-29 21:51:34 +01:00
|
|
|
# See https://github.com/golang/go/wiki/GoArm
|
2021-12-08 12:45:23 +01:00
|
|
|
GOOS=linux GOARCH=arm GOARM=7 build
|
|
|
|
GOOS=linux GOARCH=arm64 build
|
2020-02-29 21:51:34 +01:00
|
|
|
|
2021-06-05 15:07:18 +02:00
|
|
|
# MacOS on Intel
|
2021-12-08 12:45:23 +01:00
|
|
|
GOOS=darwin GOARCH=amd64 build
|
2021-12-08 18:53:15 +01:00
|
|
|
# Catch tests that don't work on MacOS (takes a long time so we only run it once)
|
|
|
|
time GOOS=darwin GOARCH=amd64 compile_tests
|
2017-06-18 15:40:38 +02:00
|
|
|
|
2021-06-06 21:10:24 +02:00
|
|
|
# MacOS on Apple Silicon M1.
|
|
|
|
# Go 1.16 added support for the M1 and added ios/arm64,
|
|
|
|
# so we use this to check if we should attempt a build.
|
|
|
|
if go tool dist list | grep ios/arm64 ; then
|
2021-12-08 12:45:23 +01:00
|
|
|
GOOS=darwin GOARCH=arm64 build
|
2021-06-06 21:10:24 +02:00
|
|
|
fi
|