-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathMakefile
More file actions
140 lines (113 loc) · 4.07 KB
/
Makefile
File metadata and controls
140 lines (113 loc) · 4.07 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
# (C) 2021 GoodData Corporation
# list all full paths to files and directories in CWD containing "gooddata", filter out ones ending by "client"
NO_CLIENT_GD_PROJECTS_ABS = $(filter-out %client, $(wildcard $(CURDIR)/packages/*gooddata*))
# for each path, take only the base name of the path
NO_CLIENT_GD_PROJECTS_DIRS = $(foreach dir, $(NO_CLIENT_GD_PROJECTS_ABS), $(notdir $(dir)))
# TODO: replace API_VERSION in the future by call to API
API_VERSION="v1"
# Generate from localhost
BASE_URL="http://localhost:3000"
# Generate from PROD
# BASE_URL="https://demo-cicd.cloud.gooddata.com"
URL="${BASE_URL}/api/${API_VERSION}/schemas"
include ci_tests.mk
# Common command components
RUFF = .venv/bin/ruff
all:
echo "Nothing here yet."
.PHONY: dev
dev:
uv sync --all-groups
.venv/bin/pre-commit install
.PHONY: lint
lint:
$(RUFF) check .
.PHONY: lint-fix
lint-fix:
$(RUFF) check . --fix
.PHONY: format
format:
$(RUFF) format --check .
.PHONY: format-fix
format-fix:
$(RUFF) format .
.PHONY: format-diff
format-diff:
$(RUFF) format --diff .
define download_client
curl "${URL}/$(1)" | jq --sort-keys > schemas/gooddata-$(1)-client.json
endef
define generate_client
./scripts/generate_client.sh gooddata-$(1)-client -f "/local/schemas/gooddata-$(1)-client.json"
endef
.PHONY: api-client
api-client: download
rm -f schemas/gooddata-api-client.json
cat schemas/gooddata-*.json | jq -S -s 'reduce .[] as $$item ({}; . * $$item) + { tags : ( reduce .[].tags as $$item (null; . + $$item) | unique_by(.name) ) }' | sed '/\u0000/d' > "schemas/gooddata-api-client.json"
$(call generate_client,api)
# OpenAPI Generator drops the \x00 literal from regex patterns like ^[^\x00]*$,
# producing the invalid Python regex ^[^]*$. Restore the null-byte escape.
find gooddata-api-client/gooddata_api_client -name '*.py' -exec \
sed -i.bak 's/\^\[\^\]\*\$$/^[^\\x00]*$$/g' {} + && \
find gooddata-api-client/gooddata_api_client -name '*.py.bak' -delete
.PHONY: download
download:
$(call download_client,afm)
$(call download_client,metadata)
$(call download_client,scan)
$(call download_client,"export")
$(call download_client,automation)
$(call download_client,result)
.PHONY: type-check
type-check:
RESULT=0; \
for project in $(NO_CLIENT_GD_PROJECTS_DIRS); do $(MAKE) -C packages/$${project} type-check || RESULT=$$?; done; \
exit $$RESULT
.PHONY: types
types: type-check
.PHONY: test
test:
RESULT=0; \
for project in $(NO_CLIENT_GD_PROJECTS_DIRS); do $(MAKE) -C packages/$${project} test || RESULT=$$?; done; \
exit $$RESULT
.PHONY: test-staging
test-staging:
@test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make test-staging TOKEN=<api-token>" && exit 1)
$(MAKE) -C packages/gooddata-sdk test-staging TOKEN=$(TOKEN)
.PHONY: clean-staging
clean-staging:
@test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make clean-staging TOKEN=<api-token>" && exit 1)
cd packages/tests-support && STAGING=1 TOKEN="$(TOKEN)" python clean_staging.py
.PHONY: load-staging
load-staging:
@test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make load-staging TOKEN=<api-token>" && exit 1)
cd packages/tests-support && STAGING=1 TOKEN="$(TOKEN)" python upload_demo_layout.py
.PHONY: release
release:
if [ -z "$(VERSION)" ]; then echo "Usage: 'make release VERSION=X.Y.Z'"; false; else \
uv run tbump $(VERSION) --no-tag --no-push ; fi
.PHONY: release-ci
release-ci:
if [ -z "$(VERSION)" ]; then echo "Usage: 'make release-ci VERSION=X.Y.Z'"; false; else \
uv run tbump $(VERSION) --only-patch --non-interactive && uv lock ; fi
.PHONY: check-copyright
check-copyright:
uv run ./scripts/check_copyright.py FOLDER
.PHONY: docs
docs:
RESULT=0; \
for project in gooddata-fdw gooddata-pandas; do $(MAKE) -C packages/$${project} $@ || RESULT=$$?; done; \
exit $$RESULT
.PHONY: remove-cassettes
remove-cassettes:
RESULT=0; \
for project in $(NO_CLIENT_GD_PROJECTS_DIRS); do $(MAKE) -C packages/$${project} $@ || RESULT=$$?; done; \
exit $$RESULT
.PHONY: test-docs-scripts
test-docs-scripts:
uv run pytest scripts/docs/tests/ -v
.PHONY: new-docs
new-docs:
cd docs; \
npm install; \
hugo server