41 lines
936 B
Makefile
41 lines
936 B
Makefile
|
|
# ABOUTME: Build automation and code generation for EdgeXR SDK
|
||
|
|
# ABOUTME: Provides targets for generating types, testing, and building the CLI
|
||
|
|
|
||
|
|
.PHONY: generate test build clean install-tools
|
||
|
|
|
||
|
|
# Install required tools
|
||
|
|
install-tools:
|
||
|
|
go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest
|
||
|
|
|
||
|
|
# Generate Go types from OpenAPI spec
|
||
|
|
generate:
|
||
|
|
oapi-codegen -config oapi-codegen.yaml api/swagger.json
|
||
|
|
|
||
|
|
# Run tests
|
||
|
|
test:
|
||
|
|
go test -v ./...
|
||
|
|
|
||
|
|
# Run tests with coverage
|
||
|
|
test-coverage:
|
||
|
|
go test -v -coverprofile=coverage.out ./...
|
||
|
|
go tool cover -html=coverage.out -o coverage.html
|
||
|
|
|
||
|
|
# Build the CLI
|
||
|
|
build:
|
||
|
|
go build -o bin/edge-connect .
|
||
|
|
|
||
|
|
# Clean generated files and build artifacts
|
||
|
|
clean:
|
||
|
|
rm -f sdk/client/types_generated.go
|
||
|
|
rm -f bin/edge-connect
|
||
|
|
rm -f coverage.out coverage.html
|
||
|
|
|
||
|
|
# Lint the code
|
||
|
|
lint:
|
||
|
|
golangci-lint run
|
||
|
|
|
||
|
|
# Run all checks (generate, test, lint)
|
||
|
|
check: generate test lint
|
||
|
|
|
||
|
|
# Default target
|
||
|
|
all: check build
|