mirror of
https://github.com/getredash/redash.git
synced 2026-03-23 13:00:10 -04:00
150 lines
4.7 KiB
YAML
150 lines
4.7 KiB
YAML
name: Tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
env:
|
|
NODE_VERSION: 14.17
|
|
jobs:
|
|
backend-lint:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.7'
|
|
- run: sudo pip install flake8
|
|
- run: ./bin/flake8_tests.sh
|
|
|
|
backend-unit-tests:
|
|
runs-on: ubuntu-22.04
|
|
needs: backend-lint
|
|
env:
|
|
COMPOSE_FILE: .ci/docker-compose.ci.yml
|
|
COMPOSE_PROJECT_NAME: redash
|
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
|
DOCKER_BUILDKIT: 1
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1
|
|
- name: Build Docker Images
|
|
run: |
|
|
set -x
|
|
docker-compose build --build-arg skip_ds_deps=true --build-arg skip_frontend_build=true
|
|
docker-compose up -d
|
|
sleep 10
|
|
- name: Create Test Database
|
|
run: docker-compose -p redash run --rm postgres psql -h postgres -U postgres -c "create database tests;"
|
|
- name: List Enabled Query Runners
|
|
run: docker-compose -p redash run --rm redash manage ds list_types
|
|
- name: Run Tests
|
|
run: docker-compose -p redash run --name tests redash tests --junitxml=junit.xml --cov-report xml --cov=redash --cov-config .coveragerc tests/
|
|
- name: Copy Test Results
|
|
run: |
|
|
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
|
|
- name: Store Test Results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: test-results
|
|
path: /tmp/test-results
|
|
- name: Store Coverage Results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coverage
|
|
path: coverage.xml
|
|
|
|
frontend-lint:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'yarn'
|
|
- name: Install Dependencies
|
|
run: |
|
|
npm install --global --force yarn@1.22.10
|
|
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
|
|
- name: Run Lint
|
|
run: yarn lint:ci
|
|
- name: Store Test Results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: test-results
|
|
path: /tmp/test-results
|
|
|
|
frontend-unit-tests:
|
|
runs-on: ubuntu-22.04
|
|
needs: frontend-lint
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'yarn'
|
|
- name: Install Dependencies
|
|
run: |
|
|
npm install --global --force yarn@1.22.10
|
|
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
|
|
- name: Run App Tests
|
|
run: yarn test
|
|
- name: Run Visualizations Tests
|
|
run: cd viz-lib && yarn test
|
|
- run: yarn lint
|
|
|
|
frontend-e2e-tests:
|
|
runs-on: ubuntu-22.04
|
|
needs: frontend-lint
|
|
env:
|
|
COMPOSE_FILE: .ci/docker-compose.cypress.yml
|
|
COMPOSE_PROJECT_NAME: cypress
|
|
PERCY_TOKEN_ENCODED: ZGRiY2ZmZDQ0OTdjMzM5ZWE0ZGQzNTZiOWNkMDRjOTk4Zjg0ZjMxMWRmMDZiM2RjOTYxNDZhOGExMjI4ZDE3MA==
|
|
CYPRESS_PROJECT_ID_ENCODED: OTI0Y2th
|
|
CYPRESS_RECORD_KEY_ENCODED: YzA1OTIxMTUtYTA1Yy00NzQ2LWEyMDMtZmZjMDgwZGI2ODgx
|
|
CYPRESS_INSTALL_BINARY: 0
|
|
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'yarn'
|
|
- name: Enable Code Coverage Report For Master Branch
|
|
if: endsWith(github.ref, '/master')
|
|
run: |
|
|
echo "CODE_COVERAGE=true" >> $GITHUB_ENV
|
|
- name: Install Dependencies
|
|
run: |
|
|
npm install --global --force yarn@1.22.10
|
|
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
|
|
- name: Setup Redash Server
|
|
run: |
|
|
set -x
|
|
yarn cypress build
|
|
yarn cypress start -- --skip-db-seed
|
|
docker-compose run cypress yarn cypress db-seed
|
|
- name: Execute Cypress Tests
|
|
run: yarn cypress run-ci
|
|
- name: "Failure: output container logs to console"
|
|
if: failure()
|
|
run: docker-compose logs
|
|
- name: Copy Code Coverage Results
|
|
run: docker cp cypress:/usr/src/app/coverage ./coverage || true
|
|
- name: Store Coverage Results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coverage
|
|
path: coverage
|