2017-12-25 21:17:47 +01:00
i n c l u d e M a k e f i l e . c o n f i g
2020-09-19 13:56:14 +02:00
- i n c l u d e . e n v
2017-12-25 21:17:47 +01:00
.SILENT :
make-p :
# Launch all P targets in parallel and exit as soon as one exits.
set -m; ( for p in $( P) ; do ( $( MAKE) $$ p || kill 0) & done ; wait )
2020-09-16 16:00:25 +02:00
build-client : lint -client
cd fittrackee_client && $( NPM) build
2018-06-20 15:27:52 +02:00
2021-01-02 19:28:03 +01:00
check-all : lint -all type -check test -python
2021-01-20 17:17:22 +01:00
clean :
rm -rf .mypy_cache
rm -rf .pytest_cache
clean-install : clean
2018-04-09 22:09:58 +02:00
rm -fr $( NODE_MODULES)
rm -fr $( VENV)
2020-09-19 13:56:14 +02:00
rm -rf *.egg-info
rm -rf dist/
2018-04-09 22:09:58 +02:00
2021-01-31 11:30:37 +01:00
## Docker commands for evaluation purposes
docker-build :
2021-10-16 19:22:23 +02:00
docker-compose -f docker-compose-dev.yml build fittrackee
docker-build-all : docker -build docker -build -client
docker-build-client :
docker-compose -f docker-compose-dev.yml build fittrackee_client
2021-01-31 11:30:37 +01:00
docker-init : docker -init -db docker -restart docker -run -workers
docker-init-db :
docker-compose -f docker-compose-dev.yml exec fittrackee docker/init-database.sh
docker-logs :
docker-compose -f docker-compose-dev.yml logs --follow
docker-rebuild :
docker-compose -f docker-compose-dev.yml build --no-cache
docker-restart :
docker-compose -f docker-compose-dev.yml restart fittrackee
docker-run-all : docker -run docker -run -workers
docker-run :
2021-10-16 19:22:23 +02:00
docker-compose -f docker-compose-dev.yml up -d fittrackee
2021-01-31 11:30:37 +01:00
docker-run-workers :
docker-compose -f docker-compose-dev.yml exec -d fittrackee docker/run-workers.sh
2021-10-16 19:22:23 +02:00
docker-serve-client :
docker-compose -f docker-compose-dev.yml up fittrackee_client -d
docker-compose -f docker-compose-dev.yml exec fittrackee_client react-scripts start
2021-01-31 11:30:37 +01:00
docker-shell :
docker-compose -f docker-compose-dev.yml exec fittrackee docker/shell.sh
docker-stop :
docker-compose -f docker-compose-dev.yml stop
docker-up :
2021-10-16 19:22:23 +02:00
docker-compose -f docker-compose-dev.yml up fittrackeee
2021-01-31 11:30:37 +01:00
2021-01-10 11:16:43 +01:00
downgrade-db :
$( FLASK) db downgrade --directory $( MIGRATIONS)
2019-07-14 14:47:07 +02:00
html :
2019-07-14 19:42:40 +02:00
rm -rf docsrc/build
2019-07-20 13:18:39 +02:00
rm -rf docs/*
touch docs/.nojekyll
2019-07-14 19:42:40 +02:00
$( SPHINXBUILD) -M html " $( SOURCEDIR) " " $( BUILDDIR) " $( SPHINXOPTS) $( O)
2019-07-21 10:30:37 +02:00
rm -rf docsrc/build/html/_static/bootstrap-2.3.2
rm -rf docsrc/build/html/_static/bootswatch-2.3.2
find docsrc/build/html/_static/bootswatch-3.3.7/. -maxdepth 1 -not -name flatly -not -name fonts -exec rm -rf '{}' \; 2>/tmp/NULL
sed -i "s/\@import url(\"https:\/\/fonts.googleapis.com\/css?family=Lato:400,700,400italic\");//" docsrc/build/html/_static/bootswatch-3.3.7/flatly/bootstrap.min.css
2019-07-14 19:42:40 +02:00
cp -a docsrc/build/html/. docs
2019-07-14 14:47:07 +02:00
2018-09-09 10:48:32 +02:00
install-db :
2020-09-16 15:41:02 +02:00
psql -U postgres -f db/create.sql
2018-09-09 10:48:32 +02:00
$( FLASK) db upgrade --directory $( MIGRATIONS)
2020-09-17 16:08:57 +02:00
$( FLASK) init-data
2018-09-09 10:48:32 +02:00
2019-11-13 18:40:01 +01:00
init-app-config :
$( FLASK) init-app-config
2018-01-07 11:44:56 +01:00
init-db :
2018-11-18 13:55:21 +01:00
$( FLASK) drop-db
2018-01-20 20:05:41 +01:00
$( FLASK) db upgrade --directory $( MIGRATIONS)
2020-09-17 16:08:57 +02:00
$( FLASK) init-data
2018-01-07 11:44:56 +01:00
install : install -client install -python
install-client :
2020-09-16 16:00:25 +02:00
cd fittrackee_client && $( NPM) install --prod
2018-06-20 13:23:47 +02:00
install-client-dev :
2020-09-19 13:56:14 +02:00
# https://github.com/facebook/create-react-app/issues/8688
cd fittrackee_client && $( NPM) install && sed -i '/process.env.CI/ s/isInteractive [|]*//' node_modules/react-scripts/scripts/start.js
2018-01-07 11:44:56 +01:00
2018-06-20 13:23:47 +02:00
install-dev : install -client -dev install -python -dev
2019-08-28 11:48:30 +02:00
install-python :
$( POETRY) install --no-dev
2018-06-20 13:23:47 +02:00
2019-08-28 11:48:30 +02:00
install-python-dev :
$( POETRY) install
2018-01-07 11:44:56 +01:00
2020-09-16 16:00:25 +02:00
lint-all : lint -python lint -client
2018-01-14 20:49:35 +01:00
2020-09-16 16:00:25 +02:00
lint-all-fix : lint -python -fix lint -client -fix
2019-08-28 15:33:50 +02:00
2020-09-16 16:00:25 +02:00
lint-client :
cd fittrackee_client && $( NPM) lint
2018-01-14 20:49:35 +01:00
2020-09-16 16:00:25 +02:00
lint-client-fix :
cd fittrackee_client && $( NPM) lint-fix
2019-08-28 15:33:50 +02:00
2021-01-02 19:28:03 +01:00
lint-python :
$( PYTEST) --flake8 --isort --black -m "flake8 or isort or black" fittrackee e2e --ignore= fittrackee/migrations
lint-python-fix :
$( BLACK) fittrackee e2e
2020-05-17 18:20:15 +02:00
mail :
docker run -d -e "MH_STORAGE=maildir" -v /tmp/maildir:/maildir -p 1025:1025 -p 8025:8025 mailhog/mailhog
2018-01-20 19:12:34 +01:00
migrate-db :
2018-01-21 17:43:13 +01:00
$( FLASK) db migrate --directory $( MIGRATIONS)
2018-01-20 19:12:34 +01:00
2019-01-06 16:01:44 +01:00
recalculate :
$( FLASK) recalculate
2018-06-20 15:27:52 +02:00
run :
2020-09-16 13:48:15 +02:00
$( MAKE) P = "run-server run-workers" make-p
2018-06-20 15:27:52 +02:00
run-server :
2021-01-20 17:17:22 +01:00
echo 'Running on http://$(HOST):$(PORT)'
cd fittrackee && $( GUNICORN) -b $( HOST) :$( PORT) "fittrackee:create_app()" --error-logfile ../gunicorn.log
2018-06-20 15:27:52 +02:00
2020-07-14 22:03:56 +02:00
run-workers :
2020-07-15 15:30:41 +02:00
$( FLASK) worker --processes= $( WORKERS_PROCESSES) >> dramatiq.log 2>& 1
2020-07-14 22:03:56 +02:00
2021-01-02 19:28:03 +01:00
serve :
$( MAKE) P = "serve-client serve-python" make-p
2017-12-25 21:17:47 +01:00
2021-01-02 19:28:03 +01:00
serve-dev :
$( MAKE) P = "serve-client serve-python-dev" make-p
2019-11-13 12:57:36 +01:00
2020-09-16 16:00:25 +02:00
serve-client :
cd fittrackee_client && $( NPM) start
2017-12-25 21:17:47 +01:00
2021-01-02 19:28:03 +01:00
serve-python :
2021-06-26 22:18:08 +02:00
echo 'Running on http://$(HOST):$(PORT)'
2021-01-02 19:28:03 +01:00
$( FLASK) run --with-threads -h $( HOST) -p $( PORT)
2018-01-01 11:10:39 +01:00
2021-01-02 19:28:03 +01:00
serve-python-dev :
2021-06-26 22:18:08 +02:00
echo 'Running on https://$(HOST):$(PORT)'
2021-01-02 19:28:03 +01:00
$( FLASK) run --with-threads -h $( HOST) -p $( PORT) --cert= adhoc
2019-11-13 12:57:36 +01:00
2018-05-20 20:30:30 +02:00
test-e2e : init -db
2020-09-16 15:41:02 +02:00
$( PYTEST) e2e --driver firefox $( PYTEST_ARGS)
2020-09-13 21:39:44 +02:00
test-e2e-client : init -db
E2E_ARGS = client $( PYTEST) e2e --driver firefox $( PYTEST_ARGS)
2018-01-07 11:44:56 +01:00
2018-01-01 11:10:39 +01:00
test-python :
2020-09-16 15:41:02 +02:00
$( PYTEST) fittrackee --cov-config .coveragerc --cov= fittrackee --cov-report term-missing $( PYTEST_ARGS)
2018-01-20 19:12:34 +01:00
2021-01-02 19:28:03 +01:00
type-check :
echo 'Running mypy...'
2021-01-31 18:40:20 +01:00
$( MYPY) fittrackee
2021-01-02 19:28:03 +01:00
2018-01-20 19:12:34 +01:00
upgrade-db :
2018-01-20 20:05:41 +01:00
$( FLASK) db upgrade --directory $( MIGRATIONS)