New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: tidy up makefile (DEV-1166) #223
Changes from 5 commits
fe64c19
648ca4c
c172927
6fa2191
73e295c
1d05f13
defea0e
4377ce1
7663c6e
4c0b6ad
8d4fad6
17c0932
027acd0
145c426
44e0432
67cceee
ebba80b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,23 @@ | |
THIS_FILE := $(lastword $(MAKEFILE_LIST)) | ||
CURRENT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
|
||
################################# | ||
############################ | ||
# Make targets for dsp-tools | ||
################################# | ||
|
||
.PHONY: clone-dsp-repo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need an extra command to clone the DSP-API. I included this in the |
||
clone-dsp-repo: ## clone the dsp-api git repository | ||
@git clone --branch main --single-branch --depth 1 https://github.com/dasch-swiss/dsp-api.git $(CURRENT_DIR)/.tmp/dsp-stack | ||
############################ | ||
|
||
.PHONY: dsp-stack | ||
dsp-stack: ## run the dsp-stack (deletes existing volumes first) | ||
$(MAKE) -C $(CURRENT_DIR)/.tmp/dsp-stack env-file | ||
$(MAKE) -C $(CURRENT_DIR)/.tmp/dsp-stack stack-down-delete-volumes | ||
$(MAKE) -C $(CURRENT_DIR)/.tmp/dsp-stack init-db-test | ||
$(MAKE) -C $(CURRENT_DIR)/.tmp/dsp-stack stack-up | ||
$(MAKE) -C $(CURRENT_DIR)/.tmp/dsp-stack stack-logs-api-no-follow | ||
dsp-stack: ## clone the dsp-api git repository and run the dsp-stack | ||
@mkdir -p .tmp | ||
@git clone --branch main --single-branch --depth 1 https://github.com/dasch-swiss/dsp-api.git .tmp/dsp-stack | ||
$(MAKE) -C .tmp/dsp-stack env-file | ||
$(MAKE) -C .tmp/dsp-stack init-db-test | ||
$(MAKE) -C .tmp/dsp-stack stack-up | ||
$(MAKE) -C .tmp/dsp-stack stack-logs-api-no-follow | ||
|
||
.PHONY: stack-down | ||
stack-down: ## stop dsp-stack and remove the cloned dsp-api repository | ||
$(MAKE) -C .tmp/dsp-stack stack-down-delete-volumes | ||
@sudo rm -rf .tmp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For developer's machines, we need a command to stop the dsp-stack, otherwise it continues running for a long time, consuming resources. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary to remove the tmp folder? Why not just leave it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
.PHONY: dist | ||
dist: ## generate distribution package | ||
|
@@ -27,21 +29,13 @@ dist: ## generate distribution package | |
upload: ## upload distribution package to PyPI | ||
python3 -m twine upload dist/* | ||
|
||
.PHONY: upgrade-dist-tools | ||
upgrade-dist-tools: ## upgrade packages necessary for testing, building, packaging and uploading to PyPI | ||
python3 -m pip install --upgrade pip setuptools wheel twine pytest mkdocs | ||
|
||
.PHONY: docs-build | ||
docs-build: ## build docs into the local 'site' folder | ||
mkdocs build | ||
|
||
.PHONY: docs-serve | ||
docs-serve: ## serve docs for local viewing | ||
mkdocs serve | ||
|
||
.PHONY: docs-publish | ||
docs-publish: ## build and publish docs to GitHub Pages | ||
mkdocs gh-deploy | ||
mkdocs serve --dev-addr=0.0.0.0:7979 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
.PHONY: install-requirements | ||
install-requirements: ## install requirements | ||
|
@@ -56,37 +50,35 @@ install: ## install from source (runs setup.py) | |
pip3 install -e . | ||
|
||
.PHONY: test | ||
test: clean local-tmp clone-dsp-repo dsp-stack ## run all tests | ||
test: dsp-stack ## run all tests | ||
pytest test/ | ||
$(MAKE) stack-down | ||
|
||
.PHONY: test-no-stack | ||
test-no-stack: ## run tests without starting the stack (if a dsp-stack is already running) | ||
pytest test/ | ||
|
||
.PHONY: test-end-to-end | ||
test-end-to-end: clean local-tmp clone-dsp-repo dsp-stack ## run e2e tests | ||
test-end-to-end: dsp-stack ## run e2e tests | ||
pytest test/e2e/ | ||
$(MAKE) stack-down | ||
|
||
.PHONY: test-end-to-end-no-stack | ||
test-end-to-end-no-stack: ## run e2e tests without starting the dsp-stack (if a dsp-stack is already running) | ||
pytest test/e2e/ | ||
|
||
.PHONY: test-unittests | ||
test-unittests: ## run unit tests | ||
pytest test/unittests/ | ||
|
||
.PHONY: local-tmp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now included at the only place where it is necessary: before cloning DSP-API. |
||
local-tmp: ## create local .tmp folder | ||
@mkdir -p $(CURRENT_DIR)/.tmp | ||
|
||
.PHONY: clean | ||
clean: ## clean local project directories | ||
@rm -rf $(CURRENT_DIR)/.tmp | ||
jnussbaum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@rm -rf dist/ build/ site/ knora.egg-info/ | ||
@rm -rf dist/ build/ site/ dsp_tools.egg-info/ | ||
|
||
.PHONY: help | ||
help: ## show this help | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort | ||
|
||
.PHONY: run | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command is not necessary, IMHO. |
||
run: ## create dist, install and run | ||
$(MAKE) clean | ||
$(MAKE) dist | ||
$(MAKE) install | ||
dsp-tools | ||
|
||
.PHONY: freeze-requirements | ||
freeze-requirements: ## update (dev-)requirements.txt and setup.py based on pipenv's Pipfile.lock | ||
pipenv requirements > requirements.txt | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ wheel = "*" | |
pipenv-setup = "*" | ||
pytest = "*" | ||
types-requests = "*" | ||
twine = "*" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two dependencies were "hidden" until now in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we use mkdocstrins at all - it's a Mkdocs plugin that generates documentation based on the docstrings in the source code... and we don't have that, as far as I know. So probably this could be removed, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed it, and GitHub CI runs through without errors. So I assume we really don't need it. |
||
mkdocstrings = "*" | ||
|
||
[requires] | ||
python_version = "3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted this command. It is better to include the dist-tools as dev-dependencies (in the dev-section of Pipfile). This way, they get installed when
make install-requirements
is executed. We don't need a separate command just to install the dist-tools.