-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (41 loc) · 1.16 KB
/
Copy pathMakefile
File metadata and controls
52 lines (41 loc) · 1.16 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
.PHONY: docker-start docker-stop start gendoc test
.DEFAULT_GOAL := help
PROJECTNAME := $(shell basename "$(PWD)")
## setup: Initialize project
setup: copy-env docker-start mongo-restore
## docker-start: Start docker-compose
docker-start:
docker-compose up --build -d
## docker-stop: Stop docker-compose
docker-stop:
docker-compose down
## start: Start the application
start:
air
## copy-env: Copy environment file
copy-env:
cp .env.example .env
## gendoc: Generate docs api with swagger
gendoc:
swag init -g api/app.go
## test: Run tests coverage
test:
go test -race -v -cover -covermode=atomic ./...
## mongo-dump: Dump MongoDB data for testing
mongo-dump:
@echo "Dump MongoDB data for testing"
@bash seed/mongodb/dump.sh
@tar -czvf seed/mongodb/dump.tar.gz seed/mongodb/dump
@rm -r seed/mongodb/dump
## mongo-restore: Restore MongoDB data for testing
mongo-restore:
@tar -xzvf seed/mongodb/dump.tar.gz seed/mongodb/dump
@echo "Import MongoDB data for testing"
@bash seed/mongodb/restore.sh
@rm -r seed/mongodb/dump
help: Makefile
@echo
@echo " Choose a command run in "$(PROJECTNAME)":"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo