init(build): add Makefile and dependencies for building and testing enclave

This commit is contained in:
2026-01-07 14:20:23 -05:00
parent 262e7b869e
commit b13901df62
3 changed files with 104 additions and 0 deletions

65
Makefile Normal file
View File

@@ -0,0 +1,65 @@
.PHONY: all init generate build build-wasm test test-cover lint fmt vet clean tidy help
MODULE := enclave
BINARY := enclave
BUILD_DIR := build
all: generate build
generate:
@sqlc generate
build:
@mkdir -p $(BUILD_DIR)
@go build -o $(BUILD_DIR)/$(BINARY) ./...
build-wasm:
@mkdir -p $(BUILD_DIR)
@GOOS=js GOARCH=wasm go build -o $(BUILD_DIR)/$(BINARY).wasm ./...
test:
@go test -v ./...
test-cover:
@go test -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
lint:
@golangci-lint run ./...
fmt:
@go fmt ./...
@gofumpt -w .
vet:
@go vet ./...
clean:
@rm -rf $(BUILD_DIR)
@rm -f coverage.out coverage.html
tidy:
@go mod tidy
deps:
@go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@go install mvdan.cc/gofumpt@latest
verify: fmt vet lint test
help:
@echo "Available targets:"
@echo " init - Initialize Go module"
@echo " generate - Run sqlc to generate Go code"
@echo " build - Build binary"
@echo " build-wasm - Build WASM binary"
@echo " test - Run tests"
@echo " test-cover - Run tests with coverage"
@echo " lint - Run golangci-lint"
@echo " fmt - Format code"
@echo " vet - Run go vet"
@echo " clean - Remove build artifacts"
@echo " tidy - Run go mod tidy"
@echo " deps - Install development dependencies"
@echo " verify - Run fmt, vet, lint, and test"

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module enclave
go 1.25.5

36
sqlc.yaml Normal file
View File

@@ -0,0 +1,36 @@
version: "2"
sql:
- engine: "sqlite"
queries: "db/query.sql"
schema: "db/schema.sql"
gen:
go:
package: "db"
out: "db"
emit_json_tags: true
emit_empty_slices: true
emit_pointers_for_null_types: true
emit_interface: true
emit_exact_table_names: false
json_tags_case_style: "snake"
overrides:
- column: "did_documents.document"
go_type: "encoding/json.RawMessage"
- column: "credentials.transports"
go_type: "encoding/json.RawMessage"
- column: "ucan_tokens.capabilities"
go_type: "encoding/json.RawMessage"
- column: "ucan_tokens.proof_chain"
go_type: "encoding/json.RawMessage"
- column: "ucan_tokens.facts"
go_type: "encoding/json.RawMessage"
- column: "sessions.device_info"
go_type: "encoding/json.RawMessage"
- column: "services.metadata"
go_type: "encoding/json.RawMessage"
- column: "grants.scopes"
go_type: "encoding/json.RawMessage"
- column: "grants.accounts"
go_type: "encoding/json.RawMessage"
- column: "delegations.caveats"
go_type: "encoding/json.RawMessage"