v2.0.0 ae3e752

Makefile RawHistoryFolder

1# This Makefile is used for dev purposes
2# Variables
3REPO := ghcr.io/bnema/gordon
4TAG := v2-dev
5DEV_TAG := v2-dev-$(shell date +%Y%m%d-%H%M%S)
6DIST_DIR := ./dist
7ENGINE := podman
8
9# Version information
10VERSION := $(shell git describe --tags --always --dirty)
11COMMIT := $(shell git rev-parse --short HEAD)
12BUILD_DATE := $(shell date -u '+%Y-%m-%d_%I:%M:%S%p')
13
14# Build flags
15LDFLAGS := -s -w \
16	-X main.version=$(VERSION) \
17	-X main.commit=$(COMMIT) \
18	-X main.date=$(BUILD_DATE)
19
20# Architectures
21ARCHS := amd64 arm64
22
23# Phony targets
24.PHONY: all build build-push clean dev-release test test-unit test-coverage test-race clean-test
25
26# Default target
27all: build
28
29# Build binaries
30build:
31	@echo "Building Go binaries..."
32	@mkdir -p $(DIST_DIR)
33	@rm -f $(DIST_DIR)/*
34	@echo "Building with version $(VERSION), commit $(COMMIT), date $(BUILD_DATE)"
35	@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o $(DIST_DIR)/gordon-linux-amd64 ./main.go
36	@CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$(LDFLAGS)" -o $(DIST_DIR)/gordon-linux-arm64 ./main.go
37	@echo "Go binaries built successfully"
38
39# Build and push Docker images
40build-push: build
41	@echo "Cleaning up dangling images..."
42	@$(ENGINE) image prune -f
43
44	@echo "Building and pushing Docker images..."
45	@for arch in $(ARCHS); do \
46		cp $(DIST_DIR)/gordon-linux-$$arch gordon; \
47		$(ENGINE) build -t $(REPO):$(TAG)-$$arch .; \
48		rm gordon; \
49		$(ENGINE) push $(REPO):$(TAG)-$$arch; \
50	done
51
52	@echo "Removing existing manifest..."
53	@$(ENGINE) manifest rm $(REPO):$(TAG) || true
54
55	@echo "Creating multi-arch manifest..."
56	@$(ENGINE) manifest create $(REPO):$(TAG) \
57		$(REPO):$(TAG)-amd64 \
58		$(REPO):$(TAG)-arm64
59
60	@echo "Annotating arm64 image..."
61	@$(ENGINE) manifest annotate $(REPO):$(TAG) \
62		$(REPO):$(TAG)-arm64 --arch arm64 --variant v8
63
64	@echo "Inspecting manifest..."
65	@$(ENGINE) manifest inspect $(REPO):$(TAG)
66
67	@echo "Pushing multi-arch manifest..."
68	@$(ENGINE) manifest push --all $(REPO):$(TAG)
69
70	@echo "Script completed successfully."
71
72# Create dev GitHub release (separate from GoReleaser)
73dev-release: build
74	@echo "Creating dev GitHub release..."
75	@if [ -z "$(shell which gh)" ]; then \
76		echo "Error: GitHub CLI (gh) is not installed. Please install it first."; \
77		exit 1; \
78	fi
79	@echo "Creating dev release $(DEV_TAG)..."
80	@gh release create $(DEV_TAG) \
81		--title "Gordon Dev Build $(DEV_TAG)" \
82		--notes "🚧 **Development Build** 🚧\n\nThis is an automated development build for testing purposes.\n\n**Commit:** $(COMMIT)\n**Build Date:** $(BUILD_DATE)\n\n⚠️ This is not a stable release. Use at your own risk." \
83		--prerelease \
84		--draft=false \
85		$(DIST_DIR)/gordon-linux-amd64 \
86		$(DIST_DIR)/gordon-linux-arm64
87	@echo "Dev release created successfully!"
88	@echo ""
89	@echo "📦 Download URLs:"
90	@echo "  AMD64: wget https://github.com/bnema/gordon/releases/download/$(DEV_TAG)/gordon-linux-amd64"
91	@echo "  ARM64: wget https://github.com/bnema/gordon/releases/download/$(DEV_TAG)/gordon-linux-arm64"
92	@echo ""
93	@echo "🔗 Release page: https://github.com/bnema/gordon/releases/tag/$(DEV_TAG)"
94
95# Test targets
96test: test-unit
97
98test-unit:
99	go test -v ./...
100
101test-race:
102	go test -race -v ./...
103
104test-coverage:
105	go test -coverprofile=coverage.out ./...
106	go tool cover -html=coverage.out -o coverage.html
107	@echo "Coverage report generated: coverage.html"
108
109
110clean-test:
111	rm -f coverage.out coverage.html
112
113# Clean up
114clean:
115	@echo "Cleaning up..."
116	@rm -rf $(DIST_DIR)
117	@$(ENGINE) system prune -f
118	@echo "Cleanup completed."

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close