Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (42 loc) · 1.79 KB
/
Copy pathMakefile
File metadata and controls
59 lines (42 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# SPDX-FileCopyrightText: Copyright 2026 B42Labs contributors
# SPDX-License-Identifier: BUSL-1.1
# Makefile for ogrm (openstack-github-runner-manager).
#
# The repository is a single standalone Go module. GOWORK is pinned to off so
# every go invocation resolves against this module's own go.mod even when the
# checkout sits below an unrelated go.work workspace.
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
export GOWORK := off
BIN ?= bin/ogrm
# Build metadata linked into the binary via -ldflags -X. Override on the CLI:
# make build VERSION=v0.1.0
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo 0.0.0-dev)
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)
.PHONY: help build test test-go test-disk-guard vet lint tidy fmt run clean
help: ## Print this help
@grep -hE '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-16s\033[0m %s\n",$$1,$$2}'
build: ## Build the ogrm binary into bin/
go build -ldflags "$(LDFLAGS)" -o $(BIN) .
test: test-go test-disk-guard ## Run every unit test (Go and the disk guard)
test-go: ## Run the Go unit tests
go test ./...
test-disk-guard: ## Exercise the disk guard install.sh generates (no root, no Docker)
./hack/test-disk-guard.sh
vet: ## Run go vet
go vet ./...
lint: ## Run golangci-lint over the module (requires golangci-lint >= 1.26 toolchain)
golangci-lint run ./...
tidy: ## Tidy go.mod and go.sum
go mod tidy
fmt: ## Format the Go sources
gofmt -w .
run: build ## Build and run, e.g. make run ARGS="create -name acme -count 2"
$(BIN) $(ARGS)
clean: ## Remove build artifacts
rm -rf bin