migrate circleci to github workflow #1050
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Dash Testing | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| - master | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| changes_filter: | |
| name: Detect Relevant Path Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| # This output will be 'true' if files in the 'table_related_paths' list changed, 'false' otherwise. | |
| table_paths_changed: ${{ steps.filter.outputs.table_related_paths }} | |
| background_cb_changed: ${{ steps.filter.outputs.background_paths }} | |
| dcc_paths_changed: ${{ steps.filter.outputs.dcc_related_paths }} | |
| html_paths_changed: ${{ steps.filter.outputs.html_related_paths }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Detect changed files for table tests | |
| id: filter # Give an ID to this step to reference its outputs | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| table_related_paths: | |
| - 'components/dash-table/**' | |
| - 'dash/dash-renderer/**' | |
| dcc_related_paths: | |
| - 'components/dash-core-components/**' | |
| - 'dash/dash-renderer/**' | |
| html_related_paths: | |
| - 'components/dash-html-components/**' | |
| - 'dash/dash-renderer/**' | |
| background_paths: | |
| - 'dash/background_callback/**' | |
| - 'dash/dash-renderer/**' | |
| - 'dash/_callback.py' | |
| - 'dash/_callback_context.py' | |
| - 'tests/background_callback/**' | |
| - 'tests/async_tests/**' | |
| - 'requirements/**' | |
| lint-unit: | |
| name: Lint & Unit Tests (Python ${{ matrix.python-version }}) | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.12"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Download built component folders for linting | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-components | |
| path: ${{ github.workspace }}/dash | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<80.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[dev,ci,testing]"' \; | |
| - name: Install dash-renderer dependencies | |
| working-directory: dash/dash-renderer | |
| run: npm ci | |
| - name: Setup virtual display | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb | |
| sudo Xvfb :99 -ac -screen 0 1280x1024x24 & | |
| echo "DISPLAY=:99" >> $GITHUB_ENV | |
| - name: Run lint | |
| run: npm run lint | |
| - name: Run unit tests | |
| run: npm run citest.unit | |
| build: | |
| name: Build Dash Package | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| outputs: | |
| artifact_name: dash-packages | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js for frontend build | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: npm | |
| - name: Install NPM dependencies | |
| run: npm ci | |
| - name: Set up Python for build | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: pip | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install "setuptools<80.0.0" | |
| python -m pip install build wheel | |
| python -m pip install -e .[dev,ci] | |
| - name: Build Dash | |
| run: npm run build | |
| - name: Build Dash sdist and wheel | |
| run: | | |
| # This command will invoke hatchling (via hatch_dash.py) which includes building JS assets | |
| python -m build --sdist --wheel | |
| echo "Built packages:" | |
| ls -lhR dist/ | |
| mkdir packages | |
| cp dist/*.whl packages | |
| - name: Upload Dash packages as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dash-packages # This name will be used by dependent jobs to download | |
| path: packages/ # Upload the contents of the dist directory | |
| retention-days: 1 # Keep artifact for 1 day (adjust as needed) | |
| - name: Upload built component folders for linting | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dash-components | |
| path: | | |
| dash/dcc/ | |
| dash/html/ | |
| dash/dash_table/ | |
| retention-days: 1 | |
| test-typing: | |
| name: Typing Tests | |
| runs-on: ubuntu-latest | |
| needs: build | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<80.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev]"' \; | |
| - name: Build/Setup test components | |
| run: npm run setup-tests.py # TODO build the packages and save them to packages/ in build job | |
| - name: Run typing tests | |
| run: | | |
| pytest tests/compliance/test_typing.py | |
| background-callbacks: | |
| name: Run Background & Async Callback Tests (Python ${{ matrix.python-version }}) | |
| needs: [build, changes_filter] | |
| if: | | |
| (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')) || | |
| needs.changes_filter.outputs.background_cb_changed == 'true' | |
| timeout-minutes: 30 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.12"] | |
| # Service container for Redis | |
| services: | |
| redis: | |
| image: redis:6 | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| # Set REDIS_URL for your application/tests | |
| # The service 'redis' will be available on localhost (or redis) at port 6379 | |
| REDIS_URL: redis://localhost:6379 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<78.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[async,ci,testing,dev,celery,diskcache]"' \; | |
| - name: Setup Chrome and ChromeDriver | |
| uses: browser-actions/setup-chrome@v1 | |
| with: | |
| chrome-version: stable | |
| - name: Verify Redis connection | |
| run: | | |
| python -c "import redis; r = redis.Redis(host='localhost', port=6379, db=0); r.ping(); print('Successfully connected to Redis!')" | |
| - name: Build/Setup test components | |
| run: npm run setup-tests.py | |
| - name: Setup test directory | |
| run: | | |
| mkdir bgtests | |
| cp -r tests bgtests/tests | |
| cd bgtests | |
| touch __init__.py | |
| mkdir -p test-reports | |
| - name: Run Background Callback Tests | |
| timeout-minutes: 15 | |
| run: | | |
| cd bgtests | |
| pytest --headless --nopercyfinalize --junitxml=test-reports/junit_background.xml tests/background_callback -v -s | |
| - name: Cleanup background processes | |
| if: always() | |
| run: | | |
| pkill -f celery || true | |
| pkill -f "dash" || true | |
| sleep 2 | |
| - name: Run Async Callback Tests | |
| timeout-minutes: 15 | |
| run: | | |
| cd bgtests | |
| pytest --headless --nopercyfinalize --junitxml=test-reports/junit_async.xml tests/async_tests -v -s | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: background-test-results-py${{ matrix.python-version }} | |
| path: bgtests/test-reports/ | |
| retention-days: 7 | |
| table-unit: | |
| name: Table Unit/Lint Tests (Python ${{ matrix.python-version }}) | |
| needs: [build, changes_filter] | |
| if: | | |
| (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')) || | |
| needs.changes_filter.outputs.table_paths_changed == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages # Must match the name used in the 'build' job's upload step | |
| path: packages/ # Download to a local 'dist' directory | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<80.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev]"' \; | |
| - name: Lint | |
| run: | | |
| cd components/dash-table | |
| npm ci | |
| npm run lint | |
| - name: Unit | |
| run: | | |
| cd components/dash-table | |
| npm run test.unit | |
| table-server: | |
| name: Table Server Tests (Group ${{ matrix.test-group }}) | |
| needs: [build, changes_filter] | |
| # Conditional execution: | |
| # OR if the 'changes_filter' job detected changes in 'table_related_paths'. | |
| if: | | |
| (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')) || | |
| needs.changes_filter.outputs.table_paths_changed == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12"] | |
| test-group: ["1", "2", "3"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<80.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev]"' \; | |
| - name: Setup Chrome and ChromeDriver | |
| uses: browser-actions/setup-chrome@v1 | |
| with: | |
| chrome-version: stable | |
| - name: Run Table Server Tests | |
| run: | | |
| cd components/dash-table | |
| pytest --nopercyfinalize --headless --junitxml=test-reports/junit_table.xml --splits 3 --group ${{ matrix.test-group }} | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: table-server-results-group${{ matrix.test-group }} | |
| path: components/dash-table/test-reports/ | |
| retention-days: 7 | |
| test-main: | |
| name: Main Dash Tests (Python ${{ matrix.python-version }}, Group ${{ matrix.test-group }}) | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.12"] | |
| test-group: ["1", "2", "3"] | |
| env: | |
| PERCY_TOKEN: ${{ matrix.python-version == '3.12' && secrets.PERCY_TOKEN || '' }} | |
| PERCY_ENABLE: ${{ matrix.python-version == '3.12' && '1' || '0' }} | |
| PERCY_PARALLEL_TOTAL: -1 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<80.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev,celery,diskcache]"' \; | |
| - name: Setup Chrome and ChromeDriver | |
| uses: browser-actions/setup-chrome@v1 | |
| with: | |
| chrome-version: stable | |
| - name: Setup virtual display | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb | |
| sudo Xvfb :99 -ac -screen 0 1280x1024x24 & | |
| echo "DISPLAY=:99" >> $GITHUB_ENV | |
| - name: Build/Setup test components | |
| run: npm run setup-tests.py | |
| - name: Run main integration tests | |
| run: | | |
| if [ "${{ matrix.python-version }}" == "3.12" ]; then | |
| npx percy exec -- pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml tests/integration --splits 3 --group ${{ matrix.test-group }} | |
| else | |
| pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml tests/integration --splits 3 --group ${{ matrix.test-group }} | |
| fi | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-main-results-py${{ matrix.python-version }}-group${{ matrix.test-group }} | |
| path: test-reports/ | |
| retention-days: 7 | |
| - name: Upload dash artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-main-dash-artifacts-py${{ matrix.python-version }}-group${{ matrix.test-group }} | |
| path: /tmp/dash_artifacts | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| html-test: | |
| name: HTML Components Tests (Python ${{ matrix.python-version }}) | |
| needs: [build, changes_filter] | |
| if: | | |
| (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')) || | |
| needs.changes_filter.outputs.html_paths_changed == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.12"] | |
| env: | |
| PERCY_TOKEN: ${{ matrix.python-version == '3.12' && secrets.PERCY_TOKEN || '' }} | |
| PERCY_ENABLE: ${{ matrix.python-version == '3.12' && '1' || '0' }} | |
| PERCY_PARALLEL_TOTAL: -1 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<80.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev]"' \; | |
| - name: Setup Chrome and ChromeDriver | |
| uses: browser-actions/setup-chrome@v1 | |
| with: | |
| chrome-version: stable | |
| - name: Setup virtual display | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb | |
| sudo Xvfb :99 -ac -screen 0 1280x1024x24 & | |
| echo "DISPLAY=:99" >> $GITHUB_ENV | |
| - name: Run HTML components tests | |
| working-directory: components/dash-html-components | |
| run: | | |
| npm ci | |
| if [ "${{ matrix.python-version }}" == "3.12" ]; then | |
| npx percy exec -- pytest --headless --nopercyfinalize --junitxml=test-reports/junit_html.xml | |
| else | |
| pytest --headless --nopercyfinalize --junitxml=test-reports/junit_html.xml | |
| fi | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: html-test-results-py${{ matrix.python-version }} | |
| path: components/dash-html-components/test-reports/ | |
| retention-days: 7 | |
| - name: Upload dash artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: html-test-dash-artifacts-py${{ matrix.python-version }} | |
| path: /tmp/dash_artifacts | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| build-windows: | |
| name: Build on Windows | |
| runs-on: windows-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js 24 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install "setuptools<80.0.0" | |
| python -m pip install -e .[dev,ci] | |
| - name: Build dash-renderer | |
| working-directory: dash/dash-renderer | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Build dash-html-components | |
| working-directory: components/dash-html-components | |
| run: | | |
| npm ci | |
| npm run build | |
| dcc-lint: | |
| name: DCC Lint Tests (Python ${{ matrix.python-version }}) | |
| needs: [build, changes_filter] | |
| if: | | |
| (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')) || | |
| needs.changes_filter.outputs.dcc_paths_changed == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.12"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<80.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev]"' \; | |
| - name: Lint DCC | |
| run: | | |
| cd components/dash-core-components | |
| npm ci | |
| npm run lint | |
| dcc-test: | |
| name: DCC Integration Tests (Python ${{ matrix.python-version }}, Group ${{ matrix.test-group }}) | |
| needs: [build, changes_filter] | |
| if: | | |
| (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')) || | |
| needs.changes_filter.outputs.dcc_paths_changed == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.12"] | |
| test-group: ["1", "2", "3"] | |
| env: | |
| PERCY_TOKEN: ${{ matrix.python-version == '3.12' && secrets.PERCY_TOKEN || '' }} | |
| PERCY_ENABLE: ${{ matrix.python-version == '3.12' && '1' || '0' }} | |
| PERCY_PARALLEL_TOTAL: -1 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<80.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev,celery,diskcache]"' \; | |
| - name: Setup Chrome and ChromeDriver | |
| uses: browser-actions/setup-chrome@v1 | |
| with: | |
| chrome-version: stable | |
| - name: Setup virtual display | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb | |
| sudo Xvfb :99 -ac -screen 0 1280x1024x24 & | |
| echo "DISPLAY=:99" >> $GITHUB_ENV | |
| - name: Remove DCC Python package and run tests | |
| run: | | |
| rm -rf components/dash-core-components/dash_core_components | |
| cd components/dash-core-components | |
| npm ci | |
| npm run test:jest | |
| pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml --junitprefix="components.dash-core-components" tests/integration --splits 3 --group ${{ matrix.test-group }} | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dcc-test-results-py${{ matrix.python-version }}-group${{ matrix.test-group }} | |
| path: components/dash-core-components/test-reports/ | |
| retention-days: 7 | |
| - name: Upload dash artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dcc-dash-artifacts-py${{ matrix.python-version }}-group${{ matrix.test-group }} | |
| path: /tmp/dash_artifacts | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| table-visual-test: | |
| name: Dash Table Visual Tests | |
| needs: [build, changes_filter] | |
| if: | | |
| (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')) || | |
| needs.changes_filter.outputs.table_paths_changed == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_TABLE }} | |
| PERCY_ENABLE: '1' | |
| # Note: percy-storybook auto-finalizes, don't use PERCY_PARALLEL_TOTAL here | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| cache-dependency-path: requirements/*.txt | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Install Dash packages | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools<80.0.0" | |
| find packages -name dash-*.whl -print -exec sh -c 'pip install "{}[ci,testing,dev]"' \; | |
| - name: Setup Chrome and ChromeDriver | |
| uses: browser-actions/setup-chrome@v1 | |
| with: | |
| chrome-version: stable | |
| - name: Setup virtual display | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb | |
| sudo Xvfb :99 -ac -screen 0 1280x1024x24 & | |
| echo "DISPLAY=:99" >> $GITHUB_ENV | |
| - name: Run Table visual tests | |
| working-directory: components/dash-table | |
| run: | | |
| npm ci | |
| npm run test.visual | |
| - name: Upload dash artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: table-visual-test-dash-artifacts | |
| path: /tmp/dash_artifacts | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| percy-finalize: | |
| name: Finalize Percy Snapshots | |
| needs: [test-main, dcc-test, html-test] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Finalize Main Percy Build | |
| if: | | |
| needs.test-main.result != 'skipped' || | |
| needs.dcc-test.result != 'skipped' || | |
| needs.html-test.result != 'skipped' | |
| run: | | |
| npm install -g @percy/cli | |
| npx percy build:finalize | |
| env: | |
| PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | |
| test-report: | |
| name: Consolidated Test Report | |
| needs: [lint-unit, test-main, dcc-test, html-test, table-server, background-callbacks, test-typing] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download all test results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: '*-results-*' | |
| path: test-results | |
| merge-multiple: false | |
| - name: List downloaded results | |
| run: find test-results -name "*.xml" -type f 2>/dev/null || echo "No XML files found" | |
| - name: Publish Test Report | |
| uses: dorny/test-reporter@v1 | |
| if: always() | |
| with: | |
| name: Test Results Summary | |
| path: 'test-results/**/*.xml' | |
| reporter: java-junit | |
| fail-on-error: false | |
| fail-on-empty: false | |
| list-suites: 'failed' | |
| list-tests: 'failed' | |
| max-annotations: '50' | |
| - name: Generate Summary | |
| if: always() | |
| run: | | |
| echo "## 📊 Test Results Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Lint & Unit Tests | ${{ needs.lint-unit.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Main Integration Tests | ${{ needs.test-main.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| DCC Tests | ${{ needs.dcc-test.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| HTML Tests | ${{ needs.html-test.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Table Server Tests | ${{ needs.table-server.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Background Callbacks | ${{ needs.background-callbacks.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Typing Tests | ${{ needs.test-typing.result }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "📁 Detailed test reports are available in the artifacts section above." >> $GITHUB_STEP_SUMMARY | |
| - name: Check for failures | |
| if: always() | |
| run: | | |
| if [[ "${{ needs.lint-unit.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.test-main.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.dcc-test.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.html-test.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.table-server.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.background-callbacks.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.test-typing.result }}" == "failure" ]]; then | |
| echo "One or more required jobs failed" | |
| exit 1 | |
| fi | |
| artifacts: | |
| name: Store Build Artifacts | |
| needs: [build, percy-finalize] | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.event_name == 'push' && | |
| (github.ref == 'refs/heads/master' || | |
| github.ref == 'refs/heads/dev' || | |
| startsWith(github.ref, 'refs/tags/')) | |
| steps: | |
| - name: Download built Dash packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dash-packages | |
| path: packages/ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dash-build-artifacts-${{ github.sha }} | |
| path: packages/ | |
| retention-days: 90 |