-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
50 lines (39 loc) · 1.28 KB
/
Makefile
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
# # Some interesting links on Makefiles:
# https://danishpraka.sh/2019/12/07/using-makefiles-for-go.html
# https://tech.davis-hansson.com/p/make/
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
SHELL := bash
export REGISTRY_SESSION_PASS=pass
## install: compile the code and installs in binary in $GOPATH/bin
install:
@go install
.PHONY: install
## run: start the apps registry for development
run: cozy-registry.yml sessionsecret.key
@go run . serve
.PHONY: run
cozy-registry.yml:
@cp cozy-registry.example.yml cozy-registry.yml
sessionsecret.key:
@go run . gen-session-secret --passphrase sessionsecret.key
## lint: enforce a consistent code style and detect code smells
lint: bin/golangci-lint
@bin/golangci-lint run -E gofmt -E unconvert -E misspell -E whitespace -E bidichk
.PHONY: lint
bin/golangci-lint: Makefile
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.63.1
## tests: run the tests
tests:
@go test -p 1 ./...
.PHONY: tests
## clean: clean the generated files and directories
clean:
@rm -rf bin cozy-registry.yml sessionsecret.key
@go clean
.PHONY: clean
## help: print this help message
help:
@echo "Usage:"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
.PHONY: help