@@ -107,18 +107,34 @@ fix-lint: ## fix lint issues using autoflake, autopep8, and isort
107107
108108# TEST TARGETS
109109
110- .PHONY : test
111- test : # # run tests quickly with the default Python
110+ .PHONY : test-unit
111+ test-unit : # # run tests quickly with the default Python
112112 python -m pytest --cov=mlprimitives
113113
114- .PHONY : test-all
115- test-all : # # run tests on every Python version with tox
116- tox -r
114+ .PHONY : test-readme
115+ test-readme : # # run the readme snippets
116+ rm -rf tests/readme_test && mkdir tests/readme_test
117+ cd tests/readme_test && rundoc run --single-session python3 -t python3 ../../README.md
118+ rm -rf tests/readme_test
117119
118120.PHONY : test-pipelines
119121test-pipelines : # # Test all the pipelines from the pipelines folder
120122 mlprimitives test mlprimitives/pipelines/* .json
121123
124+ .PHONY : test
125+ test : test-unit test-readme # # test everything that needs test dependencies
126+
127+ .PHONY : check-dependencies
128+ check-dependencies : # # test if there are any broken dependencies
129+ pip check
130+
131+ .PHONY : test-devel
132+ test-devel : check-dependencies lint docs # # test everything that needs development dependencies
133+
134+ .PHONY : test-all
135+ test-all : # # run tests on every Python version with tox
136+ tox -r
137+
122138.PHONY : coverage
123139coverage : # # check code coverage quickly with the default Python
124140 coverage run --source mlprimitives -m pytest
@@ -133,7 +149,6 @@ coverage: ## check code coverage quickly with the default Python
133149docs : clean-docs # # generate Sphinx HTML documentation, including API docs
134150 sphinx-apidoc --module-first --separate -T -o docs/api/ mlprimitives
135151 $(MAKE ) -C docs html
136- touch docs/_build/html/.nojekyll
137152
138153.PHONY : view-docs
139154view-docs : docs # # view docs in browser
@@ -152,12 +167,19 @@ dist: clean ## builds source and wheel package
152167 python setup.py bdist_wheel
153168 ls -l dist
154169
155- .PHONY : test-publish
156- test-publish : dist # # package and upload a release on TestPyPI
170+ .PHONY : publish-confirm
171+ publish-confirm :
172+ @echo " WARNING: This will irreversibly upload a new version to PyPI!"
173+ @echo -n " Please type 'confirm' to proceed: " \
174+ && read answer \
175+ && [ " $$ {answer}" = " confirm" ]
176+
177+ .PHONY : publish-test
178+ publish-test : dist publish-confirm # # package and upload a release on TestPyPI
157179 twine upload --repository-url https://test.pypi.org/legacy/ dist/*
158180
159181.PHONY : publish
160- publish : dist # # package and upload a release
182+ publish : dist publish-confirm # # package and upload a release
161183 twine upload dist/*
162184
163185.PHONY : bumpversion-release
@@ -167,6 +189,13 @@ bumpversion-release: ## Merge master to stable and bumpversion release
167189 bumpversion release
168190 git push --tags origin stable
169191
192+ .PHONY : bumpversion-release-test
193+ bumpversion-release-test : # # Merge master to stable and bumpversion release
194+ git checkout stable || git checkout -b stable
195+ git merge --no-ff master -m" make release-tag: Merge branch 'master' into stable"
196+ bumpversion release --no-tag
197+ @echo git push --tags origin stable
198+
170199.PHONY : bumpversion-patch
171200bumpversion-patch : # # Merge stable to master and bumpversion patch
172201 git checkout master
@@ -186,9 +215,21 @@ bumpversion-minor: ## Bump the version the next minor skipping the release
186215bumpversion-major : # # Bump the version the next major skipping the release
187216 bumpversion --no-tag major
188217
218+ .PHONY : bumpversion-revert
219+ bumpversion-revert : # # Undo a previous bumpversion-release
220+ git checkout master
221+ git branch -D stable
222+
223+ CLEAN_DIR := $(shell git status --short | grep -v ??)
189224CURRENT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
190225CHANGELOG_LINES := $(shell git diff HEAD..origin/stable HISTORY.md 2>&1 | wc -l)
191226
227+ .PHONY : check-clean
228+ check-clean : # # Check if the directory has uncommitted changes
229+ ifneq ($(CLEAN_DIR ) ,)
230+ $(error There are uncommitted changes)
231+ endif
232+
192233.PHONY : check-master
193234check-master : # # Check if we are in master branch
194235ifneq ($(CURRENT_BRANCH ) ,master)
@@ -202,14 +243,21 @@ ifeq ($(CHANGELOG_LINES),0)
202243endif
203244
204245.PHONY : check-release
205- check-release : check-master check-history # # Check if the release can be made
246+ check-release : check-clean check-master check-history # # Check if the release can be made
247+ @echo " A new release can be made"
206248
207249.PHONY : release
208250release : check-release bumpversion-release publish bumpversion-patch
209251
252+ .PHONY : release-test
253+ release-test : check-release bumpversion-release-test publish-test bumpversion-revert
254+
210255.PHONY : release-candidate
211256release-candidate : check-master publish bumpversion-candidate
212257
258+ .PHONY : release-candidate-test
259+ release-candidate-test : check-clean check-master publish-test
260+
213261.PHONY : release-minor
214262release-minor : check-release bumpversion-minor release
215263
0 commit comments