forked from KKGo-Software-engineering/workshop-summer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
60 lines (50 loc) · 1.55 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
.PHONY: setup-pre-commit
setup-pre-commit:
@echo "Setting up pre-commit..."
./scripts/setup-pre-commit.sh
.PHONY: test
test:
@echo "Running tests..."
go test -v ./...
.PHONY: test-it
test-it:
@echo "Running integration tests..."
go test -v -run "Test.*IT" -tags=integration ./...
.PHONY: test-cover
test-cover:
@echo "Running tests with coverage..."
go test -v ./... -coverprofile=coverage.out ./...
@echo "Open Html report"
go tool cover -html=coverage.out
.PHONY: test-it-docker
test-it-docker:
docker-compose -f docker-compose.it.test.yaml down && \
docker-compose -f docker-compose.it.test.yaml up --build --force-recreate --abort-on-container-exit --exit-code-from it_tests
.PHONY: new-migration
new-migration:
@echo $(name) | grep -E '^[0-9]{2}_[a-z_]+$' > /dev/null || (echo "Invalid name format. Should be 0X_name_with_underscore" && exit 1)
@echo "Creating a new migration $(name)..."
@cp ./migration/00_example.sql.template ./migration/$(name).sql
.PHONY: upload
upload:
@echo "Uploading images..."
curl -X POST http://localhost:8080/api/v1/upload \
-H "Content-Type: multipart/form-data" \
-F "[email protected]" \
-F "[email protected]"
.PHONY: run
run:
@echo "Running the server..."
go run main.go
.PHONY: slow
slow:
@echo "Running the server with slow response..."
curl http://localhost:8080/api/v1/slow
.PHONY: health
health:
@echo "Checking the health of the server..."
curl http://localhost:8080/api/v1/health
.PHONY: spenders
spenders:
@echo "Getting the spenders..."
curl -u user:secret http://localhost:8080/api/v1/spenders