-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (39 loc) · 1.48 KB
/
Makefile
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
export UNAME := $(shell uname -sm | sed 's/ /-/' | tr '[:upper:]' '[:lower:]')
export MAKE_UNAME := $(shell uname -sm | sed 's/ /_/' | tr '[:lower:]' '[:upper:]')
export VERSION := $(shell grep "^version" shard.yml | cut -d ' ' -f 2)
SRC_FILES = $(shell find src)
CRYSTAL ?= crystal
CRYSTAL_SPEC_ARGS = --fail-fast --order random
CRYSTAL_ARGS_LOCAL_DARWIN_X86_64 = --progress
CRYSTAL_ARGS_LOCAL_LINUX_X86_64 = --progress
CRYSTAL_ARGS_LOCAL_LINUX_AARCH64 = --progress
CRYSTAL_ARGS_RELEASE_DARWIN_X86_64 = --release --no-debug
CRYSTAL_ARGS_RELEASE_LINUX_X86_64 = --static --release --no-debug
CRYSTAL_ARGS_RELEASE_LINUX_AARCH64 = --static --release --no-debug
.PHONY: init release docs
lint_and_test: lint test
test:
$(CRYSTAL) spec $(CRYSTAL_SPEC_ARGS)
lint: bin/ameba
bin/ameba
bin/ameba:
shards install
ci:
shards install --without-development
$(MAKE) lint_and_test
clean:
# Nothing to clean. This is a library.
release:
# Nothing to build. This is a library.
github_release:
@git diff --quiet -- . :^shard.yml :^docs || { echo "Commit your changes (except docs/ and shard.yml) first." ; exit 1; }
@[ ! $$(git tag -l "v$(VERSION)") ] || { echo "Tag v$(VERSION) already exists." ; exit 1; }
$(MAKE) lint_and_test
$(MAKE) docs
git add docs && git commit -q -m "v$(VERSION)" docs || true
git commit -q -m "v$(VERSION)" shard.yml || true
git tag v$(VERSION) && git push --atomic origin master v$(VERSION)
version:
@echo $(VERSION)
docs:
@crystal doc --project-version=v$(VERSION)