feed-fetcher/Makefile

62 lines
1.6 KiB
Makefile
Raw Normal View History

2021-03-17 09:13:24 +00:00
.DEFAULT_GOAL := default
2021-03-17 09:51:00 +00:00
IMAGE ?= docker.cluster.fun/averagemarcus/feed-fetcher:latest
2021-03-17 09:13:24 +00:00
.PHONY: test # Run all tests, linting and format checks
test: lint check-format run-tests
.PHONY: lint # Perform lint checks against code
lint:
2021-03-17 09:51:00 +00:00
@go vet && golint -set_exit_status ./...
2021-03-17 09:13:24 +00:00
.PHONY: check-format # Checks code formatting and returns a non-zero exit code if formatting errors found
check-format:
2021-03-17 09:51:00 +00:00
@gofmt -e -l .
2021-03-17 09:13:24 +00:00
.PHONY: format # Performs automatic format fixes on all code
format:
2021-03-17 09:51:00 +00:00
@gofmt -s -w .
2021-03-17 09:13:24 +00:00
.PHONY: run-tests # Runs all tests
run-tests:
2021-03-17 09:51:00 +00:00
@go test
2021-03-17 09:13:24 +00:00
.PHONY: fetch-deps # Fetch all project dependencies
2021-03-17 09:51:00 +00:00
fetch-deps:s
@go mod tidy
2021-03-17 09:13:24 +00:00
.PHONY: build # Build the project
build: lint check-format fetch-deps
2021-03-17 09:51:00 +00:00
@go build -o PROJECT_NAME main.go
2021-03-17 09:13:24 +00:00
.PHONY: docker-build # Build the docker image
docker-build:
@docker build -t $(IMAGE) .
.PHONY: docker-publish # Push the docker image to the remote registry
docker-publish:
@docker push $(IMAGE)
.PHONY: run # Run the application
run:
2021-03-17 09:51:00 +00:00
@go run main.go
2021-03-17 09:13:24 +00:00
.PHONY: ci # Perform CI specific tasks to perform on a pull request
ci:
@echo "⚠️ 'ci' unimplemented"
.PHONY: release # Release the latest version of the application
release:
2021-03-21 08:46:46 +00:00
@kubectl --namespace feed-fetcher set image deployment feed-fetcher web=docker.cluster.fun/averagemarcus/feed-fetcher:$(SHA)
2021-03-17 09:13:24 +00:00
.PHONY: help # Show this list of commands
help:
@echo "feed-fetcher"
@echo "Usage: make [target]"
@echo ""
@echo "target description" | expand -t20
@echo "-----------------------------------"
@grep '^.PHONY: .* #' Makefile | sed 's/\.PHONY: \(.*\) # \(.*\)/\1 \2/' | expand -t20
default: test build