mirror of
https://github.com/getredash/redash.git
synced 2026-03-20 22:00:12 -04:00
* Snapshot: 24.07.0-dev * Snapshot: 24.08.0-dev * Snapshot: 24.09.0-dev * Snapshot: 24.10.0-dev * Snapshot: 24.11.0-dev * Snapshot: 24.12.0-dev * Snapshot: 25.01.0-dev * Snapshot: 25.02.0-dev * Snapshot: 25.03.0-dev * Snapshot: 25.04.0-dev * Upgrade Node.js version to 24 in Dockerfile and .nvmrc; update package.json engine constraints * Update major dependencies * Switch from yarn to pnpm * Switch from yarn to pnpm: ci * Update Python version to 3.13 in CI workflow * Refactor Netlify build command to remove pnpm installation step * Update ESLint configuration for improved compatibility and disable specific rules * Restyled by prettier * Add typeRoots and types to tsconfig for improved type definitions * Update Dockerfile.cypress to use Node 24 and streamline installation steps * Fixed tests * Restyled by prettier * Update Jest snapshot comments to point to the official documentation URL * viz-lib: refactor test setup and update snapshots for consistency * Add babel-jest as a dev dependency for improved testing support * Add virtual prop to visualization type selector for improved functionality * Remove CJS/ESM compatibility shim for color-rgba * Restyled by prettier * Enable ESLintPlugin conditionally based on production environment * Import d3 library in d3box.ts * Fix pip install command in CI workflow to use python -m * Replace d3 import with global declaration for compatibility with d3 v3 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Restyled.io <commits@restyled.io>
181 lines
5.8 KiB
YAML
181 lines
5.8 KiB
YAML
name: Tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
env:
|
|
NODE_VERSION: 24
|
|
PNPM_VERSION: 10.30.3
|
|
jobs:
|
|
backend-lint:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- if: github.event.pull_request.mergeable == 'false'
|
|
name: Exit if PR is not mergeable
|
|
run: exit 1
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.13'
|
|
- run: python -m pip install black==23.1.0 ruff==0.0.287
|
|
- run: ruff check .
|
|
- run: black --check .
|
|
|
|
backend-unit-tests:
|
|
runs-on: ubuntu-22.04
|
|
needs: backend-lint
|
|
env:
|
|
COMPOSE_FILE: .ci/compose.ci.yaml
|
|
COMPOSE_PROJECT_NAME: redash
|
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
|
DOCKER_BUILDKIT: 1
|
|
steps:
|
|
- if: github.event.pull_request.mergeable == 'false'
|
|
name: Exit if PR is not mergeable
|
|
run: exit 1
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: Build Docker Images
|
|
run: |
|
|
set -x
|
|
docker compose build --build-arg install_groups="main,all_ds,dev" --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: Upload coverage reports to Codecov
|
|
# uses: codecov/codecov-action@v3
|
|
# with:
|
|
# token: ${{ secrets.CODECOV_TOKEN }}
|
|
- name: Store Test Results
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: backend-test-results
|
|
path: /tmp/test-results
|
|
- name: Store Coverage Results
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage
|
|
path: coverage.xml
|
|
|
|
frontend-lint:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- if: github.event.pull_request.mergeable == 'false'
|
|
name: Exit if PR is not mergeable
|
|
run: exit 1
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: ${{ env.PNPM_VERSION }}
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'pnpm'
|
|
- name: Install Dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Run Lint
|
|
run: pnpm run lint:ci
|
|
- name: Store Test Results
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: frontend-test-results
|
|
path: /tmp/test-results
|
|
|
|
frontend-unit-tests:
|
|
runs-on: ubuntu-22.04
|
|
needs: frontend-lint
|
|
steps:
|
|
- if: github.event.pull_request.mergeable == 'false'
|
|
name: Exit if PR is not mergeable
|
|
run: exit 1
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: ${{ env.PNPM_VERSION }}
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'pnpm'
|
|
- name: Install Dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Run App Tests
|
|
run: pnpm run test
|
|
- name: Run Visualizations Tests
|
|
run: pnpm --filter @redash/viz test
|
|
- run: pnpm run lint
|
|
|
|
frontend-e2e-tests:
|
|
runs-on: ubuntu-22.04
|
|
needs: frontend-lint
|
|
env:
|
|
COMPOSE_FILE: .ci/compose.cypress.yaml
|
|
COMPOSE_PROJECT_NAME: cypress
|
|
CYPRESS_INSTALL_BINARY: 0
|
|
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
|
|
# PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
|
|
# CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
|
|
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
steps:
|
|
- if: github.event.pull_request.mergeable == 'false'
|
|
name: Exit if PR is not mergeable
|
|
run: exit 1
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: ${{ env.PNPM_VERSION }}
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'pnpm'
|
|
- name: Enable Code Coverage Report For Master Branch
|
|
if: endsWith(github.ref, '/master')
|
|
run: |
|
|
echo "CODE_COVERAGE=true" >> "$GITHUB_ENV"
|
|
- name: Install Dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Setup Redash Server
|
|
run: |
|
|
set -x
|
|
pnpm run cypress build
|
|
pnpm run cypress start -- --skip-db-seed
|
|
docker compose run cypress pnpm run cypress db-seed
|
|
- name: Execute Cypress Tests
|
|
run: pnpm run 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@v4
|
|
with:
|
|
name: coverage
|
|
path: coverage
|