Skip to content

Instantly share code, notes, and snippets.

@fodra
Created March 28, 2018 22:42
Show Gist options
  • Save fodra/0bf35a5846fa1e6cc9a84beb745d7dce to your computer and use it in GitHub Desktop.
Save fodra/0bf35a5846fa1e6cc9a84beb745d7dce to your computer and use it in GitHub Desktop.
A sample makefile
# Shortcuts for doing stuff in gametraka_project_v3
.PHONY : clean help build redisq gui devdeps dev clean run requirements test
help:
@echo "lint - check style with flake8 and isort"
@echo "devdeps - runs rqworker and gui front-end"
@echo "dev - runs gametraka on localhost"
@echo "test - runs test suite"
@echo "clean - deletes temporary files"
@echo "ci - runs the test suite with code coverage report"
build: clean requirements database
redisq:
python manage.py rqworker &
gui:
cd frontend && yarn run b &
guid:
cd frontend && yarn run bdemo &
devdeps: redisq gui
devdepsdemo: redisq guid
dev:
python manage.py runserver
dev_open:
python manage.py runserver 0.0.0.0:8000
run: redisq gui dev
lint:
flake8 apps --ignore=E501,F403
isort --check-only --diff --recursive apps
clean :
-find . -type f -name "*.pyc" -delete
-find . -type f -name "*.orig" -delete
-find . -type d -name "__pycache__" -delete
requirements:
pip install -r requirements.txt && pip install -r dev-requirements.txt || (echo "requirements step failed $$?"; exit 1)
db_files:
python manage.py makemigrations
db_apply:
python manage.py migrate
python manage.py sync_plans
database: db_files db_apply
test_events:
python manage.py test apps.events.tests
test_playing_fields:
python manage.py test apps.playing_fields.tests
test_stats:
python manage.py test apps.stats.tests
test_teams:
python manage.py test apps.teams.tests
test_users:
python manage.py test apps.users.tests
test:
python manage.py test || (echo "test failed $$?"; exit 1)
coverage:
coverage run --source='.' manage.py test
coverage html
ci:
coverage run --source='.' manage.py test || (echo "test failed $$?"; exit 1)
coverage report 2>&1 | tee coverage.txt
codecov --token=18d796eb-66d5-43c5-b8da-2c46a6b802ba
integration:
python manage.py migrate
python manage.py sync_plans
python manage.py rqworker &
cd frontend && yarn install && yarn run bp && cd ../
python manage.py runserver &
python ./frontend/tests/00_frontend_test_suite.py || (echo "test failed $$?"; exit 1)
profile:
-find . -type f -name "*.prof" -delete
-find . -type d -name "profile-data" -delete
mkdir profile-data
python manage.py runprofileserver --use-cprofile --prof-path=profile-data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment