.PHONY: build docker-build docker-run docker-push lint vet gofumpt test cross-build integration-test

BIN := synapse-backupper
CMD := ./cmd/synapse-backupper
GO := go

build:
	$(GO) build -o bin/$(BIN) $(CMD)

docker-build:
	docker build -t synapse-backupper:latest -f deploy/docker/Dockerfile .

docker-run:
	docker run --rm synapse-backupper:latest --help

docker-push:
	docker push synapse-backupper:latest

lint:
	golangci-lint run --timeout 5m ./...

vet:
	$(GO) vet ./...

gofumpt:
	gofumpt -l .

test:
	$(GO) test -race ./...

cross-build:
	GOOS=linux GOARCH=amd64 $(GO) build -o bin/$(BIN)-linux-amd64 $(CMD)
	GOOS=linux GOARCH=arm64 $(GO) build -o bin/$(BIN)-linux-arm64 $(CMD)

integration-test: docker-build
	docker tag synapse-backupper:latest synapse-backupper:test
	bash scripts/integration-test.sh
