-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (49 loc) · 2.23 KB
/
Makefile
File metadata and controls
62 lines (49 loc) · 2.23 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
60
61
62
# Use GitHub Actions environment variables if available, otherwise use git commands
GIT_DESCRIBE ?= $(or $(GITHUB_REF_NAME),$(shell git describe --tags --dirty --always))
GIT_COMMIT ?= $(or $(GITHUB_SHA),$(shell git rev-parse HEAD))
GIT_BRANCH ?= $(or $(GITHUB_REF_NAME),$(shell git rev-parse --abbrev-ref HEAD))
DATE ?= $(shell date +%Y-%m-%dT%H:%M:%S%z)
VERSION_FLAGS=-ldflags="-X github.com/l3montree-dev/devguard/config.Version=$(GIT_DESCRIBE) \
-X github.com/l3montree-dev/devguard/config.Commit=$(GIT_COMMIT) \
-X github.com/l3montree-dev/devguard/config.Branch=$(GIT_BRANCH) \
-X github.com/l3montree-dev/devguard/config.BuildDate=$(DATE)"
FLAGS=$(VERSION_FLAGS) -trimpath
run::
go run $(VERSION_FLAGS) ./cmd/devguard/main.go
clean::
docker compose down -v && docker compose up -d
mocks::
mockery --config=.mockery.yaml
lint::
docker run --rm -v ./:/app:ro -w /app golangci/golangci-lint:v2.1.6 golangci-lint run
lint-fix::
docker run --rm -v ./:/app:rw -w /app golangci/golangci-lint:v2.1.6 golangci-lint run --fix
test::
go list ./... | grep -v "/mocks" | xargs go test "$1"
devguard::
go build $(FLAGS) -o devguard ./cmd/devguard/main.go
devguard-cli::
go build $(FLAGS) -o devguard-cli cmd/devguard-cli/main.go
devguard-scanner::
go build $(FLAGS) -o devguard-scanner cmd/devguard-scanner/main.go
docs::
swag init -g cmd/devguard/main.go -o docs --v3.1
@rm -f docs/docs.go
@echo "OpenAPI spec generated at docs/swagger.json and docs/swagger.yaml"
cli-docs::
@echo "Generating CLI documentation..."
@go run cmd/doc-gen/main.go
@echo "CLI documentation generated in docs/scanner/"
NIX_CACHE_BUCKET ?= nix.garage.l3montree.cloud
NIX_CACHE_ENDPOINT ?= s3.garage.l3montree.cloud
NIX_CACHE_REGION ?= garage
NIX_CACHE_SECRET_KEY ?= /etc/nix/cache-priv-key.pem
nix-cache-push::
@echo "Building dependency bundles..."
nix build --no-link .#deps-arm64
nix build --no-link .#deps-amd64
@echo "Pushing closures to S3 cache..."
nix copy \
$$(nix path-info -r .#deps-amd64) \
$$(nix path-info -r .#deps-arm64) \
--to 's3://$(NIX_CACHE_BUCKET)?endpoint=$(NIX_CACHE_ENDPOINT)®ion=$(NIX_CACHE_REGION)&scheme=https&profile=garage&secret-key=$(NIX_CACHE_SECRET_KEY)'