mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 01:25:16 +00:00
122 lines
3.8 KiB
YAML
122 lines
3.8 KiB
YAML
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
|
|
- 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:
|
|
tags:
|
|
only: /v[0-9]+(\.[0-9\-a-z]+)*/ |