forked from databrickslabs/jupyterlab-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (90 loc) · 3.27 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
.PHONY: clean wheel install tests check_version dist check_dist upload_test upload dev_tools bump bump_ext release docker upload_docker
NO_COLOR = \x1b[0m
OK_COLOR = \x1b[32;01m
ERROR_COLOR = \x1b[31;01m
PYCACHE := $(shell find . -name '__pycache__')
EGGS := $(wildcard '*.egg-info')
CURRENT_VERSION := $(shell awk '/current_version/ {print $$3}' .bumpversion.cfg)
NORMALIZED_VERSION := $(subst -,,$(CURRENT_VERSION))
clean:
@echo "$(OK_COLOR)=> Cleaning$(NO_COLOR)"
@rm -fr build dist $(EGGS) $(PYCACHE) databrickslabs_jupyterlab/lib/* databrickslabs_jupyterlab/env_files/*
@rm -f dj
prepare: clean
git add .
git status
git commit -m "cleanup before release"
# Tests
tests:
cd tests && python -m unittest
ext:
cd extensions/databrickslabs_jupyterlab_statusbar && \
jupyter labextension install --no-build && \
jupyter lab build --dev-build=True --minimize=False
# Version commands
bump:
ifdef part
ifdef version
bumpversion --new-version $(version) $(part) && grep current .bumpversion.cfg
else
bumpversion $(part) && grep current .bumpversion.cfg
endif
else
@echo "$(ERROR_COLOR)Provide part=major|minor|patch|release|build and optionally version=x.y.z...$(NO_COLOR)"
exit 1
endif
bump_ext:
ifdef part
$(eval cur_version=$(shell cd extensions/databrickslabs_jupyterlab_statusbar/ && npm version $(part) --preid=rc))
else
ifdef version
$(eval cur_version := $(shell cd extensions/databrickslabs_jupyterlab_statusbar/ && npm version $(version)))
else
@echo "$(ERROR_COLOR)Provide part=major|minor|patch|premajor|preminor|prepatch|prerelease or version=x.y.z...$(NO_COLOR)"
exit 1
endif
endif
@echo "$(OK_COLOR)=> New version: $(cur_version:v%=%)$(NO_COLOR)"
@sed -i.bak 's|databrickslabs-jupyterlab-statusbar@.*|databrickslabs-jupyterlab-statusbar@$(cur_version)|' labextensions.txt
cat labextensions.txt
git add labextensions.txt extensions/databrickslabs_jupyterlab_statusbar/package.json
git commit -m "extension release $(cur_version)"
# Dist commands
# wheel:
dist:
@mkdir -p databrickslabs_jupyterlab/lib
@cp env.yml labextensions.txt "databrickslabs_jupyterlab/lib/"
@cp databrickslabs-jupyterlab dj
ifdef CLUSTER
(DB_HOME=/databricks python setup.py sdist bdist_wheel)
else
python setup.py sdist bdist_wheel
endif
dev_tag:
git tag -a v$(CURRENT_VERSION) -m "Dev release: $(CURRENT_VERSION)"
release:
git add .
git status
git commit -m "Latest release: $(CURRENT_VERSION)"
git tag -a v$(CURRENT_VERSION) -m "Latest release: $(CURRENT_VERSION)"
install_wheel: dist
scp dist/databrickslabs_jupyterlab-$(NORMALIZED_VERSION)-py3-none-any.whl $(CLUSTER):/tmp
ssh $(CLUSTER) sudo -H /databricks/python/bin/python -m pip install --upgrade /tmp/databrickslabs_jupyterlab-$(NORMALIZED_VERSION)-py3-none-any.whl
install: dist
@echo "$(OK_COLOR)=> Installing databrickslabs_jupyterlab$(NO_COLOR)"
@pip install --upgrade .
check_dist:
@twine check dist/*
upload:
@twine upload dist/*
upload_ext:
cd extensions/databrickslabs_jupyterlab_statusbar && npm publish
# dev tools
check_version:
dev_tools/check_versions env.yml
dev_tools:
pip install twine bumpversion yapf pylint pyYaml pytest
docker:
@cd docker/image && docker build -t bwalter42/databrickslabs_jupyterlab:$(CURRENT_VERSION) .
upload_docker: docker
@docker push bwalter42/databrickslabs_jupyterlab:$(CURRENT_VERSION)