-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (68 loc) · 2.7 KB
/
Copy pathMakefile
File metadata and controls
88 lines (68 loc) · 2.7 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
SHELL := /bin/bash
TEST_GLOB := ./test/test-*.js
VERSION ?= patch
test: test-node
test-node:
@npm test
test-deno:
@deno test -A $(TEST_GLOB)
test-bun:
@bun test --timeout 15000 $(TEST_GLOB)
test-csnobol4:
@if command -v snobol4 >/dev/null 2>&1; then \
node ./tools/check-csnobol4.js; \
else \
echo "snobol4 not found; skipping CSNOBOL4 fixture check"; \
fi
test-demo:
@npm test --prefix demo
test-all: test-node test-deno test-bun test-demo test-csnobol4
build:
@node ./build/build-image.js >| ./src/generated-snobol-image.json
run:
@node ./bin/snoflake.js --debug
profile:
@node ./tools/profile.js
coverage:
@node ./tools/sil-coverage.js
bench:
@node ./tools/bench-snoflake.js
bench-deno:
@deno bench -A ./tools/snoflake.bench.js
# Benchmark the working tree (uncommitted changes included) against a clean
# checkout of HEAD. A detached worktree provides the baseline, so the working
# tree is never disturbed. Pass FIXTURES="name ..." to narrow the set.
bench-diff:
@if git diff --quiet HEAD; then \
echo "Working tree matches HEAD; nothing to compare."; exit 1; \
fi
@worktree="$$(mktemp -d)/head"; \
trap 'git worktree remove --force "$$worktree" 2>/dev/null' EXIT; \
git worktree add --quiet --detach "$$worktree" HEAD; \
deno bench -A ./tools/snoflake.bench.js -- --baseline="$$worktree" $(FIXTURES)
bench-vs-csnobol4:
@node ./tools/bench-vs-csnobol4.js
demo:
@npm run demo
# To release: run make release from a clean master checkout. It defaults to
# VERSION=patch; use VERSION=minor, VERSION=major, or VERSION=X.Y.Z when
# needed. GitHub Actions publishes the package to npm after the release is
# created.
release-check:
@test "$$(git branch --show-current)" = "master" || { echo "Release from master."; exit 1; }
@test -z "$$(git status --porcelain --untracked-files=no)" || { git status --short --untracked-files=no; echo "Commit or stash tracked changes before releasing."; exit 1; }
@git fetch origin master --tags
@test "$$(git rev-list --count HEAD..origin/master)" = "0" || { echo "Local master is behind origin/master."; exit 1; }
@gh auth status >/dev/null
@npm test
@npm pack --dry-run
release: release-check
@case "$(VERSION)" in \
patch|minor|major|prepatch|preminor|premajor|prerelease|[0-9]*.[0-9]*.[0-9]*) ;; \
*) echo "Use VERSION=patch, minor, major, prerelease, or an explicit semver."; exit 1 ;; \
esac
@npm version "$(VERSION)"
@tag="v$$(node -p "require('./package.json').version")"; \
git push origin master "$$tag"; \
gh release create "$$tag" --verify-tag --title "$$tag" --generate-notes
.PHONY: test test-node test-deno test-bun test-csnobol4 test-demo test-all build run profile coverage bench bench-deno bench-diff bench-vs-csnobol4 demo release-check release