Fix CDP browser detection #198
Workflow file for this run
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, pull_request] | |
| jobs: | |
| ci: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # UV requires Python 3.8+ to run, but it can manage environments for older Python versions. | |
| # actions/setup-python handles installing the target Python for the job. | |
| python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up UV | |
| uses: astral-sh/setup-uv@v1 # official action for UV | |
| with: | |
| # Optional: Pin to a specific UV version for more deterministic builds | |
| # version: "0.1.20" # Example version, check latest if pinning | |
| enable-cache: true # Optional: enable UV caching for faster builds | |
| - name: Install dependencies | |
| run: | | |
| # Use --system to install into the Python environment set up by actions/setup-python. | |
| uv pip install --system -e .[test,lint] | |
| shell: bash | |
| - name: Flake8 linting | |
| run: | | |
| python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| shell: bash | |
| - name: Run PyTest | |
| run: python -m pytest | |
| shell: bash | |
| publish: | |
| name: Build and publish to PyPI | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/html2image | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' # Use a recent Python for build tools | |
| - name: Set up UV | |
| uses: astral-sh/setup-uv@v1 | |
| with: | |
| enable-cache: true | |
| - name: Install build dependencies | |
| # Ensure 'build' is listed in your pyproject.toml [project.optional-dependencies.dev] | |
| # or install it explicitly here. | |
| run: uv pip install --system build | |
| shell: bash | |
| - name: Build package | |
| run: python -m build # This will use hatchling as defined in pyproject.toml | |
| shell: bash | |
| - name: Publish package to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |