-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
139 lines (109 loc) · 4.08 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
# This Makefile was authored on macOS and is unlikely to work on other operating
# systems. While the binaries this Makefile produces are highly portable, the
# development of these binaries is not generally portable.
VERSION = $(shell cat version.txt)
################################################################################
# Bundles the Node.js backend code
bundle:
npx esbuild scripts/backend/backend.ts \
--bundle \
--external:esbuild --external:react --external:react-dom --external:react-dom/server \
--log-level=warning \
--outfile=scripts/backend.esbuild.js \
--platform=node \
--sourcemap
################################################################################
# Makes all binaries in parallel; 'create-retro-app' and 'retro'. Note that
# these binaries are moved to '~/github/bin' so that they may be tested locally.
# Aliasing these binaries is recommended for development.
#
# ~/.bash_profile
#
# alias create-retro-app=~/github/bin/create-retro-app
# alias retro=~/github/bin/retro
#
all:
make bin
# Makes 'create-retro-app'
bin-create-retro-app:
go build -o=create-retro-app main_create_retro_app.go && mv create-retro-app ~/github/bin
# Makes 'retro'
bin-retro:
make bundle
go build -o=retro main_retro.go && mv retro ~/github/bin
# Makes all binaries in parallel
bin:
make -j2 \
bin-create-retro-app \
bin-retro
################################################################################
# Run all Go tests for 'create-retro-app'
test-create-retro-app:
go test ./cmd/create_retro_app/...
# Run all Go tests for 'retro'
test-retro:
go test ./cmd/retro/...
# Run all Go tests for local dependencies
test-pkg:
go test ./pkg/...
# Run all Go tests (not in parallel)
test:
make test-create-retro-app
make test-retro
make test-pkg
################################################################################
# Builds Go binaries and creates a placeholder executable for the post-
# installation script
build-create-retro-app:
rm -rf npm/create-retro-app/bin
mkdir -p npm/create-retro-app/bin
GOOS=darwin GOARCH=amd64 go build "-ldflags=-s -w" -o=npm/create-retro-app/bin/darwin-64 main_create_retro_app.go
GOOS=linux GOARCH=amd64 go build "-ldflags=-s -w" -o=npm/create-retro-app/bin/linux-64 main_create_retro_app.go
GOOS=windows GOARCH=amd64 go build "-ldflags=-s -w" -o=npm/create-retro-app/bin/windows-64.exe main_create_retro_app.go
touch npm/create-retro-app/bin/create-retro-app
# Builds Go binaries and creates a placeholder executable for the post-
# installation script
build-retro:
rm -rf npm/retro/bin
mkdir -p npm/retro/bin/scripts
make bundle
GOOS=darwin GOARCH=amd64 go build "-ldflags=-s -w" -o=npm/retro/bin/darwin-64 main_retro.go
GOOS=linux GOARCH=amd64 go build "-ldflags=-s -w" -o=npm/retro/bin/linux-64 main_retro.go
GOOS=windows GOARCH=amd64 go build "-ldflags=-s -w" -o=npm/retro/bin/windows-64.exe main_retro.go
cp \
scripts/backend.esbuild.js \
scripts/backend.esbuild.js.map \
scripts/require.js \
scripts/vendor.js \
npm/retro/bin/scripts
touch npm/retro/bin/retro
# Makes all builds in parallel
build:
make -j2 \
build-create-retro-app \
build-retro
################################################################################
# Versions 'create-retro-app' and 'retro'
version:
cd npm/create-retro-app && npm version "$(VERSION)" --allow-same-version
cd npm/retro && npm version "$(VERSION)" --allow-same-version
################################################################################
# Releases (dry-run) 'create-retro-app' and 'retro'
release-dry-run:
cd npm/create-retro-app && npm publish --dry-run
cd npm/retro && npm publish --dry-run
# Releases 'create-retro-app' and 'retro'
release:
cd npm/create-retro-app && npm publish
cd npm/retro && npm publish
################################################################################
# Publishes (dry-run) 'create-retro-app' and 'retro'
publish-dry-run:
make build && \
make version && \
make release-dry-run
# Publishes 'create-retro-app' and 'retro'
publish:
make build && \
make version && \
make release