- Replace Woodpecker CI with Forgejo Actions workflows (ci.yml, release.yml) - Add goreleaser-lint and build jobs to CI pipeline - Simplify Makefile to match current project conventions - Update Containerfile with multi-stage Alpine build for ca-certs, tzdata, and non-root user - Use .Tag for docker image templates and enable latest manifest - Add explicit release.gitea config to goreleaser Reviewed-on: #1 Co-authored-by: Felipe M. <me@fmartingr.com> Co-committed-by: Felipe M. <me@fmartingr.com>
57 lines
1.2 KiB
Makefile
57 lines
1.2 KiB
Makefile
PROJECT_NAME := butterrobot
|
|
CGO_ENABLED := 0
|
|
|
|
DIST_PATH := ./dist
|
|
TEST_OPTIONS := -v -failfast -race -cover
|
|
|
|
GOLANGCI_LINT_VERSION := v1.64.5
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
## help: Display this help message
|
|
.PHONY: help
|
|
help:
|
|
@echo "Available targets:"
|
|
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## / /' | sort
|
|
|
|
## build: Build project using goreleaser (snapshot)
|
|
.PHONY: build
|
|
build:
|
|
goreleaser build --snapshot --clean
|
|
|
|
## build-docker: Build Docker image locally via goreleaser
|
|
.PHONY: build-docker
|
|
build-docker:
|
|
goreleaser release --snapshot --clean
|
|
|
|
## run: Run the server directly via go run
|
|
.PHONY: run
|
|
run:
|
|
CGO_ENABLED=$(CGO_ENABLED) go run ./cmd/$(PROJECT_NAME)
|
|
|
|
## format: Format code and tidy modules
|
|
.PHONY: format
|
|
format:
|
|
go fmt ./...
|
|
go mod tidy
|
|
|
|
## ci-lint: Run golangci-lint (installs if missing)
|
|
.PHONY: ci-lint
|
|
ci-lint:
|
|
@which golangci-lint > /dev/null 2>&1 || go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
|
|
golangci-lint run ./...
|
|
|
|
## lint: Run linters
|
|
.PHONY: lint
|
|
lint: ci-lint
|
|
|
|
## test: Run tests with coverage
|
|
.PHONY: test
|
|
test:
|
|
CGO_ENABLED=1 go test $(TEST_OPTIONS) -timeout 1m ./...
|
|
|
|
## clean: Remove build artifacts
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf $(DIST_PATH)
|
|
go clean -cache
|