-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (32 loc) · 1.4 KB
/
Makefile
File metadata and controls
38 lines (32 loc) · 1.4 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
build_image:
docker build -f ./shared/docker/api.Dockerfile -t slotify-api .
db_shell:
# After 'make run', this will give you a shell to the mariadb
docker exec -it mariadb-container mariadb -u root -prootpassword slotify
.PHONY: generate
generate:
# Generate sqlc files
docker run --rm -v $(shell pwd):/src -w /src sqlc/sqlc generate
# Generate server Go code based on openapi spec
# Generate mocks
go generate ./...
go mod tidy
lint:
# Run Golangci-lint for Go linting
docker run -t --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v1.64.5 golangci-lint run -v --fix ./...
run:
# First docker compose down, some data can be persisted in the db
docker compose -f ./shared/docker/compose.local.yml down || true
# Docker compose up- start up API and DB in containers
go generate ./... && go mod tidy && docker compose -f ./shared/docker/compose.local.yml up --build
stop:
# Docker compose down- stop API and DB containers
docker compose -f ./shared/docker/compose.local.yml down
test:
# First docker compose down, some data can be persisted in the db which can
# cause test fails
# Docker compose up- start DB and run API tests
# Also shuts down after tests are finished (--abort-on-container-exit)
docker compose -f ./shared/docker/compose.test.yml down || true
go generate ./... && go mod tidy
docker compose -f ./shared/docker/compose.test.yml up --build --abort-on-container-exit || exit 1