|
| 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