-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathMakefile
More file actions
141 lines (116 loc) · 3.87 KB
/
Makefile
File metadata and controls
141 lines (116 loc) · 3.87 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Checks same as CI
.PHONY: ci
ci: test-ci check fmt-check detect-unused-dependencies check-licenses update-license-file spell-check
.PHONY: run
run:
@RUST_BACKTRACE=full cargo run
.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 --locked cargo-nextest --version 0.9.72; \
fi
.PHONY: tool-bump-version
tool-bump-version:
@if ! which cargo-set-version > /dev/null; then \
cargo install --locked cargo-edit --version 0.13.7; \
fi
.PHONY: tool-spell-check
tool-spell-check:
@if ! which typos > /dev/null; then \
cargo install --locked typos-cli --version 1.23.6; \
fi
.PHONY: tool-detect-unused-dependencies
tool-detect-unused-dependencies:
@if ! which cargo-machete > /dev/null; then \
cargo install --locked --git https://github.com/bnjbvr/cargo-machete --rev 744a6d5e0db5d189ad36edb08c5f77107cc42310 cargo-machete; \
fi
.PHONY: tool-check-licenses
tool-check-licenses:
@if ! which cargo-deny > /dev/null; then \
cargo install --locked cargo-deny --version 0.18.2; \
fi
.PHONY: tool-update-license-file
tool-update-license-file:
@if ! which cargo-about > /dev/null; then \
cargo install --locked cargo-about --version 0.8.2; \
fi
.PHONY: test-ci # for CI
test-ci:
RUST_BACKTRACE=full FZF_MAKE_IS_TESTING=true cargo test
TEST_HISTORY_DIR = ./test_data/history
.PHONY: test
test: tool-test
rm -rf $(TEST_HISTORY_DIR)
RUST_BACKTRACE=full FZF_MAKE_IS_TESTING=true cargo nextest run
.PHONY: test-watch
test-watch: tool-test
rm -rf $(TEST_HISTORY_DIR)
RUST_BACKTRACE=full FZF_MAKE_IS_TESTING=true cargo watch -x "nextest run"
.PHONY: run-watch
run-watch:
rm -rf $(TEST_HISTORY_DIR)
RUST_BACKTRACE=full FZF_MAKE_IS_TESTING=true cargo watch -x "run"
.PHONY: bump-fzf-make-version
bump-fzf-make-version: tool-bump-version
@read -p "🚀 Ready to bump fzf-make version and create a new release? (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'); \
make update-license-file; \
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
.PHONY: detect-unused-dependencies
detect-unused-dependencies: tool-detect-unused-dependencies
cargo machete
.PHONY: update-license-file
update-license-file: tool-update-license-file
cargo about generate --locked --fail about.hbs > CREDITS.md
@# Normalize consecutive blank lines to avoid CI/local environment differences
perl -i -0pe 's/\n\n\n+/\n\n/g' CREDITS.md
.PHONY: check-licenses
check-licenses: tool-check-licenses
cargo deny check licenses
DEBUG_EXECUTABLE = ./target/debug/fzf-make
TEST_DIR = ./test_data
.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 +nightly fmt
.PHONY: fmt-check
fmt-check:
@cargo +nightly fmt -- --check
.PHONY: check
check:
@cargo clippy -- -D warnings
.PHONY: check-fix
check-fix:
@cargo clippy --fix -- -D warnings
.PHONY: build-release
build-release:
@cargo build --verbose --release
# For reproducing a performance issue with syntect's Makefile grammar.
# https://github.com/kyu08/fzf-make/issues/595
.PHONY: repro-syntect-highlight-hang
repro-syntect-highlight-hang:
$(eval RESOLVED_TARGETS := $(shell bash resolve.sh $(DEPENDENCY_SERVICES)))
docker compose rm -fsv $(RESOLVED_TARGETS)