mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 01:25:16 +00:00
157 lines
4.8 KiB
YAML
157 lines
4.8 KiB
YAML
version: 2.0
|
|
|
|
flake8-steps: &steps
|
|
- checkout
|
|
- run: sudo pip install flake8
|
|
- run: ./flake8_tests.sh
|
|
jobs:
|
|
python-flake8-tests:
|
|
docker:
|
|
- image: circleci/python:3.7.0
|
|
steps: *steps
|
|
legacy-python-flake8-tests:
|
|
docker:
|
|
- image: circleci/python:2.7.15
|
|
steps: *steps
|
|
backend-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 build --build-arg skip_ds_deps=true
|
|
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
|
|
frontend-unit-tests:
|
|
docker:
|
|
- image: circleci/node:8
|
|
steps:
|
|
- checkout
|
|
- run: sudo apt install python-pip
|
|
- run: npm install
|
|
- run: npm run bundle
|
|
- run: npm test
|
|
build-tarball:
|
|
docker:
|
|
- image: circleci/node:8
|
|
steps:
|
|
- checkout
|
|
- run: sudo apt install python-pip
|
|
- run: npm install
|
|
- run: npm run bundle
|
|
- 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 bundle
|
|
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:
|
|
- python-flake8-tests
|
|
- legacy-python-flake8-tests
|
|
- backend-unit-tests
|
|
- frontend-unit-tests
|
|
- build-tarball:
|
|
requires:
|
|
- backend-unit-tests
|
|
filters:
|
|
tags:
|
|
only: /v[0-9]+(\.[0-9\-a-z]+)*/
|
|
branches:
|
|
only:
|
|
- master
|
|
- /release\/.*/
|
|
- build-docker-image:
|
|
requires:
|
|
- backend-unit-tests
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- preview-build
|
|
- /release\/.*/
|