@@ -515,12 +515,15 @@ jobs:
515515 run : npm run setup-tests.py
516516
517517 - name : Run main integration tests
518- run : |
519- if [ "${{ matrix.python-version }}" == "3.12" ]; then
520- npx percy exec -- pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml tests/integration --splits 3 --group ${{ matrix.test-group }}
521- else
522- pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml tests/integration --splits 3 --group ${{ matrix.test-group }}
523- fi
518+ if : matrix.python-version != '3.12'
519+ run : pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml tests/integration --splits 3 --group ${{ matrix.test-group }}
520+
521+ - name : Run main integration tests with Percy
522+ if : matrix.python-version == '3.12'
523+ uses : ./.github/actions/percy-exec
524+ with :
525+ command : pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml tests/integration --splits 3 --group ${{ matrix.test-group }}
526+ percy-token : ${{ secrets.PERCY_TOKEN }}
524527
525528 - name : Upload test results
526529 if : always()
@@ -601,15 +604,21 @@ jobs:
601604 sudo Xvfb :99 -ac -screen 0 1280x1024x24 &
602605 echo "DISPLAY=:99" >> $GITHUB_ENV
603606
607+ - name : Install HTML components dependencies
608+ working-directory : components/dash-html-components
609+ run : npm ci
610+
604611 - name : Run HTML components tests
612+ if : matrix.python-version != '3.12'
605613 working-directory : components/dash-html-components
606- run : |
607- npm ci
608- if [ "${{ matrix.python-version }}" == "3.12" ]; then
609- npx percy exec -- pytest --headless --nopercyfinalize --junitxml=test-reports/junit_html.xml
610- else
611- pytest --headless --nopercyfinalize --junitxml=test-reports/junit_html.xml
612- fi
614+ run : pytest --headless --nopercyfinalize --junitxml=test-reports/junit_html.xml
615+
616+ - name : Run HTML components tests with Percy
617+ if : matrix.python-version == '3.12'
618+ uses : ./.github/actions/percy-exec
619+ with :
620+ command : cd components/dash-html-components && pytest --headless --nopercyfinalize --junitxml=test-reports/junit_html.xml
621+ percy-token : ${{ secrets.PERCY_TOKEN }}
613622
614623 - name : Upload test results
615624 if : always()
@@ -863,11 +872,18 @@ jobs:
863872 sudo Xvfb :99 -ac -screen 0 1280x1024x24 &
864873 echo "DISPLAY=:99" >> $GITHUB_ENV
865874
875+ - name : Install Table test dependencies
876+ working-directory : components/dash-table
877+ run : npm ci
878+
866879 - name : Run Table visual tests
880+ if : env.PERCY_TOKEN != ''
867881 working-directory : components/dash-table
868- run : |
869- npm ci
870- npm run test.visual
882+ run : npm run test.visual
883+
884+ - name : Skip Table visual tests (fork PR)
885+ if : env.PERCY_TOKEN == ''
886+ run : echo "::notice::Skipping Percy table visual tests (no token available - likely a fork PR)"
871887
872888 - name : Upload dash artifacts
873889 if : always()
@@ -883,17 +899,23 @@ jobs:
883899 needs : [test-main, dcc-test, html-test]
884900 runs-on : ubuntu-latest
885901 if : always()
902+ env :
903+ PERCY_TOKEN : ${{ secrets.PERCY_TOKEN }}
886904 steps :
887905 - name : Finalize Main Percy Build
888906 if : |
889- needs.test-main.result != 'skipped' ||
890- needs.dcc-test.result != 'skipped' ||
891- needs.html-test.result != 'skipped'
907+ env.PERCY_TOKEN != '' && (
908+ needs.test-main.result != 'skipped' ||
909+ needs.dcc-test.result != 'skipped' ||
910+ needs.html-test.result != 'skipped'
911+ )
892912 run : |
893913 npm install -g @percy/cli
894914 npx percy build:finalize
895- env :
896- PERCY_TOKEN : ${{ secrets.PERCY_TOKEN }}
915+
916+ - name : Skip Percy finalize (fork PR)
917+ if : env.PERCY_TOKEN == ''
918+ run : echo "::notice::Skipping Percy finalize (no token available - likely a fork PR)"
897919
898920 report-table-percy-skipped :
899921 name : Report Percy Table Skipped
0 commit comments