Skip to content

Commit

Permalink
Enable cross compile using goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ Bond committed Sep 3, 2019
1 parent d03517f commit 1dd6865
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
_output/
dist/
45 changes: 45 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
project_name: kubectl-trace
builds:
- goos:
- linux
- darwin
- windows
goarch:
- amd64
- 386
main: ./cmd/kubectl-trace
env:
- GO111MODULE=on
- CGO_ENABLED=0
ldflags: |
-X github.com/iovisor/kubectl-trace/pkg/version.buildTime={{ .Timestamp }}
-X github.com/iovisor/kubectl-trace/pkg/version.gitCommit={{ .Commit }}
-X github.com/iovisor/kubectl-trace/pkg/version.imageName={{ .Env.IMAGE_NAME }}
binary: kubectl-trace
- goos:
- linux
- darwin
- windows
goarch:
- amd64
- 386
main: ./cmd/trace-runner
env:
- GO111MODULE=on
- CGO_ENABLED=0
ldflags: |
-X github.com/iovisor/kubectl-trace/pkg/version.buildTime={{ .Timestamp }}
-X github.com/iovisor/kubectl-trace/pkg/version.gitCommit={{ .Commit }}
-X github.com/iovisor/kubectl-trace/pkg/version.imageName={{ .Env.IMAGE_NAME }}
binary: trace-runner

archive:
format_overrides:
- goos: windows
format: zip

snapshot:
name_template: 'master'

release:
disable: true
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ go:
- 1.11.4
services:
- docker
before_install:
- go get github.com/goreleaser/goreleaser
script:
- make test
- make _output/bin/kubectl-trace
- ./hack/ci-build-image.sh
- make integration
- make cross
after_success:
- ./hack/ci-release-image.sh
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ ${kubectl_trace}:
${trace_runner}:
CGO_ENABLED=1 $(GO) build ${LDFLAGS} -o $@ ./cmd/trace-runner

.PHONY: cross
cross:
IMAGE_NAME=$(IMAGE_NAME) go run github.com/goreleaser/goreleaser --snapshot --rm-dist

.PHONY: clean
clean:
rm -Rf _output
$(RM) -R _output
$(RM) -R dist

.PHONY: image/build-init
image/build-init:
Expand Down

0 comments on commit 1dd6865

Please sign in to comment.