From 6c4989d8a0841953f1e253b59bae77f5345592d2 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Sun, 31 Dec 2017 14:34:41 +0200 Subject: [PATCH] Replace Makefile with scripts --- Makefile | 21 --------------------- bin/docker-entrypoint | 5 ++++- bin/pack | 8 ++++++++ circle.yml | 10 ++++------ 4 files changed, 16 insertions(+), 28 deletions(-) delete mode 100644 Makefile create mode 100755 bin/pack diff --git a/Makefile b/Makefile deleted file mode 100644 index 93bafdaba..000000000 --- a/Makefile +++ /dev/null @@ -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) diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint index 5121103ef..da7033d8b 100755 --- a/bin/docker-entrypoint +++ b/bin/docker-entrypoint @@ -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 ;; *) diff --git a/bin/pack b/bin/pack new file mode 100755 index 000000000..e53b5f903 --- /dev/null +++ b/bin/pack @@ -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" * \ No newline at end of file diff --git a/circle.yml b/circle.yml index 45c1301ac..106682964 100644 --- a/circle.yml +++ b/circle.yml @@ -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/\+/./")