Replace Makefile with scripts

This commit is contained in:
Arik Fraimovich
2017-12-31 14:34:41 +02:00
parent 9323a93a8d
commit 6c4989d8a0
4 changed files with 16 additions and 28 deletions

View File

@@ -1,21 +0,0 @@
NAME=redash
VERSION=`python ./manage.py version`
FULL_VERSION=$(VERSION)+b$(CIRCLE_BUILD_NUM)
BASE_VERSION=$(shell python ./manage.py version | cut -d + -f 1)
# VERSION gets evaluated every time it's referenced, therefore we need to use VERSION here instead of FULL_VERSION.
FILENAME=$(CIRCLE_ARTIFACTS)/$(NAME).$(VERSION).tar.gz
TEST_ARGS?=tests/
deps:
if [ -d "./client/app" ]; then npm install; fi
if [ -d "./client/app" ]; then npm run build; fi
pack:
sed -ri "s/^__version__ = '([0-9.]*)'/__version__ = '$(FULL_VERSION)'/" redash/__init__.py
tar -zcv -f $(FILENAME) --exclude="optipng*" --exclude=".git*" --exclude="*.pyc" --exclude="*.pyo" --exclude="venv" --exclude="node_modules" *
upload:
python bin/release_manager.py $(CIRCLE_SHA1) $(BASE_VERSION) $(FILENAME)
test:
pytest $(TEST_ARGS)

View File

@@ -36,11 +36,13 @@ help() {
echo "dev_server -- start Flask development server with debugger and auto reload"
echo "create_db -- create database tables"
echo "manage -- CLI to manage redash"
echo "tests -- run tests"
}
tests() {
export REDASH_DATABASE_URL="postgresql://postgres@postgres/tests"
exec make test
TEST_ARGS=${TEST_ARGS:-tests/}
exec pytest $TEST_ARGS
}
case "$1" in
@@ -73,6 +75,7 @@ case "$1" in
tests
;;
help)
shift
help
;;
*)

8
bin/pack Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
NAME=redash
VERSION=$(python ./manage.py version)
FULL_VERSION=$(VERSION)+b$(CIRCLE_BUILD_NUM)
FILENAME=$(CIRCLE_ARTIFACTS)/$(NAME).$($FULL_VERSION).tar.gz
sed -ri "s/^__version__ = '([0-9.]*)'/__version__ = '$(FULL_VERSION)'/" redash/__init__.py
tar -zcv -f $(FILENAME) --exclude="optipng*" --exclude=".git*" --exclude="*.pyc" --exclude="*.pyo" --exclude="venv" --exclude="node_modules" *

View File

@@ -10,7 +10,8 @@ dependencies:
- pip install --upgrade setuptools
- pip install -r requirements_dev.txt
- pip install -r requirements.txt
- make deps
- npm install
- npm run build
cache_directories:
- node_modules/
test:
@@ -20,11 +21,8 @@ deployment:
github_and_docker:
branch: [master, /release.*/]
commands:
- make pack
# Skipping uploads for now, until master is stable.
# - make upload
#- echo "client/app" >> .dockerignore
#- docker pull redash/redash:latest
- bin/pack
# - python bin/release_manager.py $(CIRCLE_SHA1) $(BASE_VERSION) $(FILENAME)
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker build -t redash/redash:$(./manage.py version | sed -e "s/\+/./") .
- docker push redash/redash:$(./manage.py version | sed -e "s/\+/./")