Expect new page and fix js windows handling #903
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: 🕵️ Test suite | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: ["opened", "synchronize", "reopened"] | |
| schedule: | |
| # Run every Friday at 23:59 UTC | |
| - cron: 59 23 * * 5 | |
| jobs: | |
| setup-browsers: | |
| name: 🌐 Setup Playwright Browsers | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| outputs: | |
| playwright-version: ${{ steps.playwright-version.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Playwright | |
| run: pip install playwright | |
| - name: Get Playwright version | |
| id: playwright-version | |
| run: echo "version=$(pip show playwright | grep Version | cut -d' ' -f2)" >> $GITHUB_OUTPUT | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}-browsers | |
| restore-keys: | | |
| playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}- | |
| - name: Install browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: | | |
| playwright install chromium firefox | |
| playwright install-deps | |
| tests: | |
| # Run unit tests on different version of python and browser | |
| name: 🐍 Python-${{ matrix.python-version }}-${{ matrix.browser }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| needs: setup-browsers | |
| strategy: | |
| matrix: | |
| browser: [chromium, firefox] | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python-${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Playwright | |
| run: pip install playwright | |
| - name: Restore Playwright browsers cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ needs.setup-browsers.outputs.playwright-version }}-browsers | |
| fail-on-cache-miss: true | |
| - name: UnitTest - Python-${{ matrix.python-version }}-${{ matrix.browser }} | |
| run: | | |
| pip install -e .[test] | |
| pytest -n 3 -sqvv --browser=${{ matrix.browser }} --headless --cov=src --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: coverage.xml | |
| flags: unittests | |
| name: ${{ github.run_id }}-py-${{ matrix.python-version }}-${{ matrix.browser }} | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| docs: | |
| name: Docs Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| cache: 'pip' | |
| - name: Install Deps | |
| run: | | |
| pip install -U pip wheel | |
| pip install .[docs] | |
| - name: Build Docs | |
| run: sphinx-build -b html -d build/sphinx-doctrees docs build/htmldocs | |
| - name: Archive Docs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sphinx-htmldocs | |
| path: build/htmldocs | |
| platform: | |
| # Check package properly install on different platform (dev setup) | |
| name: 💻 Platform-${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 20 | |
| needs: [setup-browsers, tests] | |
| strategy: | |
| matrix: | |
| os: [windows-latest, macos-latest] # We are running test on ubuntu linux. | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| architecture: "x64" | |
| cache: 'pip' | |
| - name: Development setup on ${{ matrix.os }} | |
| run: | | |
| pip install -e .[dev] | |
| python -c "from widgetastic.widget import Widget, Browser" | |
| package: | |
| name: ⚙️ Build & Verify Package | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: [setup-browsers, tests, docs] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| architecture: "x64" | |
| cache: 'pip' | |
| - name: Build and verify with twine | |
| run: | | |
| pip install wheel twine | |
| pip wheel --no-deps -w dist . | |
| ls -l dist | |
| twine check dist/* |