forked from spiceai/spiceai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
186 lines (148 loc) · 5.57 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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
################################################################################
# Target: all #
################################################################################
.PHONY: all
all: build
.PHONY: build-cli
build-cli:
make -C bin/spice
.PHONY: build-cli-dev
build-cli-dev:
export DEV=true; make -C bin/spice
.PHONY: build-runtime
build-runtime:
make -C bin/spiced
.PHONY: build
build: build-cli build-runtime
.PHONY: build-dev
build-dev:
export DEV=true; make -C bin/spice
export DEV=true; make -C bin/spiced
.PHONY: ci
ci:
make -C bin/spice
make -C bin/spiced
.PHONY: test
test:
@cargo test --all --lib
.PHONY: nextest
nextest:
@cargo nextest run --all
# Also update .github/workflows/integration.yml with changes to this target
.PHONY: test-integration
test-integration:
# Test if .env file exists, and login to Spice if not
@test -f .env || (`spice login`)
@cargo test -p runtime --test integration --features postgres,mysql,delta_lake,duckdb,sqlite -- --nocapture
.PHONY: test-integration-without-spiceai-dataset
test-integration-without-spiceai-dataset:
@cargo test -p runtime --test integration --features postgres,mysql,delta_lake,duckdb,sqlite -- --nocapture --skip spiceai_integration_test
.PHONY: test-bench
test-bench:
@cargo bench -p runtime --features postgres,spark,mysql
.PHONY: lint lint-go lint-rust
lint: lint-go lint-rust
lint-rust:
cargo fmt --all -- --check
cargo clippy --all-targets --all-features --workspace -- \
-Dwarnings \
-Dclippy::pedantic \
-Dclippy::unwrap_used \
-Dclippy::expect_used \
-Dclippy::clone_on_ref_ptr \
-Aclippy::module_name_repetitions
lint-go:
go vet ./...
golangci-lint run
.PHONY: fmt-toml
fmt-toml:
taplo fmt
.PHONY: run
run:
~/.spice/bin/spiced
.PHONY: docker
docker:
docker buildx build -t spiceai-rust:local-dev .
.PHONY: docker-run
docker-run:
docker stop spiceai && docker rm spiceai || true
docker run --name spiceai -p 8090:8090 -p 50051:50051 spiceai-rust:local-dev
.PHONY: deps-licenses
dep-licenses:
@cargo install cargo-license --quiet
@cargo license -d
.PHONY: display-deps
display-deps:
@cargo install cargo-license --quiet
@cargo license -d --tsv --direct-deps-only --all-features | grep -v "github.com/spiceai"
################################################################################
# Target: install #
################################################################################
.PHONY: install
install: build
mkdir -p ~/.spice/bin
install -m 755 target/release/spice ~/.spice/bin/spice
install -m 755 target/release/spiced ~/.spice/bin/spiced
.PHONY: install-with-models
install-with-models:
make install SPICED_NON_DEFAULT_FEATURES="models"
.PHONY: install-with-odbc
install-with-odbc:
make install SPICED_NON_DEFAULT_FEATURES="odbc"
.PHONY: install-cli
install-cli: build-cli
mkdir -p ~/.spice/bin
install -m 755 target/release/spice ~/.spice/bin/spice
.PHONY: install-runtime
install-runtime: build-runtime
mkdir -p ~/.spice/bin
install -m 755 target/release/spiced ~/.spice/bin/spiced
################################################################################
# Target: install-dev #
################################################################################
.PHONY: install-dev
install-dev: build-dev
mkdir -p ~/.spice/bin
install -m 755 target/release/spice ~/.spice/bin/spice
install -m 755 target/debug/spiced ~/.spice/bin/spiced
.PHONY: install-cli-dev
install-cli-dev: build-cli-dev
mkdir -p ~/.spice/bin
install -m 755 target/release/spice ~/.spice/bin/spice
################################################################################
# Target: modtidy #
################################################################################
.PHONY: modtidy
modtidy:
go mod tidy
################################################################################
# Target: generate-acknowledgements #
################################################################################
ACKNOWLEDGEMENTS_PATH := acknowledgements.md
.PHONY: generate-acknowledgements
generate-acknowledgements:
echo "# Open Source Acknowledgements\n\nSpice.ai acknowledges the following open source projects for making this project possible:\n\n" > $(ACKNOWLEDGEMENTS_PATH)
make generate-acknowledgements-go
make generate-acknowledgements-rust
make generate-acknowledgements-formatting
.PHONY: generate-acknowledgements-go
generate-acknowledgements-go:
echo "\n## Go Modules\n" >> $(ACKNOWLEDGEMENTS_PATH)
go get github.com/google/go-licenses
go install github.com/google/go-licenses
cd bin/spice && go-licenses report --ignore github.com/spiceai/spiceai . 2>/dev/null >> ../../$(ACKNOWLEDGEMENTS_PATH) && cd ../../
.PHONY: generate-acknowledgements-rust
generate-acknowledgements-rust:
@echo "\n## Rust Crates\n" >> "$(ACKNOWLEDGEMENTS_PATH)"
@make display-deps 2>/dev/null | awk -F'\t' 'NR>1 {printf "- %s %s, %s %s\n <br/>%s\n\n", $$1, $$2, $$5, $$6, $$4}' >> "$(ACKNOWLEDGEMENTS_PATH)"
.PHONY: generate-acknowledgements-formatting
generate-acknowledgements-formatting:
@if [[ "$(UNAME)" -eq "Darwin" ]]; then\
sed -i '' 's/\"//g' $(ACKNOWLEDGEMENTS_PATH); \
sed -i '' 's/,/, /g' $(ACKNOWLEDGEMENTS_PATH); \
sed -i '' 's/, /, /g' $(ACKNOWLEDGEMENTS_PATH); \
else\
sed -i 's/\"//g' $(ACKNOWLEDGEMENTS_PATH); \
sed -i 's/,/, /g' $(ACKNOWLEDGEMENTS_PATH); \
sed -i 's/, /, /g' $(ACKNOWLEDGEMENTS_PATH); \
fi