-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (52 loc) · 2.51 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
61
62
63
64
65
.PHONY: infra-up infra-down webservice cleanup logs run-tests lint
infra-up:
docker-compose -f docker-compose.local.yml up -d neo4j
docker-compose -f docker-compose.local.yml up -d migrate
infra-down:
docker-compose -f docker-compose.local.yml down neo4j --remove-orphans
docker-compose -f docker-compose.local.yml down migrate --remove-orphans
webservice: infra-up
docker-compose -f docker-compose.local.yml up -d webservice --build -d --force-recreate
cleanup:
docker-compose -f docker-compose.local.yml down --remove-orphans
logs:
docker-compose -f docker-compose.local.yml logs
exit 1
run-test:
go test -count=1 -cover -v ./...
t-with-reports:
go test "./..." -coverprofile="./files/coverage.out" -covermode=count -json > ./files/report.json
#go test "./..." -coverpkg="github.com/Projects-for-Fun/thefoodbook/internal/handlers/webservice" -coverprofile="./files/coverage.out" -covermode=count -json > ./files/report.json
it-with-reports:
export RUN_INTEGRATION_TESTS=1
export ENVIRONMENT=it-pipeline
export SERVICE_NAME=thefoodbook
export SERVICE_PORT=3000
export LOG_LEVEL=info
export LOG_FORMAT=console
export DB_URI=neo4j://neo4j:11223344@neo4j:7687
export DB_USER=neo4j
export DB_PASS=11223344
export JWT_KEY=my_random_secret_key_for_testing
#cd ./test/integrationtests && go test -v "./..." -coverprofile="../../files/coverage.out" -covermode=count -json >> ../../files/report.json
#go test -v "./test/integrationtests/..." -covermode=count -json >> ./files/report.json
go test -v "./..." -coverprofile="./files/coverage.out" -covermode=count -json >> ./files/report.json
create-integration-tests:
docker-compose -f docker-compose.local.yml up --build -d neo4j --force-recreate
docker-compose -f docker-compose.local.yml up --build -d migrate --force-recreate
docker-compose -f docker-compose.local.yml up integration_tests --build --abort-on-container-exit --exit-code-from=integration_tests --force-recreate
run-integration: create-integration-tests cleanup
golangci-file:
curl https://raw.githubusercontent.com/Projects-for-Fun/golangci/main/.golangci.yml --output ./.golangci.yml
lint-docker:
$(eval OUTPUT_OPTIONS = $(shell [ "${EXPORT_RESULT}" == "true" ] && echo "--out-format checkstyle ./... | tee /dev/tty > checkstyle-report.xml" || echo "" ))
docker run \
-it \
--rm \
-v ~/go:/root/go \
-v golangci-lint-cache:/root/.cache \
-v $(shell pwd):/app \
-w /app \
golangci/golangci-lint:latest golangci-lint run --deadline=65s $(OUTPUT_OPTIONS) -v
-c ./.golangci.yml
lint: golangci-file lint-docker