-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
37 lines (30 loc) · 1.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
.PHONY: test cleanup
# The names of the required environment variables
REQUIRED_ENV_VARS := HH_API_KEY HH_DATASET HH_PROJECT OPENAI_API_KEY SERP_API_KEY COHERE_API_KEY HH_PROJECT_ID
# Function to check whether an environment variable is set
env_var_check = $(if $(value $(1)),,$(error $(1) is not set. Please set $(1)))
# The test target
test:
@$(foreach var,$(REQUIRED_ENV_VARS),$(call env_var_check,$(var)))
@docker build -f tests/Dockerfile . -t my-test
@docker run \
-e HH_API_KEY=$$HH_API_KEY \
-e HH_API_URL=$$HH_API_URL \
-e HH_PROJECT="$$HH_PROJECT" \
-e HH_PROJECT_ID="$$HH_PROJECT_ID" \
-e HH_DATASET="$$HH_DATASET" \
-e SERP_API_KEY=$$SERP_API_KEY \
-e OPENAI_API_KEY=$$OPENAI_API_KEY \
-e COHERE_API_KEY=$$COHERE_API_KEY \
my-test
# Start the services needed before running the tests
start_services:
@bash ./tests/standalone_embed.sh start
# Cleanup after tests
cleanup: stop_services delete_services
# Stop the services
stop_services:
@bash ./tests/standalone_embed.sh stop
# Delete the services
delete_services:
@bash ./tests/standalone_embed.sh delete