Skip to content

Commit

Permalink
create makefile templates
Browse files Browse the repository at this point in the history
  • Loading branch information
laszewsk committed Dec 15, 2023
1 parent bb404e3 commit df30564
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 99 deletions.
106 changes: 7 additions & 99 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,109 +1,17 @@
package=sys
package=common
UNAME=$(shell uname)
VERSION=`head -1 VERSION`

.PHONY: conda

define banner
@echo
@echo "############################################################"
@echo "# $(1) "
@echo "############################################################"
endef
include makefile-banner.mk

source:
$(call banner, "Install cloudmesh-common")
$(call banner, "Install cloudmesh-${package}")
pip install -e . -U

flake8:
cd ..; flake8 --max-line-length 124 --ignore=E722 cloudmesh-$(package)/cloudmesh
cd ..; flake8 --max-line-length 124 --ignore=E722 cloudmesh-$(package)/tests

pylint:
cd ..; pylint --rcfile=cloudmesh-$(package)/.pylintrc cloudmesh-$(package)/cloudmesh
cd ..; pylint --rcfile=cloudmesh-$(package)/.pylintrc --disable=F0010 cloudmesh-$(package)/tests

requirements:
echo "# cloudmesh-common requirements"> tmp.txt
#echo "cloudmesh-common" > tmp.txt
#echo "cloudmesh-cmd5" >> tmp.txt
# pip-compile setup.py
cat requirements.txt >> tmp.txt
mv tmp.txt requirements.txt
-git commit -m "update requirements" requirements.txt
-git push

test:
pytest -v --html=.report.html
open .report.html

dtest:
pytest -v --capture=no

clean:
$(call banner, "CLEAN")
rm -rf *.zip
rm -rf *.egg-info
rm -rf *.eggs
rm -rf docs/build
rm -rf build
rm -rf dist
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
rm -rf .tox
rm -f *.whl


######################################################################
# PYPI
######################################################################

twine:
pip install -U twine

dist:
python setup.py sdist bdist_wheel
twine check dist/*

patch: clean twine
$(call banner, "patch")
cms bumpversion patch
python setup.py sdist bdist_wheel
git push origin main --tags
twine check dist/*
twine upload --repository testpypi dist/*

minor: clean
$(call banner, "minor")
cms bumpversion minor
@cat VERSION
@echo

major: clean
$(call banner, "major")
cms bumpversion major
@cat VERSION
@echo

release: clean
$(call banner, "release")
git tag "v$(VERSION)"
git push origin main --tags
python setup.py sdist bdist_wheel
twine check dist/*
twine upload --repository pypi dist/*
$(call banner, "install")
@cat VERSION
@echo
include makefile-test.mk

upload:
twine check dist/*
twine upload dist/*
include makefile-clean.mk

pip:
pip install --index-url https://test.pypi.org/simple/ cloudmesh-$(package) -U
include makefile-check.mk

log:
$(call banner, log)
gitchangelog | fgrep -v ":dev:" | fgrep -v ":new:" > ChangeLog
git commit -m "chg: dev: Update ChangeLog" ChangeLog
git push
include makefile-pypi.mk
7 changes: 7 additions & 0 deletions makefile-banner.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
define banner
@echo
@echo "############################################################"
@echo "# $(1) "
@echo "############################################################"
endef

8 changes: 8 additions & 0 deletions makefile-check.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

flake8:
cd ..; flake8 --max-line-length 124 --ignore=E722 cloudmesh-$(package)/cloudmesh
cd ..; flake8 --max-line-length 124 --ignore=E722 cloudmesh-$(package)/tests

pylint:
cd ..; pylint --rcfile=cloudmesh-$(package)/.pylintrc cloudmesh-$(package)/cloudmesh
cd ..; pylint --rcfile=cloudmesh-$(package)/.pylintrc --disable=F0010 cloudmesh-$(package)/tests
11 changes: 11 additions & 0 deletions makefile-clean.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
clean:
$(call banner, "CLEAN")
rm -rf *.zip
rm -rf *.egg-info
rm -rf *.eggs
rm -rf docs/build
rm -rf build
rm -rf dist
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
rm -rf .tox
rm -f *.whl
54 changes: 54 additions & 0 deletions makefile-pypi.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
######################################################################
# PYPI
######################################################################

twine:
pip install -U twine

dist:
python setup.py sdist bdist_wheel
twine check dist/*

patch: clean twine
$(call banner, "patch")
cms bumpversion patch
python setup.py sdist bdist_wheel
git push origin main --tags
twine check dist/*
twine upload --repository testpypi dist/*

minor: clean
$(call banner, "minor")
cms bumpversion minor
@cat VERSION
@echo

major: clean
$(call banner, "major")
cms bumpversion major
@cat VERSION
@echo

release: clean
$(call banner, "release")
git tag "v$(VERSION)"
git push origin main --tags
python setup.py sdist bdist_wheel
twine check dist/*
twine upload --repository pypi dist/*
$(call banner, "install")
@cat VERSION
@echo

upload:
twine check dist/*
twine upload dist/*

pip:
pip install --index-url https://test.pypi.org/simple/ cloudmesh-$(package) -U

log:
$(call banner, log)
gitchangelog | fgrep -v ":dev:" | fgrep -v ":new:" > ChangeLog
git commit -m "chg: dev: Update ChangeLog" ChangeLog
git push
6 changes: 6 additions & 0 deletions makefile-test.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test:
pytest -v --html=.report.html
open .report.html

dtest:
pytest -v --capture=no

0 comments on commit df30564

Please sign in to comment.