-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
154 lines (121 loc) · 4.18 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
.PHONY: purge clean default install uninstall setup test
.DEFAULT_GOAL := default
ARTIFACTS := $(shell pwd)/artifacts
BUILD := $(shell pwd)/.build
TEMP := $(shell pwd)/.tmp
CONFIGURATION := Release
WEBTTY_CLIENT := src/WebTty.Hosting/Client
CLI_PROJECT := src/webtty/webtty.csproj
CLI_TOOL := webtty
RUNTIME := linux-x64
IS_PACKAGING := False
purge:
rm -rf $(BUILD)
rm -rf $(ARTIFACTS)
rm -rf $(TEMP)
clean:
rm -rf $(ARTIFACTS)
dotnet clean
restore:
dotnet restore
dotnet tool restore
setup: restore schema
dotnet build -c $(CONFIGURATION)
default:
$(MAKE) package
package: restore
dotnet restore --force-evaluate
dotnet build -c $(CONFIGURATION) /property:IsPackaging=True $(CLI_PROJECT)
@echo ""
@echo "\033[0;32mPackaging nuget \033[0m"
@echo "\033[0;32m------------------- \033[0m"
dotnet pack $(CLI_PROJECT) --configuration $(CONFIGURATION) \
--no-build \
--output $(ARTIFACTS) \
--include-symbols
package-all: package
@echo ""
@echo "\033[0;32mPackaging osx-x64 \033[0m"
@echo "\033[0;32m----------------- \033[0m"
$(MAKE) package-native RUNTIME=osx-x64
@echo ""
@echo "\033[0;32mPackaging linux-x64 \033[0m"
@echo "\033[0;32m------------------- \033[0m"
$(MAKE) package-native RUNTIME=linux-x64
@echo ""
@echo "\033[0;32mPackaging linux-musl-x64 \033[0m"
@echo "\033[0;32m------------------- \033[0m"
$(MAKE) package-native RUNTIME=linux-musl-x64
@echo ""
@echo "\033[0;32mPackaging win-x64 \033[0m"
@echo "\033[0;32m----------------- \033[0m"
dotnet publish $(CLI_PROJECT) -c $(CONFIGURATION) \
--output $(BUILD)/publish/win-x64 \
--runtime win-x64 \
/property:IsPackaging=True \
/property:PublishTrimmed=true \
/property:PublishSingleFile=true
@mkdir -p $(ARTIFACTS)
@cp $(BUILD)/publish/win-x64/$(CLI_TOOL).exe $(ARTIFACTS)/$(CLI_TOOL).win-x64.exe
@echo ""
@echo "\033[0;32mGenerate Checksums \033[0m"
@echo "\033[0;32m----------------- \033[0m"
$(MAKE) checksum
@echo ""
@echo "\033[0;32mOutput \033[0m"
@echo "\033[0;32m----------------- \033[0m"
@ls -lh $(ARTIFACTS)
package-native:
dotnet publish $(CLI_PROJECT) -c $(CONFIGURATION) \
--output $(BUILD)/publish/$(RUNTIME) \
--runtime $(RUNTIME) \
/property:IsPackaging=True \
/property:PublishTrimmed=true \
/property:PublishSingleFile=true
@mkdir -p $(ARTIFACTS)
@cp $(BUILD)/publish/$(RUNTIME)/$(CLI_TOOL) $(ARTIFACTS)/$(CLI_TOOL).$(RUNTIME)
install:
dotnet tool install --global --add-source $(ARTIFACTS) \
--version $$(dotnet minver -t v -a minor -v e) \
$(CLI_TOOL)
uninstall:
dotnet tool uninstall --global $(CLI_TOOL)
update: uninstall install
webtty --version
lint: types
yarn --cwd $(WEBTTY_CLIENT) lint
types:
yarn --cwd $(WEBTTY_CLIENT) tsc --noEmit
test:
yarn --cwd $(WEBTTY_CLIENT) test --coverage --coverageDirectory $(TEMP)/webtty.hosting/client
dotnet test test/WebTty.Test/WebTty.Test.csproj -c Release \
/property:CollectCoverage=true \
/property:CoverletOutputFormat=lcov \
/property:CoverletOutput=$(TEMP)/webtty.test/lcov.info
dotnet test test/WebTty.Api.Test/WebTty.Api.Test.csproj -c Release \
/property:CollectCoverage=true \
/property:CoverletOutputFormat=lcov \
/property:CoverletOutput=$(TEMP)/webtty.api.test/lcov.info
dotnet test test/WebTty.Integration.Test/WebTty.Integration.Test.csproj -c Release \
/property:CollectCoverage=true \
/property:CoverletOutputFormat=lcov \
/property:CoverletOutput=$(TEMP)/webtty.integration.test/lcov.info
dev:
$(MAKE) -j2 dev-server dev-client --ignore-errors
dev-client:
yarn --cwd $(WEBTTY_CLIENT) watch
dev-server:
dotnet watch -p $(CLI_PROJECT) run -- --config $(shell pwd)/data/config.json
dev-docker:
$(MAKE) -j2 dev-server-docker dev-client --ignore-errors
dev-server-docker:
dotnet watch -p $(CLI_PROJECT) run -- --config $(shell pwd)/data/config.json -a any
schema:
dotnet build $(shell pwd)/src/WebTty.Schema/WebTty.Schema.csproj
dotnet run -p tools/jsonschema/jsonschema.csproj -- \
--assembly $(shell pwd)/.build/bin/WebTty.Schema/Debug/netstandard2.0/WebTty.Schema.dll \
--namespace WebTty.Schema \
--output $(shell pwd)/$(WEBTTY_CLIENT)/.tmp/messages
checksum:
@rm -f $(ARTIFACTS)/SHA256SUMS.txt
@cd $(ARTIFACTS) && find . -type f -print0 | xargs -0 sha256sum | tee SHA256SUMS.txt