Skip to content
Snippets Groups Projects
Makefile 2.18 KiB
Newer Older
  • Learn to ignore specific revisions
  • .PHONY: all dep build test lint
    
    
    sivan's avatar
    sivan committed
    lint: dep ## Lint the files
    	@golint -set_exit_status ./...
    
    
    test: dep ## Run unittests
    
    	@go test -cover -coverprofile=coverage.txt -covermode count ./...
    
    sivan's avatar
    sivan committed
    
    
    dep: login ## Get the dependencies
    
    	@go get -a -v ./...
    	@go get google.golang.org/grpc/internal/transport@v1.37.0
    	@go get google.golang.org/grpc@v1.37.0
    
    sivan's avatar
    sivan committed
    	@go get -u golang.org/x/lint/golint
    	@go get -u github.com/boumenot/gocover-cobertura
    
    coverage: dep
    
    	@go test -v -coverpkg=./... -coverprofile=cover.out ./...
    	@go tool cover -func cover.out | grep total
    	@go tool cover -html=cover.out -o cover.html
    
    sivan's avatar
    sivan committed
    
    windows:
    
    	$(eval export GOOS := windows)
    
    sivan's avatar
    sivan committed
    	@go build -o builds/main ./cmd/query-service/
    
    sivan's avatar
    sivan committed
    
    
    macos:
    	$(eval export GOOS := darwin)
    
    sivan's avatar
    sivan committed
    	@go build -o builds/main ./cmd/query-service/
    
    sivan's avatar
    sivan committed
    
    
    linux: login # Build for linux
    
    	$(eval export GOOS := linux)
    
    sivan's avatar
    sivan committed
    	CGO_ENABLED=0 go build -o builds/main ./cmd/query-service/
    
    sivan's avatar
    sivan committed
    
    run:
    
    	./builds/main
    
    sivan's avatar
    sivan committed
    develop-sivan:
    
    sivan's avatar
    sivan committed
    	$(eval export RABBIT_USER := haha-test)
    	$(eval export RABBIT_PASSWORD := dikkedraak)
    	$(eval export RABBIT_HOST := 192.168.178.158)
    
    	$(eval export RABBIT_PORT := 5672)
    
    	$(eval export LOG_MESSAGES := true)
    
    	$(eval export REDIS_ADDRESS := localhost:6379)
    
    	@go run cmd/query-service/main.go
    
    
    sivan's avatar
    sivan committed
    	
    develop:
    	$(eval export RABBIT_USER := guest)
    	$(eval export RABBIT_PASSWORD := guest)
    	$(eval export RABBIT_HOST := localhost)
    	$(eval export RABBIT_PORT := 5672)
    
    	$(eval export LOG_MESSAGES := true)
    
    	$(eval export REDIS_ADDRESS := localhost:6379)
    
    
    	$(eval export ARANGO_HOST := https://datastrophe.science.uu.nl/)
    
    
    sivan's avatar
    sivan committed
    	@go run cmd/query-service/main.go
    
    
    	make linux
    
    thijsheijden's avatar
    thijsheijden committed
    	@docker build -t datastropheregistry.azurecr.io/query-service:latest . --ssh default
    	@docker push datastropheregistry.azurecr.io/query-service:latest
    
    thijsheijden's avatar
    thijsheijden committed
    
    
    thijsheijden's avatar
    thijsheijden committed
    	make linux
    	@docker build -t query-service-staging:latest .
    	@docker tag query-service-staging:latest datastropheregistry.azurecr.io/query-service-staging:latest
    
    	@docker push datastropheregistry.azurecr.io/query-service-staging:latest
    
    login:
    
    	echo -e "machine git.science.uu.nl\nlogin gitlab-ci-token\npassword ${CI_JOB_TOKEN}" > ~/.netrc
    
    documentation:
    	godoc -goroot ~/Developer/go
    	# wget -r -np -N -E -p -k http://localhost:6060/pkg/query-service?m=all