redash/.circleci/config.yml
Omer Lachish e23a07af03 Remove missing coverage from pytest terminal output (#3180)
* Remove missing coverage from pytest terminal output

* move coverage reporting to CI
2018-12-12 08:30:46 +02:00

130 lines
3.7 KiB
YAML

version: 2.0
flake8-steps: &steps
- checkout
- run: sudo pip install flake8
- run: ./bin/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 --cov-report xml --cov=redash --cov-config .coveragerc 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
frontend-e2e-tests:
environment:
COMPOSE_FILE: .circleci/docker-compose.cypress.yml
COMPOSE_PROJECT_NAME: cypress
PERCY_TOKEN_ENCODED: MWM3OGUzNzk4ZWQ2NTE4YTBhMDAwZDNiNWE1Nzc4ZjEzZjYyMzY1MjE0NjY0NDRiOGE5ODc5ZGYzYTU4ZmE4NQ==
docker:
- image: circleci/node:8
steps:
- setup_remote_docker
- checkout
- run:
name: Install npm dependencies
command: |
npm install
- run:
name: Setup Redash server
command: |
npm run cypress start
docker-compose run cypress node ./cypress/cypress.js db-seed
- run:
name: Execute Cypress tests
command: npm run cypress run-ci
build-tarball:
docker:
- image: circleci/node:8
steps:
- checkout
- run: sudo apt install python-pip
- run: npm install
- run: .circleci/update_version
- run: npm run bundle
- run: npm run build
- 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)
workflows:
version: 2
build:
jobs:
- python-flake8-tests
- legacy-python-flake8-tests
- backend-unit-tests
- frontend-unit-tests
- frontend-e2e-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\/.*/