Compare commits

...

3 Commits

Author SHA1 Message Date
Arik Fraimovich
1258223a50 Update version 2018-09-17 21:52:46 +03:00
Arik Fraimovich
6e896792b8 Settings fix 2018-09-17 21:48:08 +03:00
Arik Fraimovich
ac73d202fb CircleCI support 2018-09-17 21:47:27 +03:00
8 changed files with 170 additions and 3 deletions

126
.circleci/config.yml Normal file
View File

@@ -0,0 +1,126 @@
version: 2.0
jobs:
unit-tests:
environment:
COMPOSE_FILE: .circleci/docker-compose.circle.yml
COMPOSE_PROJECT_NAME: redash
docker:
- image: circleci/buildpack-deps:xenial
steps:
- setup_remote_docker
- checkout
- run:
name: Build Docker Images
command: |
set -x
docker-compose up -d
sleep 10
- run:
name: Create Test Database
command: docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests;"
- run:
name: Run Tests
command: docker-compose run --name tests redash tests --junitxml=junit.xml tests/
- run:
name: Copy Test Results
command: |
mkdir -p /tmp/test-results/unit-tests
docker cp tests:/app/coverage.xml ./coverage.xml
docker cp tests:/app/junit.xml /tmp/test-results/unit-tests/results.xml
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: coverage.xml
build-tarball:
docker:
- image: circleci/node:8
steps:
- checkout
- run: npm install
- run: npm run build
- run: .circleci/update_version
- run: .circleci/pack
- store_artifacts:
path: /tmp/artifacts/
build-docker-image:
docker:
- image: circleci/buildpack-deps:xenial
steps:
- setup_remote_docker
- checkout
- run: .circleci/update_version
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: docker build -t redash/redash:$(.circleci/docker_tag) .
- run: docker push redash/redash:$(.circleci/docker_tag)
integration-tests:
working_directory: ~/redash
machine: true
environment:
REDASH_SERVER_URL : "http://127.0.0.1:5000/"
DOCKER_IMAGE: mozilla/redash-ui-tests
steps:
- checkout
- run:
name: Install Docker Compose
command: |
set -x
pip install --upgrade pip
pip install docker-compose>=1.18
docker-compose --version
- run:
name: Pull redash images
command: |
set -x
docker-compose -f docker-compose.yml up --no-start
sleep 10
- run:
name: Pull redash-ui-tests
command: docker pull "${DOCKER_IMAGE}":latest
- run:
name: Setup redash instance
command: |
set -x
docker-compose run --rm --user root server create_db
docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests"
docker-compose run --rm --user root server /app/manage.py users create_root root@example.com "rootuser" --password "IAMROOT" --org default
docker-compose run --rm --user root server /app/manage.py ds new "ui-tests" --type "url" --options '{"title": "uitests"}'
docker-compose run -d -p 5000:5000 --user root server
docker-compose start postgres
docker-compose run --rm --user root server npm install
docker-compose run --rm --user root server npm run build
- run:
name: Run tests
command: |
set -x
docker run --net="host" --env REDASH_SERVER_URL="${REDASH_SERVER_URL}" "${DOCKER_IMAGE}"
- store_artifacts:
path: report.html
workflows:
version: 2
integration_tests:
jobs:
- integration-tests:
filters:
branches:
only: master
build:
jobs:
- unit-tests
- build-tarball:
requires:
- unit-tests
filters:
tags:
only: /v[0-9]+(\.[0-9\-a-z]+)*/
branches:
only:
- master
- release
- build-docker-image:
requires:
- unit-tests
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9\-a-z]+)*/

View File

@@ -0,0 +1,22 @@
version: '2'
services:
redash:
build: ../
command: manage version
depends_on:
- postgres
- redis
ports:
- "5000:5000"
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
redis:
image: redis:3.0-alpine
restart: unless-stopped
postgres:
image: postgres:9.5.6-alpine
command: "postgres -c fsync=off -c full_page_writes=off -c synchronous_commit=OFF"
restart: unless-stopped

5
.circleci/docker_tag Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
VERSION=$(jq -r .version package.json)
FULL_VERSION=$VERSION.b$CIRCLE_BUILD_NUM
echo $FULL_VERSION

9
.circleci/pack Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
NAME=redash
VERSION=$(jq -r .version package.json)
FULL_VERSION=$VERSION+b$CIRCLE_BUILD_NUM
FILENAME=$NAME.$FULL_VERSION.tar.gz
mkdir -p /tmp/artifacts/
tar -zcv -f /tmp/artifacts/$FILENAME --exclude="optipng*" --exclude=".git*" --exclude="*.pyc" --exclude="*.pyo" --exclude="venv" --exclude="node_modules" *

5
.circleci/update_version Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
VERSION=$(jq -r .version package.json)
FULL_VERSION=$VERSION+b$CIRCLE_BUILD_NUM
sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '$FULL_VERSION'/" redash/__init__.py

View File

@@ -1,6 +1,6 @@
{ {
"name": "redash-client", "name": "redash-client",
"version": "4.0.1", "version": "4.0.2",
"description": "The frontend part of Redash.", "description": "The frontend part of Redash.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@@ -19,7 +19,7 @@ from redash.query_runner import import_query_runners
from redash.destinations import import_destinations from redash.destinations import import_destinations
__version__ = '4.0.1' __version__ = '4.0.2'
def setup_logging(): def setup_logging():

View File

@@ -50,7 +50,7 @@ MULTI_ORG = parse_boolean(os.environ.get("REDASH_MULTI_ORG", "false"))
GOOGLE_CLIENT_ID = os.environ.get("REDASH_GOOGLE_CLIENT_ID", "") GOOGLE_CLIENT_ID = os.environ.get("REDASH_GOOGLE_CLIENT_ID", "")
GOOGLE_CLIENT_SECRET = os.environ.get("REDASH_GOOGLE_CLIENT_SECRET", "") GOOGLE_CLIENT_SECRET = os.environ.get("REDASH_GOOGLE_CLIENT_SECRET", "")
GOOGLE_OAUTH_ENABLED = GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET GOOGLE_OAUTH_ENABLED = bool(GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET)
# Enables the use of an externally-provided and trusted remote user via an HTTP # Enables the use of an externally-provided and trusted remote user via an HTTP
# header. The "user" must be an email address. # header. The "user" must be an email address.