chore: add Makefile and Drone pipeline

Build, test, run, install and clean targets, with the version
injected at link time. CI runs make check, build and test.
This commit is contained in:
root
2026-09-30 15:20:42 +00:00
parent e6147a832b
commit 371c189226
3 changed files with 65 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
---
kind: pipeline
name: coopcloud.tech/cctuip
steps:
- name: make check
image: golang:1.20
commands:
- make check
- name: make build
image: golang:1.20
commands:
- make build
depends_on:
- make check
- name: make test
image: golang:1.20
commands:
- make test
depends_on:
- make check
volumes:
- name: deps
temp: {}
+1
View File
@@ -1,2 +1,3 @@
cctuip
cctuip-dev
*.exe
+38
View File
@@ -0,0 +1,38 @@
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
GOPATH := $(shell go env GOPATH)
LDFLAGS := "-X 'main.version=$(VERSION)'"
DIST_LDFLAGS := $(LDFLAGS)" -s -w"
export GOPRIVATE=coopcloud.tech
all: format check build test
run:
@go run -ldflags=$(LDFLAGS) .
install:
@go install -ldflags=$(LDFLAGS) .
build-dev:
@go build -v -ldflags=$(LDFLAGS) -o cctuip-dev .
build:
@go build -v -ldflags=$(DIST_LDFLAGS) -o cctuip .
clean:
@rm -f cctuip cctuip-dev
@rm -f '$(GOPATH)/bin/cctuip'
format:
@gofmt -s -w .
check:
@test -z $$(gofmt -s -l .) || \
(echo "gofmt: formatting issue - run 'make format' to resolve" && exit 1)
@go vet ./...
test:
@go test ./... -cover -v
loc:
@find . -name "*.go" | xargs wc -l