-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
88 lines (78 loc) · 2.84 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
.PHONY: all
all: clean restore migrate build run
.PHONY: flyway
flyway:
@# This will download and extract the Flyway application.
# ----------
# Downloading and extracting Flyway - https://flywaydb.org/
wget -qO- https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/8.0.4/flyway-commandline-8.0.4-linux-x64.tar.gz | tar xvz
.PHONY: clean
clean:
@# This will clean the output (both the intermediate (obj) and final output (bin) folders) of the project.
# ----------
# Cleaning the output of the previous build.
dotnet clean TrappyKeepy.Api
dotnet clean TrappyKeepy.Data
dotnet clean TrappyKeepy.Domain
dotnet clean TrappyKeepy.Service
dotnet clean TrappyKeepy.Test
.PHONY: restore
restore:
@# This will restore the dependencies and tools of each project.
# ----------
# Restoring dependencies and tools.
dotnet restore TrappyKeepy.Api
dotnet restore TrappyKeepy.Data
dotnet restore TrappyKeepy.Domain
dotnet restore TrappyKeepy.Service
dotnet restore TrappyKeepy.Test
.PHONY: migrate
migrate:
@# This will migrate the database using [Flyway](https://flywaydb.org) based on the SQL migration scripts.
# ----------
# Migrating the database
./flyway-8.0.4/flyway -configFiles=flyway.conf migrate
.PHONY: dbscaffold
dbscaffold:
@# This will create or overwrite the database context class and model classes
@# based on the current database structure.
# ----------
# Scaffolding the database context and model classes
dotnet ef dbcontext scaffold Name=ConnectionStrings:TKDB_CONN_STRING --project TrappyKeepy.Api --context-namespace TrappyKeepy.Data --namespace TrappyKeepy.Domain.Models --data-annotations --schema tk --context KeepyDbContext --context-dir ../TrappyKeepy.Data/DataBridges --output-dir ../TrappyKeepy.Domain/Models --force Npgsql.EntityFrameworkCore.PostgreSQL
.PHONY: format
format:
@# This will format the code to match the .editorconfig file settings.
# ----------
# Applying code formatting
dotnet format TrappyKeepy.Api
dotnet format TrappyKeepy.Data
dotnet format TrappyKeepy.Domain
dotnet format TrappyKeepy.Service
dotnet format TrappyKeepy.Test
.PHONY: build
build:
@# This will build the TrappyKeepy.Api project.
# ----------
# Building the TrappyKeepy.Api project
dotnet build TrappyKeepy.Api
.PHONY: test
test:
@# This will execute unit tests, after making sure the development database is up to date with migrations.
# ----------
# Running unit tests.
make migrate
dotnet test --verbosity quiet /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
.PHONY: run
run:
@# This will run the TrappyKeepy.Api project.
# ----------
# Running the TrappyKeepy.Api project
dotnet run --project TrappyKeepy.Api
.PHONY: publish
publish:
@# This will compile the application.
# ----------
# Compiling the application for release.
make -C TrappyKeepy.Api publish
mkdir dist
mv TrappyKeepy.Api/TrappyKeepy.Api dist/