Add CICD
Some checks failed
CI/CD Pipeline / Security Scan (push) Failing after 17s
CI/CD Pipeline / Lint (push) Failing after 10m32s
CI/CD Pipeline / Test (push) Successful in 21m16s
CI/CD Pipeline / Build (arm64, darwin) (push) Failing after 9m44s
CI/CD Pipeline / Build (amd64, linux) (push) Failing after 10m14s
CI/CD Pipeline / Build (amd64, darwin) (push) Failing after 10m19s
CI/CD Pipeline / Build (amd64, windows) (push) Failing after 10m18s
CI/CD Pipeline / Build (arm64, linux) (push) Failing after 9m33s
CI/CD Pipeline / Release (push) Has been skipped
Some checks failed
CI/CD Pipeline / Security Scan (push) Failing after 17s
CI/CD Pipeline / Lint (push) Failing after 10m32s
CI/CD Pipeline / Test (push) Successful in 21m16s
CI/CD Pipeline / Build (arm64, darwin) (push) Failing after 9m44s
CI/CD Pipeline / Build (amd64, linux) (push) Failing after 10m14s
CI/CD Pipeline / Build (amd64, darwin) (push) Failing after 10m19s
CI/CD Pipeline / Build (amd64, windows) (push) Failing after 10m18s
CI/CD Pipeline / Build (arm64, linux) (push) Failing after 9m33s
CI/CD Pipeline / Release (push) Has been skipped
This commit is contained in:
97
Makefile
97
Makefile
@ -1,16 +1,103 @@
|
||||
# Makefile for Onyx
|
||||
.PHONY: build test clean install
|
||||
.PHONY: build test clean install lint security ci
|
||||
|
||||
# Default target
|
||||
all: clean lint test build
|
||||
|
||||
build:
|
||||
go build -o bin/onx ./cmd/onx
|
||||
go build -o bin/onxd ./cmd/onxd
|
||||
@echo "Building Onyx CLI and daemon..."
|
||||
@mkdir -p bin
|
||||
go build -ldflags="-s -w" -o bin/onx ./cmd/onx
|
||||
go build -ldflags="-s -w" -o bin/onxd ./cmd/onxd
|
||||
@echo "Build complete: bin/onx, bin/onxd"
|
||||
|
||||
test:
|
||||
go test -v ./...
|
||||
@echo "Running tests..."
|
||||
go test -v -race -coverprofile=coverage.out ./...
|
||||
@echo "Test coverage generated: coverage.out"
|
||||
|
||||
coverage: test
|
||||
@echo "Coverage report:"
|
||||
go tool cover -html=coverage.out -o coverage.html
|
||||
@echo "Coverage report generated: coverage.html"
|
||||
|
||||
lint:
|
||||
@echo "Running linter..."
|
||||
golangci-lint run
|
||||
|
||||
security:
|
||||
@echo "Running security scan..."
|
||||
@which gosec > /dev/null || (echo "Installing gosec..." && go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest)
|
||||
gosec ./...
|
||||
|
||||
ci: lint security test build
|
||||
@echo "CI pipeline completed successfully"
|
||||
|
||||
install:
|
||||
go install ./cmd/onx
|
||||
go install ./cmd/onxd
|
||||
|
||||
clean:
|
||||
rm -rf bin/
|
||||
rm -rf bin/ coverage.out coverage.html
|
||||
|
||||
# Development targets
|
||||
dev-setup:
|
||||
@echo "Setting up development environment..."
|
||||
go mod download
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest
|
||||
@echo "Development tools installed"
|
||||
|
||||
fmt:
|
||||
@echo "Formatting code..."
|
||||
go fmt ./...
|
||||
goimports -w .
|
||||
|
||||
mod-tidy:
|
||||
@echo "Tidying modules..."
|
||||
go mod tidy
|
||||
|
||||
deps-update:
|
||||
@echo "Updating dependencies..."
|
||||
go get -u ./...
|
||||
go mod tidy
|
||||
|
||||
# Cross-platform builds
|
||||
build-all:
|
||||
@echo "Building for all platforms..."
|
||||
@mkdir -p bin
|
||||
|
||||
# Linux
|
||||
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/onx-linux-amd64 ./cmd/onx
|
||||
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/onxd-linux-amd64 ./cmd/onxd
|
||||
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o bin/onx-linux-arm64 ./cmd/onx
|
||||
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o bin/onxd-linux-arm64 ./cmd/onxd
|
||||
|
||||
# macOS
|
||||
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/onx-darwin-amd64 ./cmd/onx
|
||||
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/onxd-darwin-amd64 ./cmd/onxd
|
||||
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o bin/onx-darwin-arm64 ./cmd/onx
|
||||
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o bin/onxd-darwin-arm64 ./cmd/onxd
|
||||
|
||||
# Windows
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o bin/onx-windows-amd64.exe ./cmd/onx
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o bin/onxd-windows-amd64.exe ./cmd/onxd
|
||||
|
||||
@echo "Cross-platform builds completed"
|
||||
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " all - Clean, lint, test, and build"
|
||||
@echo " build - Build CLI and daemon for current platform"
|
||||
@echo " build-all - Cross-platform builds"
|
||||
@echo " test - Run tests with coverage"
|
||||
@echo " coverage - Generate HTML coverage report"
|
||||
@echo " lint - Run code linting"
|
||||
@echo " security - Run security scanning"
|
||||
@echo " ci - Run full CI pipeline"
|
||||
@echo " install - Install to PATH"
|
||||
@echo " clean - Clean build artifacts"
|
||||
@echo " fmt - Format code"
|
||||
@echo " mod-tidy - Tidy Go modules"
|
||||
@echo " dev-setup - Install development tools"
|
||||
@echo " help - Show this help message"
|
||||
|
Reference in New Issue
Block a user