Repository navigation
feat(build): publish a source distribution without Node.js (#3295) #4947
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| pull_request: | |
| branches: | |
| - main | |
| - release-* | |
| concurrency: | |
| # For pull requests, cancel all currently-running jobs for this workflow | |
| # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| infra: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.10" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: '24' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r local-requirements.txt | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Get Playwright | |
| run: python scripts/upstream.py checkout | |
| - name: Lint | |
| run: ./scripts/lint.sh | |
| env: | |
| PRE_COMMIT_COLOR: always | |
| build: | |
| name: Build | |
| timeout-minutes: 90 | |
| env: | |
| # The dot reporter of the test steps (scripts/pytest_dot_reporter.py). | |
| PYTHONPATH: scripts | |
| # 16 workers on the 64-core runners, as upstream runs its tests there; two on | |
| # the 3-core macOS runner, upstream's default of half the cores. | |
| WORKERS: ${{ startsWith(matrix.os, 'macos') && '2' || '16' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Linux and Windows run on the 64-core runners of the organization, as | |
| # upstream's tests_primary.yml; macOS on the hosted runner. | |
| # 3.12 is our most used Python version (base) | |
| os: [playwright-x64-ubuntu24-64-core, playwright-x64-server2025-64-core, macos-15-xlarge] | |
| python-version: ['3.12'] | |
| browser: [chromium, firefox, webkit] | |
| include: | |
| - os: playwright-x64-server2025-64-core | |
| python-version: '3.10' | |
| browser: chromium | |
| - os: macos-15-xlarge | |
| python-version: '3.10' | |
| browser: chromium | |
| - os: playwright-x64-ubuntu24-64-core | |
| python-version: '3.10' | |
| browser: chromium | |
| - os: playwright-x64-server2025-64-core | |
| python-version: '3.11' | |
| browser: chromium | |
| - os: macos-15-xlarge | |
| python-version: '3.11' | |
| browser: chromium | |
| - os: playwright-x64-ubuntu24-64-core | |
| python-version: '3.11' | |
| browser: chromium | |
| - os: playwright-x64-server2025-64-core | |
| python-version: '3.13' | |
| browser: chromium | |
| - os: macos-15-xlarge | |
| python-version: '3.13' | |
| browser: chromium | |
| - os: playwright-x64-ubuntu24-64-core | |
| python-version: '3.13' | |
| browser: chromium | |
| - os: playwright-x64-server2025-64-core | |
| python-version: '3.14' | |
| browser: chromium | |
| - os: macos-15-xlarge | |
| python-version: '3.14' | |
| browser: chromium | |
| - os: playwright-x64-ubuntu24-64-core | |
| python-version: '3.14' | |
| browser: chromium | |
| # Intel macOS, once: *-large is Intel, *-xlarge is arm64, as upstream notes. | |
| - os: macos-15-large | |
| python-version: '3.12' | |
| browser: chromium | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: microsoft/playwright/.github/actions/ci-env@main | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: '24' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r local-requirements.txt | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Get Playwright | |
| run: python scripts/upstream.py checkout | |
| - name: Build the driver and the wheel | |
| run: python -m build --wheel | |
| - name: Install browsers | |
| id: install | |
| run: python -m playwright install --with-deps ${{ matrix.browser }} | |
| - name: Common Tests | |
| run: $CI_ENV_EXEC pytest tests/common --browser=${{ matrix.browser }} | |
| - name: Test Reference count | |
| run: $CI_ENV_EXEC pytest tests/test_reference_count_async.py --browser=${{ matrix.browser }} | |
| - name: Test Wheel Installation | |
| run: $CI_ENV_EXEC pytest tests/test_installation.py::test_install --browser=${{ matrix.browser }} | |
| - name: Test Sync API | |
| run: $CI_ENV_EXEC pytest tests/sync --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes | |
| - name: Test Async API | |
| # Also after a failed sync step: the two suites report on their own. | |
| if: ${{ !cancelled() && steps.install.outcome == 'success' }} | |
| run: $CI_ENV_EXEC pytest tests/async --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes | |
| test-stable: | |
| name: Stable | |
| # The branded browsers on the 3-core macOS runner take longer than the bundled ones. | |
| timeout-minutes: 120 | |
| env: | |
| # The dot reporter of the test steps (scripts/pytest_dot_reporter.py). | |
| PYTHONPATH: scripts | |
| WORKERS: ${{ startsWith(matrix.os, 'macos') && '2' || '16' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [playwright-x64-ubuntu24-64-core, playwright-x64-server2025-64-core, macos-15-xlarge] | |
| browser-channel: [chrome] | |
| include: | |
| - os: playwright-x64-server2025-64-core | |
| browser-channel: msedge | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: microsoft/playwright/.github/actions/ci-env@main | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.10" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: '24' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r local-requirements.txt | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Get Playwright | |
| run: python scripts/upstream.py checkout | |
| - name: Build the driver and the wheel | |
| run: python -m build --wheel | |
| - name: Install browsers | |
| id: install | |
| run: python -m playwright install ${{ matrix.browser-channel }} --with-deps | |
| - name: Common Tests | |
| run: $CI_ENV_EXEC pytest tests/common --browser=chromium --browser-channel=${{ matrix.browser-channel }} | |
| - name: Test Sync API | |
| run: $CI_ENV_EXEC pytest tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes | |
| - name: Test Async API | |
| # Also after a failed sync step: the two suites report on their own. | |
| if: ${{ !cancelled() && steps.install.outcome == 'success' }} | |
| run: $CI_ENV_EXEC pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes | |
| sdist: | |
| name: Source distribution | |
| # The sdist has the driver without Node.js, for the installs that reject wheels | |
| # (poetry's installer.no-binary) and the platforms without a wheel. It runs with | |
| # the Node.js of PLAYWRIGHT_NODEJS_PATH. | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.10" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: '24' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r local-requirements.txt | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Get Playwright | |
| run: python scripts/upstream.py checkout | |
| # The wheel build puts the driver with Node.js into the checkout, for the | |
| # install-deps step below. The test installs the sdist in its own venv. | |
| - name: Build the driver and the wheel | |
| run: python -m build --wheel | |
| - name: Build the sdist | |
| run: python -m build --sdist | |
| - name: Install browser dependencies | |
| run: python -m playwright install-deps chromium | |
| - name: Test the sdist installation | |
| run: pytest tests/test_installation.py::test_install_sdist --browser=chromium | |
| test_examples: | |
| name: Examples | |
| runs-on: ubuntu-22.04 | |
| defaults: | |
| run: | |
| working-directory: examples/todomvc/ | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies & browsers | |
| id: install | |
| run: | | |
| pip install -r requirements.txt | |
| python -m playwright install --with-deps chromium | |
| - name: Common Tests | |
| run: pytest |