mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
There's a few advantages of using ruff over these tools: * It's way faster * It's easier to configure * It includes support for a bunch of other linters (for example bugbear) right out of the box, which catches some things and makes our code more consistent. Ruff works great with black, which I'd recommend we continue using. Fixed a few minor issues that the new linter combo picked up.
63 lines
1.4 KiB
Makefile
63 lines
1.4 KiB
Makefile
.PHONY: compose_build up test_db create_database clean down tests lint backend-unit-tests frontend-unit-tests test build watch start redis-cli bash
|
|
|
|
compose_build: .env
|
|
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose build
|
|
|
|
up:
|
|
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up -d --build
|
|
|
|
test_db:
|
|
@for i in `seq 1 5`; do \
|
|
if (docker-compose exec postgres sh -c 'psql -U postgres -c "select 1;"' 2>&1 > /dev/null) then break; \
|
|
else echo "postgres initializing..."; sleep 5; fi \
|
|
done
|
|
docker-compose exec postgres sh -c 'psql -U postgres -c "drop database if exists tests;" && psql -U postgres -c "create database tests;"'
|
|
|
|
create_database: .env
|
|
docker-compose run server create_db
|
|
|
|
clean:
|
|
docker-compose down && docker-compose rm
|
|
|
|
down:
|
|
docker-compose down
|
|
|
|
.env:
|
|
printf "REDASH_COOKIE_SECRET=`pwgen -1s 32`\nREDASH_SECRET_KEY=`pwgen -1s 32`\n" >> .env
|
|
|
|
env: .env
|
|
|
|
format:
|
|
pre-commit run --all-files
|
|
|
|
tests:
|
|
docker-compose run server tests
|
|
|
|
lint:
|
|
ruff check .
|
|
black --check . --diff
|
|
|
|
backend-unit-tests: up test_db
|
|
docker-compose run --rm --name tests server tests
|
|
|
|
frontend-unit-tests:
|
|
CYPRESS_INSTALL_BINARY=0 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 yarn --frozen-lockfile
|
|
yarn test
|
|
|
|
test: backend-unit-tests frontend-unit-tests lint
|
|
|
|
build:
|
|
yarn build
|
|
|
|
watch:
|
|
yarn watch
|
|
|
|
start:
|
|
yarn start
|
|
|
|
redis-cli:
|
|
docker-compose run --rm redis redis-cli -h redis
|
|
|
|
bash:
|
|
docker-compose run --rm server bash
|