github.com/hellofresh/janus@v0.0.0-20230925145208-ce8de8183c67/Makefile (about)

     1  NO_COLOR=\033[0m
     2  OK_COLOR=\033[32;01m
     3  ERROR_COLOR=\033[31;01m
     4  WARN_COLOR=\033[33;01m
     5  
     6  VERSION ?= "dev-$(shell git rev-parse --short HEAD)"
     7  GO_LINKER_FLAGS=-ldflags="-s -w -X main.version=$(VERSION)"
     8  
     9  .PHONY: all lint test-unit test-integration test-features build
    10  
    11  all: test-unit build
    12  
    13  build:
    14  	@echo "$(OK_COLOR)==> Building default binary... $(NO_COLOR)"
    15  	@CGO_ENABLED=0 go build ${GO_LINKER_FLAGS} -o "dist/janus"
    16  
    17  test-unit:
    18  	@echo "$(OK_COLOR)==> Running unit tests$(NO_COLOR)"
    19  	@go test ./...
    20  
    21  test-integration: _mocks
    22  	@echo "$(OK_COLOR)==> Running integration tests$(NO_COLOR)"
    23  	@go test -cover -tags=integration -coverprofile=coverage.txt -covermode=atomic ./...
    24  
    25  test-features: build _mocks
    26  	@/bin/sh -c "./build/features.sh"
    27  
    28  lint:
    29  	@echo "$(OK_COLOR)==> Linting with golangci-lint running in docker container$(NO_COLOR)"
    30  	@docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.30.0 golangci-lint run -v
    31  
    32  _mocks:
    33  	@/bin/sh -c "./build/mocks.sh"