Skip to content
This repository was archived by the owner on Feb 7, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ deploy:
- build/linux-arm-gitlab-ci-helper
- build/linux-arm64-gitlab-ci-helper
- build/alpine-amd64-gitlab-ci-helper
- build/checksums.txt
skip_cleanup: true
overwrite: true
on:
Expand Down
41 changes: 39 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
.DEFAULT_GOAL := default


SHA1=$(shell git rev-parse HEAD)
GO_PKG = ./,./commands,./integrations/flowdock,./integrations/hipchat
SHA1 = $(shell git rev-parse HEAD)
GO_PKG = ./,./commands,./integrations/flowdock,./integrations/hipchat
GO_FILES = $(shell find $(GO_PROJECTS_PATHS) -maxdepth 1 -type f -name "*.go")
OS = $(shell uname)

# COLORS
RED = $(shell printf "\33[31m")
GREEN = $(shell printf "\33[32m")
WHITE = $(shell printf "\33[37m")
YELLOW = $(shell printf "\33[33m")
RESET = $(shell printf "\33[0m")

help: ## prints help
@cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf " > \033[36m%-20s\033[0m %s\n", $$1, $$2}'
Expand Down Expand Up @@ -43,6 +51,35 @@ build: ## build binaries
docker run --rm -v $(shell pwd):/usr/src/myapp -v $(GOPATH):/usr/src/myapp/vendor -w /usr/src/myapp -e "GOPATH=/usr/src/myapp/vendor:/go" -e GOOS=linux -e GOARCH=amd64 golang:1.9-alpine go build -ldflags "-X main.RefLog=$(SHA1) -s -w" -o build/alpine-amd64-gitlab-ci-helper cli/main.go
endif

build_checksums: ## generate checksums for binaries
@echo "${YELLOW}Generating CLI build checksums${RESET}"
@rm -f build/checksums.txt

# for OSX users where you have md5 instead of md5sum
ifeq (${OS}, Darwin)
# md5 output has the following format:
#
# MD5 (darwin-386-gitlab-ci-helper) = 8eb317789e5d08e1c800cc469c20325a
#
# that's why sed and awk are used to cleanup
@cd build && ls . | grep gitlab-ci-helper \
| xargs md5 \
| awk '{ printf("%s\n%s\n\n", $$2, $$4) }' \
| sed 's/[()]//g' \
>> checksums.txt
else
# md5sum output has the following format:
#
# 8eb317789e5d08e1c800cc469c20325a darwin-386-gitlab-ci-helper
#
# that's why awk is used to cleanup
@cd build && ls . | grep gitlab-ci-helper \
| xargs md5sum \
| awk '{ printf("%s\n%s\n\n", $$2, $$1) }' \
>> checksums.txt
endif
@echo "${GREEN}✔ successfully generated CLI build checksums to ${WHITE}build/checksums.txt${RESET}\n"

coverage-backend: ## run coverage tests
mkdir -p build/coverage
rm -rf build/coverage/*.cov
Expand Down