Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
55 lines (41 loc) · 1.42 KB
/
Copy pathjustfile
File metadata and controls
55 lines (41 loc) · 1.42 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
# Run the development server with hot reload
dev:
#!/bin/sh
export GCP_PROJECT_ID=forex-api-daily
export SERVER_ADDRESS=127.0.0.1:8000
export FIRESTORE_EMULATOR_HOST="127.0.0.1:8080"
~/go/bin/reflex -r '\.go' -s -- sh -c "go run ."
# Start the Firestore emulator manually
start-db:
gcloud emulators firestore start
# Run unit tests only (no emulator needed)
test:
go test ./... -v -short
# Run unit tests with coverage report
test-cover:
go test ./... -cover -short
# Run unit tests with coverage and open HTML report
test-cover-html:
go test ./... -coverprofile=coverage.out -short && go tool cover -html=coverage.out
# Run integration tests with Firestore emulator (auto-starts and cleans up)
test-integration:
pnpm test
# Run all tests including integration tests with Firestore emulator
test-all:
pnpm run test:all
# Generate OpenAPI documentation from swagger annotations
generate-docs:
swag init -g main.go --parseDependency --parseInternal
# Build the Docker image
build:
docker build -t forex-api .
# Run the Docker container
run:
#!/bin/sh
export PORT=8000
docker stop forex-api || true
docker rm forex-api || true
docker run -dp $PORT:$PORT --name forex-api -e FIRESTORE_EMULATOR_HOST=host.docker.internal:8080 \
-e GCP_PROJECT_ID=forex-api-daily -e SERVER_ADDRESS=0.0.0.0:$PORT forex-api
# Build and run the Docker container
build-run: build run