Skip to content

Commit 7a22ab2

Browse files
committed
Move table tests to workflow
1 parent 85f1d3f commit 7a22ab2

File tree

2 files changed

+145
-148
lines changed

2 files changed

+145
-148
lines changed

.circleci/config.yml

Lines changed: 0 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -404,105 +404,6 @@ jobs:
404404
PYVERSION: python38
405405
PERCY_ENABLE: 0
406406

407-
table-server: &table-server
408-
working_directory: ~/dash
409-
docker:
410-
- image: cimg/python:3.12.10-browsers
411-
environment:
412-
PYVERSION: python312
413-
PERCY_ENABLE: 1
414-
PERCY_PARALLEL_TOTAL: -1
415-
416-
parallelism: 5
417-
418-
steps:
419-
- checkout:
420-
path: ~/dash
421-
- run:
422-
name: Add chrome keys & update.
423-
command: |
424-
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
425-
sudo apt-get update
426-
- run: echo $PYVERSION > ver.txt
427-
- run: cat requirements/*.txt > requirements-all.txt
428-
- restore_cache:
429-
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "requirements-all.txt" }}
430-
- browser-tools/install-browser-tools:
431-
chrome-version: 120.0.6099.71
432-
install-firefox: false
433-
install-geckodriver: false
434-
- attach_workspace:
435-
at: ~/dash
436-
- run:
437-
name: ️️🏗️ Install package
438-
command: |
439-
. venv/bin/activate
440-
pip install dash-package/dash-package.tar.gz[ci,dev,testing,celery,diskcache] --progress-bar off
441-
pip list | grep dash
442-
- run:
443-
name: Inject Percy Environment variables
444-
command: |
445-
echo 'export PERCY_TOKEN="$PERCY_TOKEN"' >> $BASH_ENV
446-
- run:
447-
name: Run tests
448-
command: |
449-
. venv/bin/activate
450-
cd components/dash-table
451-
TESTFILES=$(circleci tests glob "tests/selenium/**/test_*.py" | circleci tests split --split-by=timings)
452-
pytest --nopercyfinalize --junitxml=test-reports/junit_intg.xml --junitprefix="components.dash-table" ${TESTFILES}
453-
- store_artifacts:
454-
path: ~/dash/components/dash-table/test-reports
455-
- store_test_results:
456-
path: ~/dash/components/dash-table/test-reports
457-
- store_artifacts:
458-
path: /tmp/dash_artifacts
459-
460-
table-unit-test:
461-
working_directory: ~/dash
462-
docker:
463-
- image: cimg/python:3.12.10-browsers
464-
environment:
465-
PYVERSION: python312
466-
PERCY_ENABLE: 0
467-
steps:
468-
- checkout:
469-
path: ~/dash
470-
- run:
471-
name: Add chrome keys & update.
472-
command: |
473-
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
474-
sudo apt-get update
475-
- run: echo $PYVERSION > ver.txt
476-
- run: cat requirements/*.txt > requirements-all.txt
477-
- restore_cache:
478-
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "requirements-all.txt" }}
479-
- restore_cache:
480-
key: table-{{ checksum "components/dash-table/package.json" }}-{{ checksum "components/dash-table/package-lock.json" }}
481-
- browser-tools/install-browser-tools:
482-
chrome-version: 120.0.6099.71
483-
install-firefox: false
484-
install-geckodriver: false
485-
- attach_workspace:
486-
at: ~/dash
487-
- run:
488-
name: ️️🏗️ Install package and table deps
489-
command: |
490-
. venv/bin/activate
491-
pip install dash-package/dash-package.tar.gz[ci,dev,testing,celery,diskcache] --progress-bar off
492-
pip list | grep dash
493-
cd components/dash-table
494-
npm ci
495-
- save_cache:
496-
key: table-{{ checksum "components/dash-table/package.json" }}-{{ checksum "components/dash-table/package-lock.json" }}
497-
paths:
498-
- components/dash-table/node_modules
499-
- run:
500-
name: Run tests
501-
command: |
502-
. venv/bin/activate
503-
cd components/dash-table
504-
npm run test.unit
505-
506407
table-visual-test:
507408
working_directory: ~/dash/components/dash-table
508409
docker:
@@ -539,46 +440,6 @@ jobs:
539440
- store_artifacts:
540441
path: storybook-static
541442

542-
table-node:
543-
working_directory: ~/dash
544-
docker:
545-
- image: cimg/python:3.12.10-node
546-
environment:
547-
PYVERSION: python312
548-
PERCY_ENABLE: 0
549-
steps:
550-
- checkout:
551-
path: ~/dash
552-
- run: echo $PYVERSION > ver.txt
553-
- run: cat requirements/*.txt > requirements-all.txt
554-
555-
- restore_cache:
556-
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "requirements-all.txt" }}
557-
- restore_cache:
558-
key: dep-{{ .Branch }}-{{ checksum "components/dash-table/package-lock.json" }}-{{ checksum "components/dash-table/package.json" }}
559-
- run:
560-
name: Install package.json
561-
command: cd components/dash-table && npm ci
562-
- save_cache:
563-
key: dep-{{ .Branch }}-{{ checksum "components/dash-table/package-lock.json" }}-{{ checksum "components/dash-table/package.json" }}
564-
paths:
565-
- components/dash-table/node_modules
566-
- attach_workspace:
567-
at: ~/dash
568-
- run:
569-
name: Install requirements
570-
command: |
571-
. venv/bin/activate
572-
pip install dash-package/dash-package.tar.gz[ci,dev,testing]
573-
574-
- run:
575-
name: Run eslint
576-
command: |
577-
. venv/bin/activate
578-
cd components/dash-table
579-
npm run lint
580-
when: always
581-
582443
workflows:
583444
version: 2
584445
tests:
@@ -623,16 +484,7 @@ workflows:
623484
requires:
624485
- install-dependencies-38
625486

626-
- table-node:
627-
requires:
628-
- install-dependencies-312
629-
- table-unit-test:
630-
requires:
631-
- install-dependencies-312
632487
- table-visual-test
633-
- table-server:
634-
requires:
635-
- install-dependencies-312
636488

637489
- percy/finalize_all:
638490
requires:

.github/workflows/table-tests.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Table Tests
2+
3+
on:
4+
push:
5+
workflow_dispatch: # Allows manual triggering
6+
7+
jobs:
8+
table-unit:
9+
name: Table Node Tests (Node ${{ matrix.node-version }})
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
node-version: [20.x]
15+
python-version: ["3.12"]
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
cache: 'pip'
32+
33+
- name: Install Python dependencies
34+
run: pip install -e .[ci,dev,testing]
35+
36+
- name: Build
37+
run: |
38+
cd components/dash-table
39+
npm ci
40+
npm run build
41+
42+
- name: Lint
43+
run: |
44+
cd components/dash-table
45+
npm run lint
46+
47+
- name: Unit
48+
run: |
49+
cd components/dash-table
50+
npm run test.unit
51+
52+
table-server:
53+
name: Table Server Tests (Python ${{ matrix.python-version }})
54+
runs-on: ubuntu-latest
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
node-version: [20.x]
59+
python-version: ["3.12"] # Specify Python versions
60+
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
65+
- name: Set up Node.js ${{ matrix.node-version }}
66+
uses: actions/setup-node@v4
67+
with:
68+
node-version: ${{ matrix.node-version }}
69+
cache: 'npm'
70+
71+
- name: Set up Python ${{ matrix.python-version }}
72+
uses: actions/setup-python@v5
73+
with:
74+
python-version: ${{ matrix.python-version }}
75+
cache: 'pip'
76+
77+
- name: Install Google Chrome
78+
run: |
79+
sudo apt-get update
80+
# Attempt to install a specific recent, stable version or just google-chrome-stable
81+
# For more deterministic builds, you might consider a specific version if available via apt,
82+
# or using a Docker image with Chrome pre-installed if extreme consistency is needed.
83+
sudo apt-get install -y google-chrome-stable
84+
85+
- name: Install ChromeDriver
86+
run: |
87+
echo "Determining Chrome version..."
88+
CHROME_BROWSER_VERSION=$(google-chrome --version)
89+
echo "Installed Chrome Browser version: $CHROME_BROWSER_VERSION"
90+
# Extract the major version number (e.g., 124 from "Google Chrome 124.0.6367.207")
91+
CHROME_MAJOR_VERSION=$(echo "$CHROME_BROWSER_VERSION" | cut -f 3 -d ' ' | cut -f 1 -d '.')
92+
echo "Detected Chrome Major version: $CHROME_MAJOR_VERSION"
93+
94+
# For Chrome 115 and later, use the new Chrome for Testing (CfT) JSON endpoints
95+
if [ "$CHROME_MAJOR_VERSION" -ge 115 ]; then
96+
echo "Fetching ChromeDriver version for Chrome $CHROME_MAJOR_VERSION using CfT endpoint..."
97+
# Get the latest known good version of chromedriver for this major Chrome version
98+
CHROMEDRIVER_VERSION_STRING=$(curl -sS "https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_${CHROME_MAJOR_VERSION}")
99+
if [ -z "$CHROMEDRIVER_VERSION_STRING" ]; then
100+
echo "Could not automatically find ChromeDriver version for Chrome $CHROME_MAJOR_VERSION via LATEST_RELEASE. Please check CfT endpoints."
101+
# As a fallback, attempt to fetch the known good versions and pick the latest chromedriver.
102+
# This is more complex and might require parsing JSON with jq.
103+
# For simplicity, we'll rely on LATEST_RELEASE_ for now.
104+
# If that fails consistently, you might need a more robust script or a fixed ChromeDriver version.
105+
# Alternative: List all known good versions
106+
# curl -sS "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json"
107+
exit 1
108+
fi
109+
CHROMEDRIVER_URL="https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/${CHROMEDRIVER_VERSION_STRING}/linux64/chromedriver-linux64.zip"
110+
else
111+
# For older Chrome versions (less common now)
112+
echo "Fetching ChromeDriver version for Chrome $CHROME_MAJOR_VERSION using older method..."
113+
CHROMEDRIVER_VERSION_STRING=$(curl -sS "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION}")
114+
CHROMEDRIVER_URL="https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION_STRING}/chromedriver_linux64.zip"
115+
fi
116+
117+
echo "Using ChromeDriver version string: $CHROMEDRIVER_VERSION_STRING"
118+
echo "Downloading ChromeDriver from: $CHROMEDRIVER_URL"
119+
120+
wget -q -O chromedriver.zip "$CHROMEDRIVER_URL"
121+
unzip -o chromedriver.zip -d /tmp/ # Unzip to /tmp
122+
# The zip for CfT often contains a directory like chromedriver-linux64/
123+
sudo mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver || sudo mv /tmp/chromedriver /usr/local/bin/chromedriver
124+
sudo chmod +x /usr/local/bin/chromedriver
125+
# Add /usr/local/bin to GITHUB_PATH to ensure chromedriver is found
126+
echo "/usr/local/bin" >> $GITHUB_PATH
127+
shell: bash
128+
129+
- name: Verify ChromeDriver Installation
130+
run: |
131+
chromedriver --version
132+
133+
- name: Install Python dependencies
134+
run: pip install -e .[ci,dev,testing]
135+
136+
- name: Build
137+
run: |
138+
cd components/dash-table
139+
npm ci
140+
npm run build
141+
142+
- name: Run Table Server Tests
143+
run: |
144+
cd components/dash-table
145+
pytest --nopercyfinalize

0 commit comments

Comments
 (0)