2021-11-17 17:53:32 +01:00
|
|
|
.PHONY: test
|
|
|
|
|
2023-04-03 12:23:01 +02:00
|
|
|
all: format check
|
2020-09-03 03:06:53 +02:00
|
|
|
|
2023-08-19 07:38:04 +02:00
|
|
|
format: prettier black ruff
|
2020-09-03 03:06:53 +02:00
|
|
|
|
2023-12-12 11:13:58 +01:00
|
|
|
check: mypy pyright checkblack checkruff checkprettier checkbundle
|
2020-08-31 04:19:43 +02:00
|
|
|
|
2024-04-19 13:22:06 +02:00
|
|
|
test: test-unit test-wallets test-api test-regtest
|
|
|
|
|
2023-02-20 11:40:10 +01:00
|
|
|
prettier:
|
2024-04-25 11:13:08 +02:00
|
|
|
poetry run ./node_modules/.bin/prettier --write .
|
2020-08-29 19:10:26 +02:00
|
|
|
|
2023-01-23 10:29:17 +01:00
|
|
|
pyright:
|
2023-02-02 13:56:10 +01:00
|
|
|
poetry run ./node_modules/.bin/pyright
|
2023-01-23 10:29:17 +01:00
|
|
|
|
2022-08-03 14:10:32 +02:00
|
|
|
mypy:
|
|
|
|
poetry run mypy
|
2020-08-31 04:19:43 +02:00
|
|
|
|
2023-08-19 07:38:04 +02:00
|
|
|
black:
|
|
|
|
poetry run black .
|
2022-07-16 14:10:43 +02:00
|
|
|
|
2023-08-19 07:38:04 +02:00
|
|
|
ruff:
|
|
|
|
poetry run ruff check . --fix
|
|
|
|
|
|
|
|
checkruff:
|
|
|
|
poetry run ruff check .
|
2023-01-20 11:43:16 +01:00
|
|
|
|
2023-02-20 11:40:10 +01:00
|
|
|
checkprettier:
|
2024-04-25 11:13:08 +02:00
|
|
|
poetry run ./node_modules/.bin/prettier --check .
|
2020-09-03 03:06:53 +02:00
|
|
|
|
2022-08-03 14:10:32 +02:00
|
|
|
checkblack:
|
|
|
|
poetry run black --check .
|
2020-09-14 02:31:05 +02:00
|
|
|
|
2023-09-25 12:06:25 +02:00
|
|
|
checkeditorconfig:
|
|
|
|
editorconfig-checker
|
|
|
|
|
2023-08-03 09:53:36 +02:00
|
|
|
dev:
|
|
|
|
poetry run lnbits --reload
|
|
|
|
|
2024-04-19 13:22:06 +02:00
|
|
|
test-wallets:
|
2024-07-31 11:41:19 +02:00
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
2022-07-16 14:10:43 +02:00
|
|
|
LNBITS_BACKEND_WALLET_CLASS="FakeWallet" \
|
2021-11-17 17:53:32 +01:00
|
|
|
PYTHONUNBUFFERED=1 \
|
2022-08-17 15:57:56 +02:00
|
|
|
DEBUG=true \
|
2024-04-19 13:22:06 +02:00
|
|
|
poetry run pytest tests/wallets
|
2022-07-16 14:10:43 +02:00
|
|
|
|
2024-04-19 13:22:06 +02:00
|
|
|
test-unit:
|
2024-07-31 11:41:19 +02:00
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
2024-04-19 13:22:06 +02:00
|
|
|
LNBITS_BACKEND_WALLET_CLASS="FakeWallet" \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
DEBUG=true \
|
|
|
|
poetry run pytest tests/unit
|
|
|
|
|
|
|
|
test-api:
|
2024-07-31 11:41:19 +02:00
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
2024-04-19 13:22:06 +02:00
|
|
|
LNBITS_BACKEND_WALLET_CLASS="FakeWallet" \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
DEBUG=true \
|
|
|
|
poetry run pytest tests/api
|
|
|
|
|
|
|
|
test-regtest:
|
2024-07-31 11:41:19 +02:00
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
2022-07-16 14:10:43 +02:00
|
|
|
PYTHONUNBUFFERED=1 \
|
2022-08-17 15:57:56 +02:00
|
|
|
DEBUG=true \
|
2024-04-19 13:22:06 +02:00
|
|
|
poetry run pytest tests/regtest
|
2022-06-27 00:11:46 +02:00
|
|
|
|
2022-08-17 15:42:01 +02:00
|
|
|
test-migration:
|
2023-09-12 12:21:05 +02:00
|
|
|
LNBITS_ADMIN_UI=True \
|
2024-04-19 13:22:06 +02:00
|
|
|
make test-api
|
2022-08-17 15:42:01 +02:00
|
|
|
HOST=0.0.0.0 \
|
|
|
|
PORT=5002 \
|
2023-09-12 12:21:05 +02:00
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
2022-08-17 15:42:01 +02:00
|
|
|
timeout 5s poetry run lnbits --host 0.0.0.0 --port 5002 || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
|
|
|
|
HOST=0.0.0.0 \
|
|
|
|
PORT=5002 \
|
|
|
|
LNBITS_DATABASE_URL="postgres://lnbits:lnbits@localhost:5432/migration" \
|
|
|
|
timeout 5s poetry run lnbits --host 0.0.0.0 --port 5002 || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
|
2023-09-12 12:21:05 +02:00
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
2022-08-17 15:42:01 +02:00
|
|
|
LNBITS_DATABASE_URL="postgres://lnbits:lnbits@localhost:5432/migration" \
|
|
|
|
poetry run python tools/conv.py
|
|
|
|
|
|
|
|
migration:
|
|
|
|
poetry run python tools/conv.py
|
|
|
|
|
2023-07-19 13:28:27 +02:00
|
|
|
openapi:
|
|
|
|
LNBITS_BACKEND_WALLET_CLASS="FakeWallet" \
|
|
|
|
LNBITS_DATA_FOLDER="./tests/data" \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
HOST=0.0.0.0 \
|
|
|
|
PORT=5003 \
|
|
|
|
poetry run lnbits &
|
2023-08-28 11:59:56 +02:00
|
|
|
sleep 15
|
2023-07-19 13:28:27 +02:00
|
|
|
curl -s http://0.0.0.0:5003/openapi.json | poetry run openapi-spec-validator --errors=all -
|
|
|
|
# kill -9 %1
|
|
|
|
|
2022-06-27 00:11:46 +02:00
|
|
|
bak:
|
|
|
|
# LNBITS_DATABASE_URL=postgres://postgres:postgres@0.0.0.0:5432/postgres
|
2023-03-31 12:46:24 +02:00
|
|
|
#
|
|
|
|
|
2023-04-21 14:51:46 +02:00
|
|
|
sass:
|
|
|
|
npm run sass
|
|
|
|
|
2024-03-22 12:33:42 +01:00
|
|
|
bundle:
|
2023-03-31 12:46:24 +02:00
|
|
|
npm install
|
2023-04-21 14:51:46 +02:00
|
|
|
npm run sass
|
|
|
|
npm run vendor_copy
|
|
|
|
npm run vendor_json
|
|
|
|
poetry run ./node_modules/.bin/prettier -w ./lnbits/static/vendor.json
|
|
|
|
npm run vendor_bundle_css
|
|
|
|
npm run vendor_minify_css
|
|
|
|
npm run vendor_bundle_js
|
|
|
|
npm run vendor_minify_js
|
2023-12-19 11:22:05 +01:00
|
|
|
|
2023-11-28 10:39:21 +01:00
|
|
|
checkbundle:
|
|
|
|
cp lnbits/static/bundle.min.js lnbits/static/bundle.min.js.old
|
|
|
|
cp lnbits/static/bundle.min.css lnbits/static/bundle.min.css.old
|
2024-03-22 12:33:42 +01:00
|
|
|
make bundle
|
2023-11-28 10:39:21 +01:00
|
|
|
diff -q lnbits/static/bundle.min.js lnbits/static/bundle.min.js.old || exit 1
|
|
|
|
diff -q lnbits/static/bundle.min.css lnbits/static/bundle.min.css.old || exit 1
|
|
|
|
@echo "Bundle is OK"
|
|
|
|
rm lnbits/static/bundle.min.js.old
|
|
|
|
rm lnbits/static/bundle.min.css.old
|
|
|
|
|
2023-05-09 10:41:40 +02:00
|
|
|
install-pre-commit-hook:
|
|
|
|
@echo "Installing pre-commit hook to git"
|
|
|
|
@echo "Uninstall the hook with poetry run pre-commit uninstall"
|
|
|
|
poetry run pre-commit install
|
|
|
|
|
|
|
|
pre-commit:
|
|
|
|
poetry run pre-commit run --all-files
|