2017-12-25 21:17:47 +01:00
|
|
|
include Makefile.config
|
2020-09-19 13:56:14 +02:00
|
|
|
-include .env
|
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)
|
|
|
|
|
2022-07-02 19:25:07 +02:00
|
|
|
babel-extract:
|
|
|
|
$(PYBABEL) extract -F babel.cfg -k lazy_gettext -o messages.pot .
|
|
|
|
|
|
|
|
babel-init:
|
|
|
|
$(PYBABEL) init -i messages.pot -d fittrackee/emails/translations -l $(LANG)
|
|
|
|
|
|
|
|
babel-compile:
|
|
|
|
$(PYBABEL) compile -d fittrackee/emails/translations
|
|
|
|
|
|
|
|
babel-update:
|
|
|
|
$(PYBABEL) update -i messages.pot -d fittrackee/emails/translations
|
|
|
|
|
2022-05-28 20:01:14 +02:00
|
|
|
bandit:
|
|
|
|
$(BANDIT) -r fittrackee -c pyproject.toml
|
|
|
|
|
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
|
|
|
|
2023-11-12 16:37:32 +01:00
|
|
|
check-all: bandit lint-all type-check-all test-all
|
2022-03-27 09:48:36 +02:00
|
|
|
|
2023-11-12 16:37:32 +01:00
|
|
|
check-client: lint-client type-check-client test-client
|
2021-01-02 19:28:03 +01:00
|
|
|
|
2022-05-28 20:01:14 +02:00
|
|
|
check-python: bandit lint-python type-check test-python
|
2021-12-01 19:22:47 +01:00
|
|
|
|
2021-01-20 17:17:22 +01:00
|
|
|
clean:
|
|
|
|
rm -rf .mypy_cache
|
|
|
|
rm -rf .pytest_cache
|
2022-02-05 12:45:08 +01:00
|
|
|
rm -rf e2e/.pytest_cache
|
2021-01-20 17:17:22 +01:00
|
|
|
|
|
|
|
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
|
2022-10-26 01:38:55 +02:00
|
|
|
docker-bandit:
|
2023-06-21 17:20:27 +02:00
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee bandit -r fittrackee -c pyproject.toml
|
2022-10-26 01:38:55 +02:00
|
|
|
|
2021-01-31 11:30:37 +01:00
|
|
|
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
|
|
|
|
2022-10-26 01:38:55 +02:00
|
|
|
docker-check-all: docker-bandit docker-lint-all docker-type-check docker-test-client docker-test-python
|
|
|
|
|
2023-03-14 05:51:05 +01:00
|
|
|
docker-downgrade-db:
|
2023-06-21 17:20:27 +02:00
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee flask db downgrade --directory $(DOCKER_MIGRATIONS)
|
2023-03-14 05:51:05 +01:00
|
|
|
|
2022-07-23 11:30:10 +02:00
|
|
|
docker-init: docker-run docker-init-db docker-restart docker-run-workers
|
2021-01-31 11:30:37 +01:00
|
|
|
|
|
|
|
docker-init-db:
|
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee docker/init-database.sh
|
|
|
|
|
2022-10-26 01:38:55 +02:00
|
|
|
docker-lint-all: docker-lint-client docker-lint-python
|
|
|
|
|
2022-07-20 10:08:01 +02:00
|
|
|
docker-lint-client:
|
|
|
|
docker-compose -f docker-compose-dev.yml up -d fittrackee_client
|
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee_client yarn lint
|
|
|
|
|
|
|
|
docker-lint-python: docker-run
|
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee docker/lint-python.sh
|
|
|
|
|
2021-01-31 11:30:37 +01:00
|
|
|
docker-logs:
|
|
|
|
docker-compose -f docker-compose-dev.yml logs --follow
|
|
|
|
|
2022-10-25 23:27:05 +02:00
|
|
|
docker-migrate-db:
|
2023-06-21 17:20:27 +02:00
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee flask db migrate --directory $(DOCKER_MIGRATIONS)
|
2022-10-25 23:27:05 +02:00
|
|
|
|
2021-01-31 11:30:37 +01:00
|
|
|
docker-rebuild:
|
|
|
|
docker-compose -f docker-compose-dev.yml build --no-cache
|
|
|
|
|
|
|
|
docker-restart:
|
|
|
|
docker-compose -f docker-compose-dev.yml restart fittrackee
|
2023-02-16 10:24:32 +01:00
|
|
|
docker-compose -f docker-compose-dev.yml exec -d fittrackee docker/run-workers.sh
|
2021-01-31 11:30:37 +01:00
|
|
|
|
2022-10-25 23:27:05 +02:00
|
|
|
docker-revision:
|
2023-06-21 17:20:27 +02:00
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee flask db revision --directory $(DOCKER_MIGRATIONS) --message $(MIGRATION_MESSAGE)
|
2022-10-25 23:27:05 +02:00
|
|
|
|
2021-01-31 11:30:37 +01:00
|
|
|
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:
|
2021-10-18 17:28:48 +02:00
|
|
|
docker-compose -f docker-compose-dev.yml up -d fittrackee_client
|
2023-11-15 14:57:27 +01:00
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee_client yarn dev
|
2021-10-16 19:22:23 +02:00
|
|
|
|
2022-02-13 09:45:51 +01:00
|
|
|
docker-set-admin:
|
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee docker/set-admin.sh $(USERNAME)
|
|
|
|
|
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
|
|
|
|
|
2022-07-20 10:08:01 +02:00
|
|
|
docker-test-client:
|
|
|
|
docker-compose -f docker-compose-dev.yml up -d fittrackee_client
|
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee_client yarn test:unit
|
|
|
|
|
|
|
|
# needs a running application
|
|
|
|
docker-test-e2e: docker-run
|
|
|
|
docker-compose -f docker-compose-dev.yml up -d selenium
|
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee docker/test-e2e.sh $(PYTEST_ARGS)
|
|
|
|
|
|
|
|
docker-test-python: docker-run
|
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee docker/test-python.sh $(PYTEST_ARGS)
|
|
|
|
|
2022-10-26 01:38:55 +02:00
|
|
|
docker-type-check:
|
|
|
|
echo 'Running mypy in docker...'
|
2023-06-21 17:20:27 +02:00
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee mypy fittrackee
|
2022-10-26 01:38:55 +02:00
|
|
|
|
2021-01-31 11:30:37 +01:00
|
|
|
docker-up:
|
2022-06-05 11:08:53 +02:00
|
|
|
docker-compose -f docker-compose-dev.yml up fittrackee
|
2021-01-31 11:30:37 +01:00
|
|
|
|
2022-10-25 23:27:05 +02:00
|
|
|
docker-upgrade-db:
|
2023-06-21 17:20:27 +02:00
|
|
|
docker-compose -f docker-compose-dev.yml exec fittrackee ftcli db upgrade
|
2022-10-25 23:27:05 +02:00
|
|
|
|
2021-01-10 11:16:43 +01:00
|
|
|
downgrade-db:
|
|
|
|
$(FLASK) db downgrade --directory $(MIGRATIONS)
|
|
|
|
|
2023-06-18 15:23:33 +02:00
|
|
|
gettext:
|
|
|
|
$(SPHINXBUILD) -M gettext "$(SOURCEDIR)" "$(DOCSRC)"
|
|
|
|
|
|
|
|
LANGUAGE := en
|
2019-07-14 14:47:07 +02:00
|
|
|
html:
|
2023-06-18 15:23:33 +02:00
|
|
|
rm -rf $(BUILDDIR)/$(LANGUAGE)
|
|
|
|
rm -rf docs/$(LANGUAGE)/*
|
|
|
|
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)/$(LANGUAGE)" -D language=$(LANGUAGE)
|
2023-06-28 08:44:42 +02:00
|
|
|
grep -rl "fosstodon.org" $(BUILDDIR)/$(LANGUAGE)/html/ | xargs sed -i "s/href=\"https:\/\/fosstodon.org\/\@FitTrackee\"/rel=\"me\" href=\"https:\/\/fosstodon.org\/\@FitTrackee\"/"
|
2023-06-18 15:23:33 +02:00
|
|
|
cp -a $(BUILDDIR)/$(LANGUAGE)/html/. docs/$(LANGUAGE)
|
|
|
|
|
|
|
|
html-all:
|
|
|
|
for language in en fr ; do \
|
|
|
|
echo -e "\r\nGenerating documentation for '$$language'...\r\n" ; \
|
|
|
|
$(MAKE) html LANGUAGE=$$language ; \
|
|
|
|
done
|
|
|
|
|
2023-06-18 20:45:39 +02:00
|
|
|
html-update-po:
|
2023-06-18 15:23:33 +02:00
|
|
|
$(SPHINXINTL) update -p "$(GETTEXT)" -d "$(LOCALES_DIRS)" -l $(LANGUAGE)
|
|
|
|
|
2023-06-18 20:45:39 +02:00
|
|
|
html-update-po-all:
|
2023-06-18 15:23:33 +02:00
|
|
|
for language in en fr ; do \
|
|
|
|
echo -e "\r\nUpdating .po files for '$$language'...\r\n" ; \
|
2023-06-18 20:45:39 +02:00
|
|
|
$(MAKE) html-update-po LANGUAGE=$$language ; \
|
2023-06-18 15:23:33 +02:00
|
|
|
done
|
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
|
2022-04-23 11:21:14 +02:00
|
|
|
$(FTCLI) db upgrade
|
2019-11-13 18:40:01 +01:00
|
|
|
|
2018-01-07 11:44:56 +01:00
|
|
|
init-db:
|
2022-04-23 11:21:14 +02:00
|
|
|
$(FTCLI) db drop
|
|
|
|
$(FTCLI) db upgrade
|
2018-01-07 11:44:56 +01:00
|
|
|
|
|
|
|
install: install-client install-python
|
|
|
|
|
|
|
|
install-client:
|
2022-05-18 09:49:46 +02:00
|
|
|
# NPM_ARGS="--ignore-engines", if errors with Node latest version
|
|
|
|
cd fittrackee_client && $(NPM) install --prod $(NPM_ARGS)
|
2018-06-20 13:23:47 +02:00
|
|
|
|
|
|
|
install-client-dev:
|
2022-05-18 09:49:46 +02:00
|
|
|
# NPM_ARGS="--ignore-engines", if errors with Node latest version
|
|
|
|
cd fittrackee_client && $(NPM) install $(NPM_ARGS)
|
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:
|
2023-11-11 15:23:04 +01:00
|
|
|
cd fittrackee_client && $(NPM) format
|
2019-08-28 15:33:50 +02:00
|
|
|
|
2021-01-02 19:28:03 +01:00
|
|
|
lint-python:
|
2023-06-14 20:58:47 +02:00
|
|
|
$(PYTEST) --isort --black -m "isort or black" fittrackee e2e --ignore=fittrackee/migrations
|
|
|
|
echo 'Running flake8...'
|
|
|
|
$(FLAKE8) fittrackee e2e
|
2021-01-02 19:28:03 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
2021-09-01 14:05:45 +02:00
|
|
|
revision:
|
|
|
|
$(FLASK) db revision --directory $(MIGRATIONS) --message $(MIGRATION_MESSAGE)
|
|
|
|
|
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:
|
2022-11-27 12:06:42 +01:00
|
|
|
# for dev environments
|
2021-01-02 19:28:03 +01:00
|
|
|
$(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:
|
2022-11-27 12:06:42 +01:00
|
|
|
# for dev environments
|
2021-01-02 19:28:03 +01:00
|
|
|
$(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:
|
2022-11-27 12:06:42 +01:00
|
|
|
# for dev environments
|
2023-11-11 15:23:04 +01:00
|
|
|
cd fittrackee_client && PORT=3000 $(NPM) dev
|
2017-12-25 21:17:47 +01:00
|
|
|
|
2021-01-02 19:28:03 +01:00
|
|
|
serve-python:
|
2022-11-27 12:06:42 +01:00
|
|
|
# for dev environments
|
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:
|
2022-11-27 12:06:42 +01:00
|
|
|
# for dev environments (
|
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
|
|
|
|
2022-02-12 14:30:59 +01:00
|
|
|
set-admin:
|
2022-04-23 14:08:51 +02:00
|
|
|
echo "Deprecated command, will be removed in a next version. Use 'user-set-admin' instead."
|
2022-04-23 13:48:29 +02:00
|
|
|
$(FTCLI) users update $(USERNAME) --set-admin true
|
2022-02-12 14:30:59 +01:00
|
|
|
|
2022-07-20 10:08:01 +02:00
|
|
|
test-all: test-client test-python
|
|
|
|
|
2022-03-23 09:36:23 +01:00
|
|
|
test-e2e:
|
2020-09-16 15:41:02 +02:00
|
|
|
$(PYTEST) e2e --driver firefox $(PYTEST_ARGS)
|
2020-09-13 21:39:44 +02:00
|
|
|
|
2022-03-23 09:36:23 +01:00
|
|
|
test-e2e-client:
|
2020-09-13 21:39:44 +02:00
|
|
|
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:
|
2022-11-19 20:17:58 +01:00
|
|
|
# for tests parallelization: 4 workers max.
|
|
|
|
# make test-python PYTEST_ARGS="-p no:warnings -n auto --maxprocesses=4"
|
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-09-04 19:24:39 +02:00
|
|
|
test-client:
|
2023-11-12 16:37:32 +01:00
|
|
|
cd fittrackee_client && $(NPM) test:unit run
|
|
|
|
|
|
|
|
test-client-watch:
|
|
|
|
cd fittrackee_client && $(NPM) test:unit watch
|
2021-09-04 19:24:39 +02: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
|
|
|
|
2023-11-12 16:37:32 +01:00
|
|
|
type-check-all: type-check-client type-check
|
|
|
|
|
2023-11-11 15:23:04 +01:00
|
|
|
type-check-client:
|
|
|
|
cd fittrackee_client && $(NPM) type-check
|
|
|
|
|
2018-01-20 19:12:34 +01:00
|
|
|
upgrade-db:
|
2022-04-23 11:21:14 +02:00
|
|
|
$(FTCLI) db upgrade
|
2022-04-23 14:08:51 +02:00
|
|
|
|
|
|
|
user-activate:
|
|
|
|
$(FTCLI) users update $(USERNAME) --activate
|
|
|
|
|
|
|
|
user-reset-password:
|
|
|
|
$(FTCLI) users update $(USERNAME) --reset-password
|
|
|
|
|
|
|
|
ADMIN := true
|
|
|
|
user-set-admin:
|
|
|
|
$(FTCLI) users update $(USERNAME) --set-admin $(ADMIN)
|
|
|
|
|
|
|
|
user-update-email:
|
|
|
|
$(FTCLI) users update $(USERNAME) --update-email $(EMAIL)
|