-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (52 loc) · 2.28 KB
/
Copy pathMakefile
File metadata and controls
65 lines (52 loc) · 2.28 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
BINARY := evo-cli
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
DATE := $(shell date +%Y-%m-%d)
LDFLAGS := -s -w -X github.com/evopayment/evo-cli/internal/build.Version=$(VERSION) -X github.com/evopayment/evo-cli/internal/build.Date=$(DATE)
PREFIX ?= /usr/local
.PHONY: build gen_meta test vet install clean e2e e2e-live e2e-live-verbose test-all release publish
build: gen_meta
go build -trimpath -ldflags "$(LDFLAGS)" -o $(BINARY) .
gen_meta:
python3 scripts/gen_meta.py \
--merchant-input evopayment-skills/swagger-merchant-api.json \
--linkpay-input evopayment-skills/swagger-linkpay-api.json \
--output internal/registry/meta_data.json
test: vet
go test -race -count=1 ./...
vet:
go vet ./...
install: build
install -m755 $(BINARY) $(PREFIX)/bin/$(BINARY)
clean:
rm -f $(BINARY)
e2e: build
@echo "Running E2E tests (offline, no API calls)..."
bash scripts/e2e_test.sh ./$(BINARY)
e2e-live: build
@echo "Running Live E2E tests (calls real Evo Payment UAT APIs)..."
bash scripts/e2e_live_test.sh ./$(BINARY)
e2e-live-verbose: build
@echo "Running Live E2E tests (verbose — calls real Evo Payment UAT APIs)..."
bash scripts/e2e_live_test.sh ./$(BINARY) --verbose
test-all: test e2e
@echo "All tests passed (unit + e2e)"
release: test-all
@CURRENT=$$(git describe --tags --abbrev=0 2>/dev/null || echo "none"); \
echo "Current version: $$CURRENT"; \
printf "Enter new version (e.g. v0.2.0): "; \
read NEW_VERSION; \
if [ -z "$$NEW_VERSION" ]; then echo "Error: version cannot be empty"; exit 1; fi; \
case "$$NEW_VERSION" in v*) ;; *) NEW_VERSION="v$$NEW_VERSION";; esac; \
git tag -fa $$NEW_VERSION -m "Release $$NEW_VERSION"; \
echo "Tagged $$NEW_VERSION, building release with goreleaser..."; \
goreleaser release --clean
publish:
@npm whoami >/dev/null 2>&1 || { echo "Not logged in to npm, running npm login..."; npm login; }
@CURRENT=$$(node -p "require('./package.json').version"); \
echo "Current npm version: $$CURRENT"; \
printf "Enter new version (e.g. 0.2.0, without v prefix): "; \
read NEW_VERSION; \
if [ -z "$$NEW_VERSION" ]; then echo "Error: version cannot be empty"; exit 1; fi; \
npm version $$NEW_VERSION --no-git-tag-version; \
echo "Updated package.json to $$NEW_VERSION, publishing..."; \
npm publish --access public