|
1 |
| -# Minimal makefile for Sphinx documentation |
2 |
| -# |
| 1 | +install: .devcontainer/postCreateCommand.sh ## Install the poetry environment and install the pre-commit hooks |
| 2 | + @echo "🛠️ Creating virtual environment using poetry and installing pre-commit hooks" |
| 3 | + @bash .devcontainer/postCreateCommand.sh |
| 4 | + @echo "🐢 Launching poetry shell" |
| 5 | + @poetry shell |
3 | 6 |
|
4 |
| -# You can set these variables from the command line, and also |
5 |
| -# from the environment for the first two. |
6 |
| -SPHINXOPTS ?= |
7 |
| -SPHINXBUILD ?= sphinx-build |
8 |
| -SOURCEDIR = docs |
9 |
| -BUILDDIR = build |
| 7 | +.PHONY: check |
| 8 | +check: ## Run code quality tools. |
| 9 | + @echo "🔒 Checking Poetry lock file consistency with 'pyproject.toml': Running poetry lock --check" |
| 10 | + @poetry check --lock |
| 11 | + @echo "🔎 Linting code: Running pre-commit" |
| 12 | + @poetry run pre-commit run -a |
10 | 13 |
|
11 |
| -# Put it first so that "make" without argument is like "make help". |
12 |
| -help: |
13 |
| - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 14 | +.PHONY: test |
| 15 | +test: ## Test the code with pytest |
| 16 | + @echo "🧪 Testing code: Running pytest" |
| 17 | + @poetry run pytest --cov --cov-config=pyproject.toml --cov-report=xml |
| 18 | + |
| 19 | +.PHONY: docs |
| 20 | +docs: ## Build the documentation |
| 21 | + @echo "📚 Building documentation" |
| 22 | + @poetry run sphinx-build docs build |
| 23 | + |
| 24 | +.PHONY: build |
| 25 | +build: clean-build ## Build wheel file using poetry |
| 26 | + @echo "🛞 Creating wheel and sdist files" |
| 27 | + @poetry build |
14 | 28 |
|
15 |
| -.PHONY: help Makefile |
| 29 | +.PHONY: clean-build |
| 30 | +clean-build: ## clean build artifacts |
| 31 | + @echo "🧹 Cleaning build artifacts" |
| 32 | + @rm -rf dist |
16 | 33 |
|
17 |
| -# Catch-all target: route all unknown targets to Sphinx using the new |
18 |
| -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). |
19 |
| -%: Makefile |
20 |
| - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 34 | +.PHONY: docker-build |
| 35 | +test_docker_build: ## Build the docker image and run the tests |
| 36 | + @echo "🐳 Building docker image and running tests" |
| 37 | + @docker build -f build/docker/Dockerfile -t pycytominer:latest . |
| 38 | + @docker run pycytominer:latest poetry run pytest |
| 39 | + |
| 40 | +.PHONY: help |
| 41 | +help: |
| 42 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' "$(MAKEFILE_LIST)" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' |
21 | 43 |
|
22 |
| -# note: presumes the existence of docker daemon to receive docker commands |
23 |
| -test_docker_build: |
24 |
| - docker build -f build/docker/Dockerfile -t pycytominer:latest . && \ |
25 |
| - docker run pycytominer:latest poetry run pytest |
| 44 | +.DEFAULT_GOAL := help |
0 commit comments