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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
PROJ=celery
PGPIDENT="Celery Security Team"
PYTHON=python
PYTEST=pytest
GIT=git
TOX=tox
ICONV=iconv
FLAKE8=flake8
PYROMA=pyroma
SPHINX2RST=sphinx2rst
RST2HTML=rst2html.py
DEVNULL=/dev/null
TESTDIR=t
SPHINX_DIR=docs/
SPHINX_BUILDDIR="${SPHINX_DIR}/_build"
README=README.rst
README_SRC="docs/templates/readme.txt"
CONTRIBUTING=CONTRIBUTING.rst
CONTRIBUTING_SRC="docs/contributing.rst"
SPHINX_HTMLDIR="${SPHINX_BUILDDIR}/html"
DOCUMENTATION=Documentation
WORKER_GRAPH="docs/images/worker_graph_full.png"
all: help
help:
@echo "docs - Build documentation."
@echo "test-all - Run tests for all supported python versions."
@echo "distcheck ---------- - Check distribution for problems."
@echo " test - Run unittests using current python."
@echo " lint ------------ - Check codebase for problems."
@echo " apicheck - Check API reference coverage."
@echo " configcheck - Check configuration reference coverage."
@echo " readmecheck - Check README.rst encoding."
@echo " contribcheck - Check CONTRIBUTING.rst encoding"
@echo " flakes -------- - Check code for syntax and style errors."
@echo " flakecheck - Run flake8 on the source code."
@echo "readme - Regenerate README.rst file."
@echo "contrib - Regenerate CONTRIBUTING.rst file"
@echo "clean-dist --------- - Clean all distribution build artifacts."
@echo " clean-git-force - Remove all uncommitted files."
@echo " clean ------------ - Non-destructive clean"
@echo " clean-pyc - Remove .pyc/__pycache__ files"
@echo " clean-docs - Remove documentation build artifacts."
@echo " clean-build - Remove setup artifacts."
@echo "bump - Bump patch version number."
@echo "bump-minor - Bump minor version number."
@echo "bump-major - Bump major version number."
@echo "release - Make PyPI release."
@echo ""
@echo "Docker-specific commands:"
@echo " docker-build - Build celery docker container."
@echo " docker-lint - Run tox -e lint on docker container."
@echo " docker-unit-tests - Run unit tests on docker container, use '-- -k <TEST NAME>' for specific test run."
@echo " docker-bash - Get a bash shell inside the container."
@echo " docker-docs - Build documentation with docker."
clean: clean-docs clean-pyc clean-build
clean-dist: clean clean-git-force
bump:
bumpversion patch
bump-minor:
bumpversion minor
bump-major:
bumpversion major
release:
python setup.py register sdist bdist_wheel upload --sign --identity="$(PGPIDENT)"
Documentation:
(cd "$(SPHINX_DIR)"; $(MAKE) html)
mv "$(SPHINX_HTMLDIR)" $(DOCUMENTATION)
docs: clean-docs Documentation
clean-docs:
-rm -rf "$(SPHINX_BUILDDIR)" "$(DOCUMENTATION)"
lint: flakecheck apicheck configcheck readmecheck
apicheck:
(cd "$(SPHINX_DIR)"; $(MAKE) apicheck)
configcheck:
(cd "$(SPHINX_DIR)"; $(MAKE) configcheck)
flakecheck:
$(FLAKE8) "$(PROJ)" "$(TESTDIR)"
flakediag:
-$(MAKE) flakecheck
flakes: flakediag
clean-readme:
-rm -f $(README)
readmecheck-unicode:
$(ICONV) -f ascii -t ascii $(README) >/dev/null
readmecheck-rst:
-$(RST2HTML) $(README) >$(DEVNULL)
readmecheck: readmecheck-unicode readmecheck-rst
$(README):
$(SPHINX2RST) "$(README_SRC)" --ascii > $@
readme: clean-readme $(README) readmecheck
clean-contrib:
-rm -f "$(CONTRIBUTING)"
$(CONTRIBUTING):
$(SPHINX2RST) "$(CONTRIBUTING_SRC)" > $@
contrib: clean-contrib $(CONTRIBUTING)
clean-pyc:
-find . -type f -a \( -name "*.pyc" -o -name "*$$py.class" \) | xargs -r rm
-find . -type d -name "__pycache__" | xargs -r rm -r
removepyc: clean-pyc
clean-build:
rm -rf build/ dist/ .eggs/ *.egg-info/ .coverage cover/
clean-git:
$(GIT) clean -xdn
clean-git-force:
$(GIT) clean -xdf
test-all: clean-pyc
$(TOX)
test:
$(PYTHON) setup.py test
cov:
$(PYTEST) -x --cov="$(PROJ)" --cov-report=html
build:
$(PYTHON) setup.py sdist bdist_wheel
distcheck: lint test clean
dist: readme contrib clean-dist build
$(WORKER_GRAPH):
$(PYTHON) -m celery graph bootsteps | dot -Tpng -o $@
clean-graph:
-rm -f $(WORKER_GRAPH)
graph: clean-graph $(WORKER_GRAPH)
authorcheck:
git shortlog -se | cut -f2 | extra/release/attribution.py
.PHONY: docker-build
docker-build:
@DOCKER_BUILDKIT=1 docker compose -f docker/docker-compose.yml build
.PHONY: docker-lint
docker-lint:
@docker compose -f docker/docker-compose.yml run --rm -w /home/developer/celery celery tox -e lint
.PHONY: docker-unit-tests
docker-unit-tests:
@docker compose -f docker/docker-compose.yml run --rm -w /home/developer/celery celery tox -e 3.12-unit -- $(filter-out $@,$(MAKECMDGOALS))
# Integration tests are not fully supported when running in a docker container yet so we allow them to
# gracefully fail until fully supported.
# TODO: Add documentation (in help command) when fully supported.
.PHONY: docker-integration-tests
docker-integration-tests:
@docker compose -f docker/docker-compose.yml run --rm -w /home/developer/celery celery tox -e 3.12-integration-docker -- --maxfail=1000
.PHONY: docker-bash
docker-bash:
@docker compose -f docker/docker-compose.yml run --rm -w /home/developer/celery celery bash
.PHONY: docker-docs
docker-docs:
@docker compose -f docker/docker-compose.yml up --build -d docs
@echo "Waiting 60 seconds for docs service to build the documentation inside the container..."
@timeout 60 sh -c 'until docker logs $$(docker compose -f docker/docker-compose.yml ps -q docs) 2>&1 | \
grep "build succeeded"; do sleep 1; done' || \
(echo "Error! - run manually: docker compose -f ./docker/docker-compose.yml up --build docs"; \
docker compose -f docker/docker-compose.yml logs --tail=50 docs; false)
@docker compose -f docker/docker-compose.yml down
.PHONY: catch-all
%: catch-all
@:
|