-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
109 lines (83 loc) · 2.48 KB
/
Makefile
File metadata and controls
109 lines (83 loc) · 2.48 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
CONFIGURATION=Debug
ROOT_DIR=${PWD}
OUTPUT_DIR=${PWD}/.output
OUTPUT_DIR_APP=$(OUTPUT_DIR)/app
OUTPUT_DIR_DB=$(OUTPUT_DIR)/db
OUTPUT_DIR_MANIFESTS=$(OUTPUT_DIR)/manifests
OUTPUT_DIR_TESTRESULTS=$(OUTPUT_DIR)/testresults
APP_PROJECT=SelfService/SelfService.csproj
APP_IMAGE_NAME=selfservice-api/app
DB_IMAGE_NAME=selfservice-api/dbmigrations
BUILD_NUMBER?=n/a
init: clean restore build tests
clean:
@-rm -Rf $(OUTPUT_DIR)
@mkdir $(OUTPUT_DIR)
@mkdir $(OUTPUT_DIR_APP)
@mkdir $(OUTPUT_DIR_DB)
@mkdir $(OUTPUT_DIR_MANIFESTS)
@mkdir $(OUTPUT_DIR_TESTRESULTS)
@cd src && dotnet clean \
--configuration $(CONFIGURATION) \
--nologo \
-v q \
$(APP_PROJECT)
restore:
@cd src && dotnet restore
build:
@cd src && dotnet build \
--configuration $(CONFIGURATION) \
--no-restore \
--nologo \
-v q
unittest: unittests
unittests:
@cd src && dotnet test \
--configuration $(CONFIGURATION) \
--no-restore \
--no-build \
--logger "trx;LogFileName=testresults.trx" \
--filter Category!=Integration \
--collect "XPlat Code Coverage" \
--nologo \
-v normal
integrationtest: integrationtests
integrationtests: build
@cd integrationtest && bash ./run.sh $(CONFIGURATION) $(OUTPUT_DIR_TESTRESULTS)
test: tests
tests : build unittests integrationtests
publish:
@cd src && dotnet publish \
--configuration $(CONFIGURATION) \
--output $(OUTPUT_DIR_APP) \
--no-build \
--no-restore \
--nologo \
-v q \
$(APP_PROJECT)
appcontainer:
@docker build -t ${APP_IMAGE_NAME} .
migrationcontainer:
@docker build -t ${DB_IMAGE_NAME} ./db
containers: appcontainer migrationcontainer
ci: clean restore build test publish containers
manifests:
@for m in k8s/*.yml; do envsubst <$$m >$(OUTPUT_DIR_MANIFESTS)/$$(basename $$m); done
deliver:
@sh ./tools/push-container.sh "$(APP_IMAGE_NAME)" "${BUILD_NUMBER}"
@sh ./tools/push-container.sh "$(DB_IMAGE_NAME)" "${BUILD_NUMBER}"
cd: ci manifests deliver
dev:
@cd src && dotnet watch --project $(APP_PROJECT) run -- --configuration $(CONFIGURATION)
run:
@cd src && dotnet run --configuration $(CONFIGURATION) --project $(APP_PROJECT)
newmigration:
@read -p "Enter name of migration (e.g. add-table-for-xxx):" REPLY; \
echo "-- $(shell date +'%4Y-%m-%d %H:%M:%S') : $$REPLY" > db/migrations/$(shell date +'%4Y%m%d%H%M%S')_$$REPLY.sql
nm: newmigration
clean-restore-build: clean restore build
docker-build-push: publish containers deliver
setup-pre-commit-hook:
@sh ./setup-pre-commit-hook.sh
pre-commit-hook:
@sh ./.git/hooks/pre-commit