2018-08-29 08:19:25 +00:00
|
|
|
version: 2.0
|
|
|
|
jobs:
|
2018-08-30 17:19:52 +00:00
|
|
|
unit-tests:
|
|
|
|
environment:
|
|
|
|
COMPOSE_FILE: .circleci/docker-compose.circle.yml
|
|
|
|
COMPOSE_PROJECT_NAME: redash
|
2018-08-29 08:19:25 +00:00
|
|
|
docker:
|
2018-08-30 17:19:52 +00:00
|
|
|
- image: circleci/buildpack-deps:xenial
|
2018-08-29 08:19:25 +00:00
|
|
|
steps:
|
2018-08-30 17:19:52 +00:00
|
|
|
- setup_remote_docker
|
2018-08-29 08:19:25 +00:00
|
|
|
- checkout
|
|
|
|
- run:
|
2018-08-30 17:19:52 +00:00
|
|
|
name: Build Docker Images
|
2018-08-29 08:19:25 +00:00
|
|
|
command: |
|
|
|
|
set -x
|
|
|
|
docker-compose up -d
|
|
|
|
sleep 10
|
|
|
|
- run:
|
2018-08-30 17:19:52 +00:00
|
|
|
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
|
2018-08-29 08:19:25 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: coverage.xml
|
2018-08-30 17:19:52 +00:00
|
|
|
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:
|
2018-08-30 18:35:31 +00:00
|
|
|
- setup_remote_docker
|
2018-08-30 17:19:52 +00:00
|
|
|
- checkout
|
|
|
|
- run: .circleci/update_version
|
2018-08-30 17:46:08 +00:00
|
|
|
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
|
2018-08-30 17:19:52 +00:00
|
|
|
- run: docker build -t redash/redash:$(.circleci/docker_tag) .
|
|
|
|
- run: docker push redash/redash:$(.circleci/docker_tag)
|
2018-08-29 16:34:47 +00:00
|
|
|
integration-tests:
|
2018-08-29 08:19:25 +00:00
|
|
|
working_directory: ~/redash
|
|
|
|
machine: true
|
|
|
|
environment:
|
|
|
|
REDASH_SERVER_URL : "http://127.0.0.1:5000/"
|
|
|
|
DOCKER_IMAGE: mozilla/redash-ui-tests
|
|
|
|
steps:
|
2018-08-30 17:19:52 +00:00
|
|
|
- checkout
|
2018-08-29 08:19:25 +00:00
|
|
|
- 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
|
2018-08-29 16:34:47 +00:00
|
|
|
docker-compose -f docker-compose.yml up --no-start
|
2018-08-29 08:19:25 +00:00
|
|
|
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
|
|
|
|
- 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
|
2018-08-29 16:34:47 +00:00
|
|
|
integration_tests:
|
|
|
|
jobs:
|
|
|
|
- integration-tests:
|
|
|
|
filters:
|
|
|
|
branches:
|
2018-08-30 17:19:52 +00:00
|
|
|
only: master
|
2018-08-29 16:34:47 +00:00
|
|
|
build:
|
2018-08-29 08:19:25 +00:00
|
|
|
jobs:
|
2018-08-30 17:19:52 +00:00
|
|
|
- unit-tests
|
2018-08-29 16:34:47 +00:00
|
|
|
- build-tarball:
|
2018-08-29 08:19:25 +00:00
|
|
|
requires:
|
2018-08-29 16:34:47 +00:00
|
|
|
- unit-tests
|
2018-08-29 08:19:25 +00:00
|
|
|
filters:
|
2018-08-30 17:19:52 +00:00
|
|
|
tags:
|
|
|
|
only: /v[0-9]+(\.[0-9\-a-z]+)*/
|
2018-08-29 08:19:25 +00:00
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
- release
|
2018-08-29 16:34:47 +00:00
|
|
|
- build-docker-image:
|
2018-08-29 08:19:25 +00:00
|
|
|
requires:
|
2018-08-29 16:34:47 +00:00
|
|
|
- unit-tests
|
2018-08-29 08:19:25 +00:00
|
|
|
filters:
|
|
|
|
tags:
|
2018-08-30 17:19:52 +00:00
|
|
|
only: /v[0-9]+(\.[0-9\-a-z]+)*/
|