-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (65 loc) · 3.24 KB
/
Makefile
File metadata and controls
73 lines (65 loc) · 3.24 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
.PHONY: all
all: cli
.PHONE: cli-only
cli-only:
go run scripts/embed_duckdb_ext/main.go
go build -o rill cli/main.go
.PHONY: cli
cli: cli.prepare
go build -o rill cli/main.go
.PHONY: cli.prepare
cli.prepare: runtime.examples.embed
npm install
npm run build
rm -rf cli/pkg/web/embed/dist || true
mkdir -p cli/pkg/web/embed/dist
cp -r web-local/build/* cli/pkg/web/embed/dist
go run scripts/embed_duckdb_ext/main.go
.PHONY: coverage.go
coverage.go:
rm -rf coverage/go.out
mkdir -p coverage
# Run tests with coverage output. First builds the list of packages to include in coverage, excluding generated code in 'proto/gen'.
set -e ; \
PACKAGES=$$(go list ./... | grep -v 'proto/gen/' | tr '\n' ',' | sed -e 's/,$$//' | sed -e 's/github.com\/rilldata\/rill/./g') ;\
go test ./... -short -v -coverprofile ./coverage/go.out -coverpkg $$PACKAGES
go tool cover -func coverage/go.out
.PHONY: docs.generate
docs.generate: runtime.examples.embed
# Temporarily replaces ~/.rill/config.yaml to avoid including user-defined defaults in generated docs.
#
# Sets main.Version to a fixed tag to simulate a production build, where certain commands are hidden.
# Not using scripts/versiontag.sh since the actual version should not be emitted to the generated files as it would go stale on the next release.
rm -rf docs/docs/reference/cli/*.md docs/docs/reference/project-files/*.md
if [ -f ~/.rill/config.yaml ]; then mv ~/.rill/config.yaml ~/.rill/config.yaml.tmp; fi;
RILL_DOCS_GENERATE=true go run -ldflags="-X main.Version=1.0.0" ./cli docs generate-cli docs/docs/reference/cli/
RILL_DOCS_GENERATE=true go run -ldflags="-X main.Version=1.0.0" ./cli docs generate-project docs/docs/reference/project-files/
if [ -f ~/.rill/config.yaml.tmp ]; then mv ~/.rill/config.yaml.tmp ~/.rill/config.yaml; fi;
.PHONY: proto.generate
proto.generate:
cd proto && buf generate --exclude-path rill/ui
cd proto && buf generate --template buf.gen.openapi-admin.yaml --path rill/admin
cd proto && buf generate --template buf.gen.openapi-runtime.yaml --path rill/runtime
cd proto && buf generate --template buf.gen.runtime.yaml --path rill/runtime
cd proto && buf generate --template buf.gen.local.yaml --path rill/local
cd proto && buf generate --template buf.gen.ui.yaml
go run scripts/convert-openapi-v2-to-v3/convert.go --force \
proto/gen/rill/admin/v1/admin.swagger.yaml proto/gen/rill/admin/v1/openapi.yaml
go run scripts/convert-openapi-v2-to-v3/convert.go --force --public-only \
proto/gen/rill/admin/v1/admin.swagger.yaml proto/gen/rill/admin/v1/public.openapi.yaml
npm install
npm run generate:runtime-client -w web-common
npm run generate:client -w web-admin
KEEP_EXAMPLES := rill-openrtb-prog-ads rill-github-analytics rill-cost-monitoring
.PHONY: runtime.examples.embed
runtime.examples.embed:
@set -e; \
rm -rf runtime/pkg/examples/embed/dist || true; \
mkdir -p runtime/pkg/examples/embed/dist; \
# Create a temp dir (GNU mktemp first, then BSD/macOS fallback)
TMP_CLONE_DIR=$$(mktemp -d 2>/dev/null || mktemp -d -t rill-examples); \
trap 'rm -rf "$$TMP_CLONE_DIR"' EXIT; \
git clone --quiet --depth=1 https://github.com/rilldata/rill-examples.git "$$TMP_CLONE_DIR"; \
for d in $(KEEP_EXAMPLES); do \
cp -R "$$TMP_CLONE_DIR/$$d" runtime/pkg/examples/embed/dist/; \
done