fix(ci): build all possible platforms

This commit is contained in:
Łukasz Mierzwa
2019-08-28 10:44:25 +01:00
parent 368b4ef1c5
commit 74775ac98f
5 changed files with 16 additions and 9 deletions

View File

@@ -131,12 +131,8 @@ jobs:
# requires running webpack, so we need nodejs here
- travis_retry nvm install $(< .nvmrc)
script:
# compile assets via webpack and build those into bindata_assetfs.go file
- travis_retry make bindata_assetfs.go
# and now compile using bakelite for all target archs
- travis_retry go install github.com/terinjokes/bakelite
- export SOURCE_DATE_EPOCH=$(git show -s --format=%ci ${TRAVIS_TAG:-${TRAVIS_COMMIT}}^{commit})
- bakelite -platforms="-plan9" -ldflags="-X main.version=\"$(make show-version)\"" github.com/prymitive/karma
- make crosscompile -j 2
- for i in karma-*; do tar --mtime="${SOURCE_DATE_EPOCH}" --owner=0 --group=0 --numeric-owner -c $i | gzip -n - > $i.tar.gz; done
- shasum -a 512 karma-*.tar.gz | tee sha512sum.txt
# verify that there are no uncommited changes

View File

@@ -54,6 +54,21 @@ bindata_assetfs.go: .build/deps-build-go.ok .build/artifacts-bindata_assetfs.$(G
$(NAME): .build/deps-build-go.ok go.mod bindata_assetfs.go $(SOURCES)
GO111MODULE=on go build -ldflags "-X main.version=$(VERSION)"
word-split = $(word $2,$(subst -, ,$1))
cc-%: .build/deps-build-go.ok go.mod bindata_assetfs.go $(SOURCES)
$(eval GOOS := $(call word-split,$*,1))
$(eval GOARCH := $(call word-split,$*,2))
$(eval GOARM := $(call word-split,$*,3))
$(eval GOARMBIN := $(patsubst %,v%,$(GOARM)))
$(eval GOEXT := $(patsubst $(GOOS),,$(patsubst windows,.exe,$(GOOS))))
$(eval BINARY := "karma-$(GOOS)-$(GOARCH)$(GOARMBIN)$(GOEXT)")
@echo $(BINARY) $(GOOS) $(GOARCH) $(GOARM) | awk '{ printf "%-25s GOOS=%-10s GOARCH=%-10s GOARM=%1s\n", $$1, $$2, $$3, $$4 }'
@env CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) go build -o $(BINARY) -ldflags="-X main.version=$(shell make show-version)"
PLATFORMS := cc-darwin-386 cc-darwin-amd64 cc-dragonfly-amd64 cc-freebsd-386 cc-freebsd-amd64 cc-freebsd-arm-5 cc-freebsd-arm-6 cc-freebsd-arm-7 cc-linux-386 cc-linux-amd64 cc-linux-arm-5 cc-linux-arm-6 cc-linux-arm-7 cc-linux-arm64 cc-linux-ppc64 cc-linux-ppc64le cc-linux-mips cc-linux-mipsle cc-linux-mips64 cc-linux-mips64le cc-linux-s390x cc-netbsd-386 cc-netbsd-amd64 cc-netbsd-arm-5 cc-netbsd-arm-6 cc-netbsd-arm-7 cc-openbsd-386 cc-openbsd-amd64 cc-openbsd-arm-5 cc-openbsd-arm-6 cc-openbsd-arm-7 cc-solaris-amd64 cc-windows-386 cc-windows-amd64
crosscompile: $(PLATFORMS)
@echo
.PHONY: clean
clean:
rm -fr .build bindata_assetfs.go $(NAME) ui/build ui/node_modules coverage.txt

1
go.mod
View File

@@ -31,7 +31,6 @@ require (
github.com/sirupsen/logrus v1.4.2
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.4.0
github.com/terinjokes/bakelite v0.2.0
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1 // indirect
gopkg.in/go-playground/colors.v1 v1.2.0
gopkg.in/yaml.v2 v2.2.2

2
go.sum
View File

@@ -405,8 +405,6 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/terinjokes/bakelite v0.2.0 h1:JGi8jKb3aJqICvSKnDOeitMW+bI+mGTamVLaXDx9KOM=
github.com/terinjokes/bakelite v0.2.0/go.mod h1:0kyG4J0HmOjPP7UkdsV/6zaBfpd7ZpfB9kkUrfFI6Qw=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/timakin/bodyclose v0.0.0-20190407043127-4a873e97b2bb h1:lI9ufgFfvuqRctP9Ny8lDDLbSWCMxBPletcSqrnyFYM=

View File

@@ -10,5 +10,4 @@ import (
_ "github.com/elazarl/go-bindata-assetfs"
_ "github.com/go-bindata/go-bindata"
_ "github.com/golangci/golangci-lint/pkg/commands"
_ "github.com/terinjokes/bakelite"
)