# Fallback if neither is found and nothing was provided
CONTAINER_TOOL ?= docker
# Default target
.PHONY: all
all: build
.PHONY: build
# Build Gokapi binary
build :
@echo "Building binary..."
@echo
go generate ./...
CGO_ENABLED=0 go build $(BUILD_FLAGS) -o ./gokapi $(GOPACKAGE)/cmd/gokapi
.PHONY: build-cli
# Build Gokapi-CLI binary
build-cli :
@echo "Building CLI binary..."
@echo
go generate ./...
CGO_ENABLED=0 go build $(BUILD_FLAGS) -o ./gokapi-cli $(GOPACKAGE)/cmd/cli-uploader
.PHONY: build-debug
# Build Gokapi binary
build-debug :
@echo "Building binary with debug info..."
@echo
go generate ./...
CGO_ENABLED=0 go build $(BUILD_FLAGS_DEBUG) -o ./gokapi $(GOPACKAGE)/cmd/gokapi
.PHONY: coverage
coverage:
@echo Generating coverage
@echo
go generate ./...
GOKAPI_AWS_BUCKET="gokapi" GOKAPI_AWS_REGION="eu-central-1" GOKAPI_AWS_KEY="keyid" GOKAPI_AWS_KEY_SECRET="secret" go test ./... -parallel 8 --tags=test,awstest -coverprofile=/tmp/coverage1.out && go tool cover -html=/tmp/coverage1.out
.PHONY: coverage-specific
coverage-specific:
@echo Generating coverage for"$(TEST_PACKAGE)"
@echo
go generate ./...
go test$(GOPACKAGE)/$(TEST_PACKAGE)/... -parallel 8 --tags=test,awsmock -coverprofile=/tmp/coverage2.out && go tool cover -html=/tmp/coverage2.out
.PHONY: coverage-all
coverage-all:
@echo Generating coverage
@echo
go generate ./...
GOKAPI_AWS_BUCKET="gokapi" GOKAPI_AWS_REGION="eu-central-1" GOKAPI_AWS_KEY="keyid" GOKAPI_AWS_KEY_SECRET="secret" go test ./... -parallel 8 --tags=test,awstest -coverprofile=/tmp/coverage1.out && go tool cover -html=/tmp/coverage1.out
.PHONY: test
test:
@echo Testing with AWS mock
@echo
go generate ./...
go test ./... -parallel 8 --tags=test,awsmock
.PHONY: test-specific
test-specific:
@echo Testing package "$(TEST_PACKAGE)"
@echo
go generate ./...
go test$(GOPACKAGE)/$(TEST_PACKAGE)/... -parallel 8 -count=1 --tags=test,awsmock
.PHONY: test-all
test-all:
@echo Testing all tags
@echo
go generate ./...
go test ./... -parallel 8 --tags=test,noaws
go test ./... -parallel 8 --tags=test,awsmock
GOKAPI_AWS_BUCKET="gokapi" GOKAPI_AWS_REGION="eu-central-1" GOKAPI_AWS_KEY="keyid" GOKAPI_AWS_KEY_SECRET="secret" go test ./... -parallel 8 --tags=test,awstest
.PHONY: update-changelog
update-changelog:
@echo Updaing changelog
@echo
go run "./build/go-generate/updateChangelog.go"
.PHONY: clean
# Deletes binary
clean:
@echo "Cleaning up..."
rm -f $(OUTPUT_BIN)
.PHONY: docker-build
# Create a Docker image
# Use make docker-build CONTAINER_TOOL=podman for podman instead of Docker