-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathMakefile
More file actions
137 lines (108 loc) · 3.38 KB
/
Makefile
File metadata and controls
137 lines (108 loc) · 3.38 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
# Common makefile helpers
include build/make/common.mk
.DEFAULT_GOAL := build
SHELL = /bin/bash
# Local variables
SCREENSHOT_SAMPLE = cafe.log
# Exported variables
export RUST_BACKTRACE=1
# The list of files that are intentionally ignored while being tracked
ignored-tracked-files = .vscode/settings.json
## Build debug target
.PHONY: build
build: contrib-build
@cargo build --benches
## Run continuous integration tests
.PHONY: ci
ci: check-fmt check-schema test build
@cargo run -- --version
## Run code formatting tests
.PHONY: check-fmt
check-fmt: contrib-build-nightly
@cargo +nightly fmt --all -- --check
## Run schema validation tests
.PHONY: check-schema
check-schema: contrib-schema .venv build/ci/validate_yaml.py
@tombi lint
@taplo check
@taplo check --no-auto-config --schema "file://${PWD}/schema/json/theme.schema.json" src/testing/assets/themes/test.toml
@.venv/bin/python build/ci/validate_yaml.py ./schema/json/config.schema.json etc/defaults/config{,-ecs,-k8s}.yaml
## Automatically format code
.PHONY: fmt
fmt: contrib-build-nightly
@cargo +nightly fmt --all
## Build release target
.PHONY: build-release
build-release: contrib-build
@cargo build --release --locked
## Install binary and man pages
.PHONY: install
install: contrib-build install-man-pages
@cargo install --path . --locked
## Install man pages
.PHONY: install-man-pages
install-man-pages: ~/share/man/man1/hl.1
@echo $$(tput setaf 3)NOTE:$$(tput sgr0) ensure $$(tput setaf 2)~/share/man$$(tput sgr0) is added to $$(tput setaf 2)MANPATH$$(tput sgr0) environment variable
~/share/man/man1/hl.1: contrib-build | ~/share/man/man1
cargo run --release --locked -- --config - --man-page >"$@"
~/share/man/man1:
@mkdir -p "$@"
## Install versioned binary
.PHONY: install-versioned
install-versioned: contrib-build
@cargo install --path . --locked
@cp ${HOME}/.cargo/bin/hl ${HOME}/.cargo/bin/$$(${HOME}/.cargo/bin/hl --version | tr ' ' '-')
## Run tests
.PHONY: test
test: contrib-build
@cargo test --workspace
## Run benchmarks
.PHONY: bench
bench: contrib-build
@cargo bench --workspace --locked
## Show usage of the binary
.PHONY: usage
usage: build
@./target/debug/hl --config - --help
## Clean build artifacts
.PHONY: clean
clean: contrib-build
@cargo clean
## Create screenshots
.PHONY: screenshots
screenshots: build
@$(SHELL) contrib/bin/screenshot.sh light $(SCREENSHOT_SAMPLE)
@$(SHELL) contrib/bin/screenshot.sh dark $(SCREENSHOT_SAMPLE)
## Collect coverage
.PHONY: coverage
coverage: contrib-coverage
@$(SHELL) contrib/bin/setup.sh coverage
@$(SHELL) build/ci/coverage.sh
## Skip ignored tracked files
.PHONY: skip-ignored
skip-ignored:
@git update-index --skip-worktree $(ignored-tracked-files)
## Undo skip-ignored
.PHONY: no-skip-ignored
no-skip-ignored:
@git update-index --no-skip-worktree $(ignored-tracked-files)
.PHONY: contrib-build
contrib-build:
@$(SHELL) contrib/bin/setup.sh build
.PHONY: contrib-build-nightly
contrib-build-nightly:
@$(SHELL) contrib/bin/setup.sh build-nightly
.PHONY: contrib-coverage
contrib-coverage:
@$(SHELL) contrib/bin/setup.sh coverage
.PHONY: contrib-schema
contrib-schema:
@$(SHELL) contrib/bin/setup.sh schema
.PHONY: contrib-screenshots
contrib-screenshots:
@$(SHELL) contrib/bin/setup.sh screenshots
.venv: $(MAKEFILE_LIST) requirements.txt
@test -d $@ || $(SHELL) python3 -m venv $@
@$@/bin/pip install --upgrade pip
@$@/bin/pip install -r requirements.txt
@touch $@