Demo changes
Some checks failed
Build / build (push) Successful in 2m1s
Test / build (push) Failing after 11m48s

This commit is contained in:
Chuck Smith
2024-03-18 20:00:14 -04:00
parent ca4eed10b8
commit 0b1ed43ae5
12 changed files with 171 additions and 111 deletions

View File

@@ -1,93 +1,33 @@
.PHONY: dev build cli server install image release profile compare bench test clean
.PHONY: dev build install image profile bench test clean
CGO_ENABLED=0
COMMIT=$(shell git rev-parse --short HEAD)
VERSION ?= $(shell git describe 2>/dev/null || echo "")
all: dev
DESTDIR ?= $(GOBIN)
dev: build
@./monkey-lang -d
ifeq ($(LOCAL), 1)
IMAGE := r.mills.io/prologic/monkey
TAG := dev
else
ifeq ($(BRANCH), master)
IMAGE := prologic/monkey
TAG := latest
else
IMAGE := prologic/monkey
TAG := dev
endif
endif
all: help
help: ## Show this help message
@echo "monkey - Monkey Lang"
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
dev: cli ## Build monkey and run the REPL
@./monkey
build: clean cli server ## Build monkey
cli: ## Build monkey CLI
build: clean
@go build \
-tags "netgo static_build" -installsuffix netgo \
-ldflags "-w -X go.mills.io/monkey/v2.MonkeyVersion=$(VERSION)" \
./cmd/monkey/...
-ldflags "-w -X $(shell go list)/version/.GitCommit=$(COMMIT)" \
.
server: ## Build Monkey server
@go build \
-tags "netgo static_build" -installsuffix netgo \
-ldflags "-w -X go.mills.io/monkey/v2.MonkeyVersion=$(VERSION)" \
./cmd/monkey-server/...
install: build
@go install
install: cli server ## Install monkey to $DESTDIR
@install -D -m 755 monkey $(DESTDIR)/monkey
@install -D -m 755 monkey-server $(DESTDIR)monkey-server
image:
@docker build -t prologic/monkey-lang .
ifeq ($(PUBLISH), 1)
image: ## Build and Publish the Docker image
@docker buildx build \
--build-arg VERSION="$(VERSION)" \
--build-arg COMMIT="$(COMMIT)" \
--build-arg BUILD="$(BUILD)" \
--platform linux/amd64,linux/arm64 --push -t $(IMAGE):$(TAG) .
else
image: ## Build the Docker image
@docker build \
--build-arg VERSION="$(VERSION)" -t $(IMAGE):$(TAG) .
endif
release: ## Release monkey
@./tools/release.sh
profile: ## Run tests with profiling enabled
profile:
@go test -cpuprofile cpu.prof -memprofile mem.prof -v -bench ./...
compare: ## Run benchmarks comparing Monkey with other languages
@hyperfine -w 5 -p 'make build; gcc -o examples/fib examples/fib.c' \
-n c -n go -n tengo -n python -n tauc -n taugo -n monkey \
--sort mean-time --export-markdown Benchmark.md \
'./examples/fib' \
'go run examples/fib.go' \
'tengo examples/fib.tengo' \
'python3 examples/fib.py' \
'tauc examples/fib.tau' \
'taugo examples/fib.tau' \
'./monkey examples/fib.m'
bench: # Run test benchmarks
bench:
@go test -v -benchmem -bench=. ./...
test: ## Run unit tests
@go test -v \
-cover \
-coverprofile coverage.out \
-covermode atomic \
-coverpkg ./... \
-race \
./...
test:
@go test -v -cover -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... -race ./...
clean: ## Cleanup untrakced files
@git clean -f -d -X 2> /dev/null || true
clean:
@git clean -f -d -X