-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (54 loc) · 1.93 KB
/
Makefile
File metadata and controls
69 lines (54 loc) · 1.93 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
63
64
65
66
67
68
69
.PHONY: all build install test vet generate lint gosec coverage clean devcontainer-build test-linux test-integration test-all
all: build vet test
build:
go build -o bin/aide ./cmd/aide
install:
go install ./cmd/aide
test:
go test ./...
test-integration:
go test -tags integration ./...
vet:
go vet ./...
generate:
go generate ./...
lint:
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run ./...; \
else \
echo "golangci-lint not installed, skipping lint"; \
fi
# gosec rules excluded per .gosec.yaml (single source of truth)
GOSEC_EXCLUDE := $(shell yq -r '.exclude | keys | join(",")' .gosec.yaml 2>/dev/null)
gosec:
@if ! command -v gosec >/dev/null 2>&1; then \
echo "gosec not installed, skipping security scan"; \
elif [ -z "$(GOSEC_EXCLUDE)" ]; then \
echo "warning: could not read .gosec.yaml (is yq installed?), running gosec without exclusions"; \
gosec ./...; \
else \
gosec -exclude=$(GOSEC_EXCLUDE) ./...; \
fi
# Run tests with coverage and enforce thresholds from .testcoverage.yml
GOBIN := $(shell pwd)/.gobin
coverage:
go test -race -coverprofile=coverage.out ./...
@GOBIN=$(GOBIN) go install github.com/vladopajic/go-test-coverage/v2@latest
$(GOBIN)/go-test-coverage --config .testcoverage.yml
clean:
rm -rf bin/ coverage.out
# Devcontainer for Linux testing (not the aide application image)
devcontainer-build:
docker build -t aide-devcontainer -f .devcontainer/Dockerfile .
# Run the full test suite inside the Linux devcontainer
# This is needed for Linux-specific code (Landlock, bwrap) that can't run on macOS
test-linux: devcontainer-build
@if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then \
docker run --rm --privileged \
-v $(PWD):/workspace -w /workspace \
aide-devcontainer make all test-integration; \
else \
echo "Docker not available, skipping Linux tests"; \
fi
# Run everything: native tests + Linux container tests
test-all: all test-linux