-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
224 lines (164 loc) · 8.6 KB
/
Makefile
File metadata and controls
224 lines (164 loc) · 8.6 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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
config ?= Debug
flags ?=
comma := ,
flags_tokens := $(subst $(comma), ,$(flags))
use_local_fscript := $(filter fscript,$(flags_tokens))
dotnet_props := $(if $(use_local_fscript),/p:UseLocalFScript=true,)
terrabuild ?= dotnet run --project $(ROOT_DIR)src/Terrabuild -c $(config) $(dotnet_props) --
refresh ?= false
version ?= 0.0.0
engine ?= docker
dryrun ?= false
current_dir = $(shell pwd)
.PHONY: docs try-docs website website-build website-prepare
#
# _______ ___________ ____
# | \ | ____\ \ / /
# | .--. || |__ \ \/ /
# | | | || __| \ /
# | '--' || |____ \ /
# |_______/ |_______| \__/
#
build: webui
dotnet build -c $(config) $(dotnet_props) terrabuild.slnx
webui:
cd src/Terrabuild.UI && pnpm install --force
cd src/Terrabuild.UI && pnpm build
test:
dotnet test -c $(config) $(dotnet_props) terrabuild.slnx
clean:
-rm terrabuild-debug.*
-rm -rf $(PWD)/.out
upgrade:
dotnet restore $(dotnet_props) --force-evaluate
usage:
$(terrabuild) --help
$(terrabuild) run --help
$(terrabuild) clear --help
$(terrabuild) login --help
#
# .______ _______ __ _______ ___ _______. _______
# | _ \ | ____|| | | ____| / \ / || ____|
# | |_) | | |__ | | | |__ / ^ \ | (----`| |__
# | / | __| | | | __| / /_\ \ \ \ | __|
# | |\ \----.| |____ | `----.| |____ / _____ \ .----) | | |____
# | _| `._____||_______||_______||_______/__/ \__\ |_______/ |_______|
#
publish: webui
dotnet publish -c $(config) $(dotnet_props) -p:Version=$(version) -o $(PWD)/.out/dotnet src/Terrabuild
dotnet pack -c $(config) $(dotnet_props) -p:Version=$(version) -o .out
publish-darwin: webui
dotnet publish -c $(config) $(dotnet_props) -r osx-x64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -p:IncludeNativeLibrariesForSelfExtract=true -o $(PWD)/.out/darwin/x64 src/Terrabuild
dotnet publish -c $(config) $(dotnet_props) -r osx-arm64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -p:IncludeNativeLibrariesForSelfExtract=true -o $(PWD)/.out/darwin/arm64 src/Terrabuild
publish-linux: webui
dotnet publish -c $(config) $(dotnet_props) -r linux-x64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -p:IncludeNativeLibrariesForSelfExtract=true -o $(PWD)/.out/linux/x64 src/Terrabuild
dotnet publish -c $(config) $(dotnet_props) -r linux-arm64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -p:IncludeNativeLibrariesForSelfExtract=true -o $(PWD)/.out/linux/arm64 src/Terrabuild
publish-windows: webui
dotnet publish -c $(config) $(dotnet_props) -r win-x64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -p:IncludeNativeLibrariesForSelfExtract=true -o $(PWD)/.out/windows/x64 src/Terrabuild
dotnet publish -c $(config) $(dotnet_props) -r win-arm64 -p:PublishSingleFile=true --self-contained -p:Version=$(version) -p:IncludeNativeLibrariesForSelfExtract=true -o $(PWD)/.out/windows/arm64 src/Terrabuild
publish-all: clean publish publish-darwin publish-linux publish-windows
docs:
dotnet run --project tools/DocGen /p:GenerateDocumentationFile=true $(dotnet_props) -- website/site-docs/extensions --write
cd website && node ./scripts/normalize-extension-docs.mjs
try-docs:
dotnet run --project tools/DocGen /p:GenerateDocumentationFile=true $(dotnet_props) -- .out/try-docs
website-prepare:
cd website && pnpm install --frozen-lockfile
$(MAKE) docs
website: website-prepare
cd website && pnpm start
website-build: website-prepare
@if [ "$(version)" != "0.0.0" ] && echo "$(version)" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$$'; then \
cd website && pnpm docs:version "$(version)" && TERRABUILD_DOCS_LAST_VERSION="$(version)" pnpm build; \
else \
cd website && pnpm build; \
fi
self: clean publish
$(PWD)/.out/dotnet/terrabuild run build test dist --configuration $(config) --retry --debug --log --local-only
self-ci: clean publish
$(PWD)/.out/dotnet/terrabuild run build test dist --configuration $(config) --engine $(engine) --retry --debug --log --local-only
self-logs:
$(PWD)/.out/dotnet/terrabuild logs build test dist --configuration $(config) --debug --log --local-only
logs:
$(terrabuild) logs build test dist --configuration $(config) --debug --log --local-only
terrabuild:
terrabuild run build test dist --configuration $(config) --retry --debug --log --local-only
#
# .___________. _______ _______.___________. _______.
# | || ____| / | | / |
# `---| |----`| |__ | (----`---| |----` | (----`
# | | | __| \ \ | | \ \
# | | | |____.----) | | | .----) |
# |__| |_______|_______/ |__| |_______/
#
ui: webui
$(terrabuild) console --no-open --port 5179
test-scaffold:
$(terrabuild) scaffold --workspace tests/scaffold --debug --log
test-rescaffold:
$(terrabuild) scaffold --workspace tests/scaffold --debug --force --log
test-build-scaffold:
$(terrabuild) run build --workspace tests/scaffold --debug --retry --log
test-build-simple:
$(terrabuild) run build --workspace tests/simple --debug --retry --log --variable secret_message=tralala
test-rebuild-simple:
$(terrabuild) run build --workspace tests/simple --debug --retry --log
test-deploy-simple:
$(terrabuild) run deploy --workspace tests/simple --debug --retry --log
test-build-playground:
$(terrabuild) run build --workspace ../playground --retry --debug
test-dist-playground:
$(terrabuild) run dist --workspace ../playground --retry --debug
test-deploy-playground:
$(terrabuild) run deploy --workspace ../playground --retry --debug
test-circular:
$(terrabuild) run build --workspace tests/circular --debug --log
test-cluster-layers:
$(terrabuild) run build -w tests/cluster-layers --debug --force
test-invalid-args:
$(terrabuild) run build -w tests/cluster-layers --force --qewdiqoudhqioeudhqi
test-build-basic:
$(terrabuild) run build -w tests/basic --force --debug --log
# _______..___ ___. ______ __ ___ _______ .___________. _______ _______.___________. _______.
# / || \/ | / __ \ | |/ / | ____| | || ____| / | | / |
# | (----`| \ / | | | | | | ' / | |__ `---| |----`| |__ | (----`---| |----` | (----`
# \ \ | |\/| | | | | | | < | __| | | | __| \ \ | | \ \
# .----) | | | | | | `--' | | . \ | |____ | | | |____.----) | | | .----) |
# |_______/ |__| |__| \______/ |__|\__\ |_______| |__| |_______|_______/ |__| |_______/
define diff_file
@if [ "$(refresh)" = "true" ]; then \
cp $(1)/$(2) $(1)/results/$(2); \
fi
diff $(1)/results/$(2) $(1)/$(2)
endef
define diff_results
$(call diff_file,$(1),terrabuild-debug.config.json)
$(call diff_file,$(1),terrabuild-debug.node.json)
$(call diff_file,$(1),terrabuild-debug.action.json)
$(call diff_file,$(1),terrabuild-debug.batch.json)
$(call diff_file,$(1),terrabuild-debug.cascade.json)
$(call diff_file,$(1),terrabuild-debug.info.md)
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
smoke-test-basic:
$(call run_integration_test, tests/basic, run build --environment dev --force --debug --parallel 2 --log --engine docker --local-only)
smoke-test-cluster-layers:
$(call run_integration_test, tests/cluster-layers, run build --force --debug --parallel 2 --log --engine docker --local-only)
smoke-test-multirefs:
$(call run_integration_test, tests/multirefs, run build --force --debug --parallel 2 --log --engine docker --local-only)
smoke-test-simple:
$(call run_integration_test, tests/simple, run build test --force --debug --parallel 2 --log --engine docker --local-only)
smoke-indirect-target:
$(call run_integration_test, tests/indirect-target, run build test plan apply --force --debug --parallel 1 --log --engine docker --local-only)
smoke-test-dotnet-cache:
dotnet test -c $(config) $(dotnet_props) src/Terrabuild.Tests/Terrabuild.Tests.fsproj --filter "TestCategory=integration"
smoke-tests: smoke-test-basic smoke-test-cluster-layers smoke-test-multirefs smoke-test-simple smoke-indirect-target smoke-test-dotnet-cache
release-prepare:
./.github/scripts/release.sh "$(version)" "$(dryrun)"