ci: add trusted PyPI publishing #20
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, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev] | |
| - name: Setup Chrome | |
| uses: browser-actions/setup-chrome@v1 | |
| with: | |
| chrome-version: stable | |
| - name: Run unit tests | |
| run: | | |
| python -m pytest tests/unit/ -v --tb=short | |
| - name: Run integration tests | |
| run: | | |
| python -m pytest tests/integration/ -v --tb=short | |
| - name: Test v1.0 Features | |
| run: | | |
| python -c "from waitless.adapters import get_available_adapters; print('Adapters:', get_available_adapters())" | |
| python -c "from waitless import StabilizationConfig; c = StabilizationConfig(track_websocket=True, framework_hooks=['react']); print('v1.0 config:', c.track_websocket, c.framework_hooks)" | |
| - name: Generate Shadow DOM Evidence | |
| run: | | |
| python tests/evidence/generate_evidence.py | |
| - name: Upload Evidence Screenshot | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: shadow-dom-evidence-py${{ matrix.python-version }} | |
| path: shadow_dom_evidence.png | |
| if-no-files-found: warn | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install lint dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev] | |
| - name: Lint Python sources | |
| run: | | |
| python -m ruff check waitless tests | |
| - name: Check imports | |
| run: | | |
| python -c "import waitless; print(f'waitless {waitless.__version__} imports successfully')" | |
| python -c "from waitless.adapters import ReactAdapter, AngularAdapter, VueAdapter; print('Framework adapters OK')" | |
| package-smoke: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Build distributions | |
| run: | | |
| python -m pip install --upgrade pip build | |
| python -m build | |
| - name: Verify clean wheel installation | |
| run: | | |
| python -m venv wheel-smoke | |
| source wheel-smoke/bin/activate | |
| python -m pip install dist/*.whl | |
| python -c "import importlib.metadata, selenium, waitless; assert importlib.metadata.version('waitless') == waitless.__version__; print(waitless.__version__, selenium.__version__)" |