-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
89 lines (74 loc) · 2.07 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
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
89
export
RUST_BACKTRACE=full
.PHONY: ci
ci: # Checks same as CI
@make test-ci; \
make check; \
make fmt; \
make spell-check
.PHONY: tools
tools: tool-test tool-bump-version tool-spell-check
.PHONY: tool-test
tool-test:
@if ! which cargo-nextest > /dev/null; then \
cargo install cargo-nextest; \
fi
.PHONY: tool-bump-version
tool-bump-version:
@if ! which cargo-set-version > /dev/null; then \
cargo install cargo-edit; \
fi
.PHONY: tool-spell-check
tool-spell-check:
@if ! which typos > /dev/null; then \
cargo install typos-cli; \
fi
.PHONY: test-ci # for CI
test-ci:
RUST_BACKTRACE=full FZF_MAKE_IS_TESTING=true cargo test
.PHONY: test
test: tool-test
rm -rf $(TEST_DIR)
RUST_BACKTRACE=full FZF_MAKE_IS_TESTING=true cargo nextest run
.PHONY: test-watch
test-watch: tool-test
rm -rf $(TEST_DIR)
RUST_BACKTRACE=full FZF_MAKE_IS_TESTING=true cargo watch -x "nextest run"
.PHONY: bump-fzf-make-version
bump-fzf-make-version: tool-bump-version
@read -p "Really bump fzf-make version? y/n:" ans; \
if [ "$$ans" = y ]; then \
git checkout main; \
git pull; \
cargo set-version --bump minor; \
export CURRENT_VERSION=$$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version'); \
git add .; \
git commit -m "chore(release): bump to v$${CURRENT_VERSION}"; \
git push origin HEAD; \
gh release create "v$${CURRENT_VERSION}" --generate-notes --draft | sed 's@releases/tag@releases/edit@' | xargs open; \
fi; \
.PHONY: spell-check
spell-check: tool-spell-check
typos
DEBUG_EXECUTABLE = ./target/debug/fzf-make
TEST_DIR = ./test_data/history
.PHONY: run-in-test-data
run-in-test-data: build
@TARGET_DIR=$$(find $(TEST_DIR) -type d -maxdepth 1 | fzf) && \
if [ -n "$$TARGET_DIR" ]; then \
mv $(DEBUG_EXECUTABLE) "$${TARGET_DIR}" && cd "$${TARGET_DIR}" && ./fzf-make; \
else \
echo "No directory selected. Staying in the current directory."; \
fi
.PHONY: build
build:
@cargo build
.PHONY: fmt
fmt:
@cargo fmt -- --check
.PHONY: check
check:
@cargo clippy -- -D warnings
.PHONY: build-release
build-release:
@cargo build --verbose --release