<commit_before>.PHONY: help

help:
	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

clean:		## remove python cache files
	find . -name '__pycache__' | xargs rm -rf
	find . -name '*.pyc' -delete
	rm -rf build
	rm -rf dist
	rm -rf .pytest_cache
	rm -rf .coverage


black:		## black formatting
	black ccy tests

py36:		## build python 3.6 image for testing
	docker build -f dev/Dockerfile --build-arg PY_VERSION=python:3.6.10 -t ccy36 .

py37:		## build python 3.7 image for testing
	docker build -f dev/Dockerfile --build-arg PY_VERSION=python:3.7.7 -t ccy37 .

py38:		## build python 3.8 image for testing
	docker build -f dev/Dockerfile --build-arg PY_VERSION=python:3.8.3 -t ccy38 .

test-py36:	## test with python 3.6
	@docker run --rm --network=host ccy36 pytest

test-py37:	## test with python 3.7
	@docker run --rm --network=host ccy37 pytest

test-py38:	## test with python 3.8 with coverage
	@docker run --rm \
		-v $(PWD)/build:/workspace/build \
		ccy38 \
		pytest --cov --cov-report xml

test-docs: 	## run docs in CI
	@docker run --rm \
		-v $(PWD)/build:/workspace/build \
		ccy38 \
		make docs

test-black: 	## run black check in CI
	@docker run --rm \
		-v $(PWD)/build:/workspace/build \
		ccy38 \
		black ccy tests --check

test-flake8: 	## run flake8 in CI
	@docker run --rm \
		-v $(PWD)/build:/workspace/build \
		ccy38 \
		flake8

test-codecov:	## upload code coverage
	@docker run --rm \
		-v $(PWD):/workspace \
		ccy38 \
		codecov --token $(CODECOV_TOKEN) --file ./build/coverage.xml

test-version:	## validate version with pypi
	@docker run \
		-v $(PWD):/workspace \
		ccy38 \
		agilekit git validate

bundle:		## build python 3.8 bundle
	@docker run --rm \
		-v $(PWD):/workspace \
		ccy38 \
		python setup.py sdist bdist_wheel

github-tag:	## new tag in github
	@docker run \
		-v $(PWD):/workspace \
		-e GITHUB_TOKEN=$(GITHUB_SECRET) \
		ccy38 \
		agilekit git release --yes

pypi:		## release to pypi and github tag
	@docker run --rm \
		-v $(PWD):/workspace \
		ccy38 \
		twine upload dist/* --username lsbardel --password $(PYPI_PASSWORD)

release:	## release to pypi and github tag
	make pypi
	make github-tag<commit_msg>fix version check<commit_after>.PHONY: help

help:
	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

clean:		## remove python cache files
	find . -name '__pycache__' | xargs rm -rf
	find . -name '*.pyc' -delete
	rm -rf build
	rm -rf dist
	rm -rf .pytest_cache
	rm -rf .coverage


black:		## black formatting
	black ccy tests

py36:		## build python 3.6 image for testing
	docker build -f dev/Dockerfile --build-arg PY_VERSION=python:3.6.10 -t ccy36 .

py37:		## build python 3.7 image for testing
	docker build -f dev/Dockerfile --build-arg PY_VERSION=python:3.7.7 -t ccy37 .

py38:		## build python 3.8 image for testing
	docker build -f dev/Dockerfile --build-arg PY_VERSION=python:3.8.3 -t ccy38 .

test-py36:	## test with python 3.6
	@docker run --rm --network=host ccy36 pytest

test-py37:	## test with python 3.7
	@docker run --rm --network=host ccy37 pytest

test-py38:	## test with python 3.8 with coverage
	@docker run --rm \
		-v $(PWD)/build:/workspace/build \
		ccy38 \
		pytest --cov --cov-report xml

test-docs: 	## run docs in CI
	@docker run --rm \
		-v $(PWD)/build:/workspace/build \
		ccy38 \
		make docs

test-black: 	## run black check in CI
	@docker run --rm \
		-v $(PWD)/build:/workspace/build \
		ccy38 \
		black ccy tests --check

test-flake8: 	## run flake8 in CI
	@docker run --rm \
		-v $(PWD)/build:/workspace/build \
		ccy38 \
		flake8

test-codecov:	## upload code coverage
	@docker run --rm \
		-v $(PWD):/workspace \
		ccy38 \
		codecov --token $(CODECOV_TOKEN) --file ./build/coverage.xml

test-version:	## validate version with pypi
	@docker run \
		-v $(PWD):/workspace \
		ccy38 \
		agilekit git validate

terminal:	## enter terminal
	@docker run -it --rm \
		-v $(PWD):/workspace \
		ccy38 \
		/bin/bash

bundle:		## build python 3.8 bundle
	@docker run --rm \
		-v $(PWD):/workspace \
		ccy38 \
		python setup.py sdist bdist_wheel

github-tag:	## new tag in github
	@docker run \
		-v $(PWD):/workspace \
		-e GITHUB_TOKEN=$(GITHUB_SECRET) \
		ccy38 \
		agilekit git release --yes

pypi:		## release to pypi and github tag
	@docker run --rm \
		-v $(PWD):/workspace \
		ccy38 \
		twine upload dist/* --username lsbardel --password $(PYPI_PASSWORD)

release:	## release to pypi and github tag
	make pypi
	make github-tag

version:	## display software version
	@python -c "import ccy; print(ccy.__version__)"
{'fraction_non_alphanumeric': 0.14479143917886, 'fraction_numerical': 0.029700808036689234, 'mean_word_length': 2.687600644122383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '839420', 'n_tokens_mistral': 2002, 'n_tokens_neox': 1824, 'n_words': 547}