#505 Add Makefile to simplify executing some actions
Merged 4 years ago by gnaponie. Opened 4 years ago by lholecek.
lholecek/greenwave add-makefile  into  master

file added
+65
@@ -0,0 +1,65 @@ 

+ COMPOSE := docker-compose

+ BROWSER := xdg-open

+ 

+ all: help

+ 

+ help:

+ 	@echo 'Usage:'

+ 	@echo

+ 	@echo '  make up - starts containers in docker-compose environment'

+ 	@echo

+ 	@echo '  make down - stops containers in docker-compose environment'

+ 	@echo

+ 	@echo '  make build - builds container images for docker-compose environment'

+ 	@echo

+ 	@echo '  make recreate - recreates containers for docker-compose environment'

+ 	@echo

+ 	@echo '  make exec [CMD=".."] - executes command in dev container'

+ 	@echo

+ 	@echo '  make sudo [CMD=".."] - executes command in dev container under root user'

+ 	@echo

+ 	@echo '  make pytest [ARGS=".."] - executes pytest with given arguments in dev container'

+ 	@echo

+ 	@echo '  make flake8 - executes flake8 in dev container'

+ 	@echo

+ 	@echo '  make pylint - executes pylint in dev container'

+ 	@echo

+ 	@echo '  make test - alias for "make pytest flake8 pylint"'

+ 	@echo

+ 	@echo '  make coverage [ARGS=".."] - generates and shows test code coverage'

+ 

+ up:

+ 	$(COMPOSE) up -d

+ 

+ down:

+ 	$(COMPOSE) down

+ 

+ build:

+ 	$(COMPOSE) build

+ 

+ recreate:

+ 	$(COMPOSE) up -d --force-recreate

+ 

+ # Executes CMD in dev container.

+ # Usage: make exec CMD="python3 -m pytest -x"

+ exec: up

+ 	$(COMPOSE) exec dev bash -c '$(CMD)'

+ 

+ sudo: up

+ 	$(COMPOSE) exec -u root dev bash -c '$(CMD)'

+ 

+ test: pytest flake8 pylint

+ 

+ pytest:

+ 	$(MAKE) exec \

+ 	    CMD="pip3 install --user -r dev-requirements.txt && COVERAGE_FILE=/home/dev/.coverage python3 -m pytest $(ARGS)"

+ 

+ flake8:

+ 	python -m flake8

+ 

+ pylint:

+ 	python -m pylint greenwave/

+ 

+ coverage:

+ 	$(MAKE) pytest ARGS="--cov-config .coveragerc --cov=greenwave --cov-report html:/home/dev/htmlcov $(ARGS)"

+ 	$(BROWSER) docker/home/htmlcov/index.html

file modified
+2
@@ -4,6 +4,8 @@ 

  Quickstart

  ----------

  

+ **Quick Tip:** Use `make` to run frequent commands mentioned below.

+ 

  Start local development containers of ResultsDB and WaiverDB using

  ``docker-compose``. If you want the containers to run in the foreground, omit

  the ``-d`` flag. If you want to create the containers again (after some code

Why not to put this "python3 -m pytest -x" in makefile itself?

Why not to put this "python3 -m pytest -x" in makefile itself?

That requires settings up waiverdb and resultsdb on the machine where the make/pytest is run (for functional tests).

Nice! Doesn't need a bit of documentation?
anyhow +1

rebased onto c7d9662

4 years ago

Updated: make prints help and it's mentioned in the docs.

Pull-Request has been merged by gnaponie

4 years ago
Metadata