-
Notifications
You must be signed in to change notification settings - Fork 463
/
Makefile
114 lines (92 loc) · 3.73 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
DIRECTORIES ?= superduper test
SUPERDUPER_CONFIG ?= test/configs/default.yaml
PYTEST_ARGUMENTS ?=
PLUGIN_NAME ?=
# Export directories for data and artifacts
export SUPERDUPER_DATA_DIR ?= ~/.cache/superduper/test_data
export SUPERDUPER_ARTIFACTS_DIR ?= ~/.cache/superduper/artifacts
##@ General
# Display help message with available targets
.DEFAULT_GOAL := help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Release Management
# Release a new version of superduper.io
# The general flow is VERSION -> make new_release -> GITHUB_ACTIONS -> {make docker_push, ...}
RELEASE_VERSION=$(shell cat VERSION)
PARENT=$(shell python -c "import sys; print('.'.join(sys.argv[1].split('.')[:-1]))" $$(cat VERSION))
CURRENT_RELEASE=$(shell git describe --abbrev=0 --tags)
CURRENT_COMMIT=$(shell git rev-parse --short HEAD)
new_release: ## Release a new version of superduper.io
@python superduper/misc/release_tools.py
@echo "** Releasing a version to $(PARENT) parent version"
@echo "** Switching to branch release-$(RELEASE_VERSION)"
@git checkout -b release-$(RELEASE_VERSION)
@echo "** Commit Bump Version and Tags"
@git commit -m "Bump Version $(RELEASE_VERSION)" --amend
@git tag $(RELEASE_VERSION)
git push upstream release-$(RELEASE_VERSION)
@echo "Now make a pull request to the $(RELEASE_VERSION)"
TEMPLATES ?= '*'
build_templates: # build the templates with APPLY=False TEMPLATES='*'
if [ "$(TEMPLATES)" = "*" ]; then \
templates_to_build=$$(ls -d templates/*/); \
else \
templates_to_build=$$(echo $(TEMPLATES) | tr ',' ' '); \
fi; \
for template in $$templates_to_build; do \
echo $$template; \
rm -rf templates/$$template/blobs; \
rm -rf templates/$$template/files; \
rm -rf templates/$$template/.ipynb_checkpoints; \
(cd templates/$$template && papermill build.ipynb /tmp/papermill_output.ipynb -p APPLY False); \
jupyter nbconvert templates/$$template/build.ipynb --clear-output; \
done;
##@ Code Quality
gen_docs: ## Generate Docs and API
@echo "===> Generate docusaurus docs and blog-posts <==="
cd docs && npm i --legacy-peer-deps && npm run build
cd ..
@echo "Build finished. The HTML pages are in docs/hr/build"
lint-and-type-check: ## Lint and type-check the code
@echo "===> Code Formatting <==="
black --check $(DIRECTORIES)
ruff check $(DIRECTORIES)
@echo "===> Static Typing Check <==="
@if [ -d .mypy_cache ]; then rm -rf .mypy_cache; fi
mypy superduper
# Check for missing docstrings
# interrogate superduper
# Check for unused dependencies
# deptry ./
# Check for deadcode
# vulture ./
install_all_plugins:
@plugins=""; \
for plugin in $$(ls plugins); do \
if [ "$$plugin" != "template" -a -d "plugins/$$plugin" -a -f "plugins/$$plugin/pyproject.toml" ]; then \
plugins="$$plugins $$plugin"; \
fi \
done; \
echo "Found plugins:$$plugins"; \
for plugin in $$plugins; do \
echo "Installing $$plugin..."; \
python -m pip install -e "plugins/$$plugin[test]"; \
done
%:
@:
fix-and-check: ## Lint the code before testing
# Code formatting
black $(DIRECTORIES)
# Linter and code formatting
ruff check --fix $(DIRECTORIES)
# Linting
@if [ -d .mypy_cache ]; then rm -rf .mypy_cache; fi
mypy superduper
##@ CI Testing Functions
rest_testing: ## Execute rest unit tests
SUPERDUPER_CONFIG=$(SUPERDUPER_CONFIG) pytest $(PYTEST_ARGUMENTS) ./test/rest
unit_testing: ## Execute unit testing
SUPERDUPER_CONFIG=$(SUPERDUPER_CONFIG) pytest $(PYTEST_ARGUMENTS) test/unittest/
usecase_testing: ## Execute usecase testing
SUPERDUPER_CONFIG=$(SUPERDUPER_CONFIG) pytest $(PYTEST_ARGUMENTS) ./test/integration/usecase