Skip to content

Commit

Permalink
build binary for darwin, added file extension for windows binary (#63)
Browse files Browse the repository at this point in the history
* fail build on failed dependencies

* split docker auto and release builds

* Revert "split docker auto and release builds"

This reverts commit b26768e

* test variables inheritance

* try overriding RELEASE_VERSION

* try overriding RELEASE_VERSION

* build docker images in the release job

* fix docker auto-build job

* fix application build process, fixes #52

* arm artifacts

* adjust log level

* configurable retry options

* add app and version fields to logs

* check if runs in k8s and adjust checksum workers number accordingly

* by default run only 2 checksum workers in k8s

* fix go build recipes

* pass version to the docker build

* logstash/filebeat compatible logging

* add version to the build

* more advanced build chain

* fixed RELEASE_VERSION property

* fix dependencies

* fix reverse dep parameter

* simplify pipeline for now

* godeps build step

* params adjustment

* enable godeps

* run unit tests before release

* get rid of godeps

* fix release build

* upgrade to golang 1.15.2

* fix docker build

* upgrade logrus to v1.7.0

* upgrade go dependencies

* log if k8s env detected

* added licence notice to each file

* fix kotlin license notice

* another fix for kotlin license notice

* fix checksum of the test.file

* try another comment approach

* remove comment

* fix TC license notice

* try to improve the pipeline

* use proper build dependencies

* override RELEASE_VERSION in dependencies

* build binary for darwin, added file extension for windows binary
  • Loading branch information
mazay authored Oct 20, 2020
1 parent 6192fc9 commit 8e34e8c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/386,
DOCKER_BASE_REPO=zmazay/s3sync-service
DOCKER_IMAGE_NAME=${DOCKER_BASE_REPO}:${RELEASE_VERSION}

GOLANG_OS_LIST=freebsd linux windows
GOLANG_OS_LIST=freebsd linux windows darwin
GOLANG_ARCH_LIST=386 amd64 arm

# Validate build arguments
Expand All @@ -29,16 +29,15 @@ $(error RELEASE_VERSION value is not set)
endif

# Generate OS specific filename
ifeq ($(OS), "windows")
filename=s3sync-service.exe
else
filename=s3sync-service
endif
define get-filename
$(if $(filter $(1),windows),s3sync-service.exe,s3sync-service)
endef

# Generates a set of build args
go-build-args := $(foreach OS,$(GOLANG_OS_LIST), \
$(foreach ARCH,$(GOLANG_ARCH_LIST), \
$(OS)-$(ARCH) ) )
$(foreach ARCH,$(if $(filter $(OS),darwin), \
$(filter-out 386 arm,$(GOLANG_ARCH_LIST)),$(GOLANG_ARCH_LIST)), \
$(OS)-$(ARCH)))

build:
go build -o $(filename) -ldflags \
Expand All @@ -48,10 +47,11 @@ build-all: $(go-build-args)
$(go-build-args):
$(eval OS := $(word 1,$(subst -, ,$@)))
$(eval ARCH := $(word 2,$(subst -, ,$@)))
GOOS=$(OS) GOARCH=$(ARCH) go build -o $(filename) -ldflags \
$(eval FILENAME := $(call get-filename,$(OS)))
GOOS=$(OS) GOARCH=$(ARCH) go build -o $(FILENAME) -ldflags \
"-X main.version=${RELEASE_VERSION}" ./src/ && \
tar -czvf s3sync-service-${RELEASE_VERSION}-$(OS)-$(ARCH).tar.gz $(filename) && \
rm $(filename)
tar -czvf s3sync-service-${RELEASE_VERSION}-$(OS)-$(ARCH).tar.gz $(FILENAME) && \
rm $(FILENAME)

clean:
rm -rf s3sync-service-*.tar.gz
Expand Down

0 comments on commit 8e34e8c

Please sign in to comment.