-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
170 lines (120 loc) · 6.09 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
config ?= default
env ?= default
terrabuild = $(current_dir)/.out/dotnet/terrabuild
version ?= 0.0.0
ifeq ($(config), default)
buildconfig = Debug
else
buildconfig = $(config)
endif
current_dir = $(shell pwd)
#
# _______ ___________ ____
# | \ | ____\ \ / /
# | .--. || |__ \ \/ /
# | | | || __| \ /
# | '--' || |____ \ /
# |_______/ |_______| \__/
#
build:
dotnet build -c $(buildconfig) terrabuild.sln
test:
dotnet test terrabuild.sln
parser:
dotnet build -c $(buildconfig) /p:DefineConstants="GENERATE_PARSER"
clean:
-rm terrabuild-debug.*
-rm -rf $(PWD)/.out
upgrade:
dotnet restore --force-evaluate
usage:
dotnet run --project src/Terrabuild -- --help
dotnet run --project src/Terrabuild -- run --help
dotnet run --project src/Terrabuild -- clear --help
dotnet run --project src/Terrabuild -- login --help
#
# .______ _______ __ _______ ___ _______. _______
# | _ \ | ____|| | | ____| / \ / || ____|
# | |_) | | |__ | | | |__ / ^ \ | (----`| |__
# | / | __| | | | __| / /_\ \ \ \ | __|
# | |\ \----.| |____ | `----.| |____ / _____ \ .----) | | |____
# | _| `._____||_______||_______||_______/__/ \__\ |_______/ |_______|
#
publish:
dotnet publish -c $(buildconfig) -p:Version=$(version) -o $(PWD)/.out/dotnet src/Terrabuild
publish-all: clean
dotnet publish -c $(buildconfig) -p:Version=$(version) -o $(PWD)/.out/dotnet src/Terrabuild
dotnet pack -c $(buildconfig) -p:Version=$(version) -o .out
dotnet publish -c $(buildconfig) -r win-x64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -o $(PWD)/.out/windows/x64 src/Terrabuild
dotnet publish -c $(buildconfig) -r win-arm64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -o $(PWD)/.out/windows/arm64 src/Terrabuild
dotnet publish -c $(buildconfig) -r osx-x64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -o $(PWD)/.out/darwin/x64 src/Terrabuild
dotnet publish -c $(buildconfig) -r osx-arm64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -o $(PWD)/.out/darwin/arm64 src/Terrabuild
dotnet publish -c $(buildconfig) -r linux-x64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -o $(PWD)/.out/linux/x64 src/Terrabuild
dotnet publish -c $(buildconfig) -r linux-arm64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -o $(PWD)/.out/linux/arm64 src/Terrabuild
docs:
dotnet build src/Terrabuild.Extensions -c $(buildconfig) /p:GenerateDocumentationFile=true
dotnet run --project tools/DocGen -- src/Terrabuild.Extensions/bin/$(buildconfig)/net9.0/Terrabuild.Extensions.xml ../../websites/terrabuild.io/content/docs/extensions
self: clean publish
$(terrabuild) run build test dist --configuration $(env) --retry --debug --logs --local-only
terrabuild:
terrabuild run build test dist --configuration $(env) --retry --debug --logs --local-only
#
# .___________. _______ _______.___________. _______.
# | || ____| / | | / |
# `---| |----`| |__ | (----`---| |----` | (----`
# | | | __| \ \ | | \ \
# | | | |____.----) | | | .----) |
# |__| |_______|_______/ |__| |_______/
#
run-build-circular:
dotnet run --project src/Terrabuild -- run build --workspace tests/circular --debug --logs
run-scaffold:
dotnet run --project src/Terrabuild -- scaffold --workspace tests/scaffold --debug --logs
run-rescaffold:
dotnet run --project src/Terrabuild -- scaffold --workspace tests/scaffold --debug --force --logs
run-build-scaffold:
dotnet run --project src/Terrabuild -- run build --workspace tests/scaffold --debug --retry --logs
run-build-simple:
dotnet run --project src/Terrabuild -- run build --workspace tests/simple --debug --retry --logs
run-rebuild-simple:
dotnet run --project src/Terrabuild -- run build --workspace tests/simple --debug --retry --logs
run-deploy-simple:
dotnet run --project src/Terrabuild -- run deploy --workspace tests/simple --debug --retry --logs
run-build-playground:
dotnet run --project src/Terrabuild -- run build --workspace ../playground --retry --debug
run-dist-playground:
dotnet run --project src/Terrabuild -- run dist --workspace ../playground --retry --debug
run-deploy-playground:
dotnet run --project src/Terrabuild -- run deploy --workspace ../playground --retry --debug
run-test-insights:
dotnet run --project src/Terrabuild -- run build test apply plan -w ../../insights --debug --force --local-only --whatif
run-test-terrabuild:
dotnet run --project src/Terrabuild -- run build test publish -w src --debug --force --local-only
run-test-cluster-layers:
dotnet run --project src/Terrabuild -- run build -w tests/cluster-layers --debug --force
run-test-simple:
dotnet run --project src/Terrabuild -- run build -w tests/simple --debug --force
define diff_file
# cp $(1)/$(2) $(1)/results/$(2)
diff $(1)/results/$(2) $(1)/$(2)
endef
define diff_results
$(call diff_file,$(1),terrabuild-debug.config.json)
$(call diff_file,$(1),terrabuild-debug.build-graph.json)
$(call diff_file,$(1),terrabuild-debug.build-graph.mermaid)
endef
define run_integration_test
@printf "\n*** Running integration test %s ***\n" $(1)
@$(terrabuild) version
-cd $(1); rm terrabuild-debug.*
cd $(1); GITHUB_SHA=1234 GITHUB_REF_NAME=main GITHUB_STEP_SUMMARY=terrabuild-debug.md GITHUB_REPOSITORY=magnusopera/terrabuild GITHUB_RUN_ID=42 $(terrabuild) $(2)
$(call diff_results,$(1))
endef
# $(call run_integration_test, tests/cluster-layers, run build --force --debug -p 2 --logs)
self-test-cluster-layers:
$(call run_integration_test, tests/cluster-layers, run build --force --debug -p 2 --logs --container-tool docker)
self-test-multirefs:
$(call run_integration_test, tests/multirefs, run build --force --debug -p 2 --logs --container-tool docker)
self-test-simple:
$(call run_integration_test, tests/simple, run build --force --debug -p 2 --logs --container-tool docker)
self-test-all: self-test-cluster-layers self-test-multirefs self-test-simple