blob: 7367a5800e8bc86650cf984c53feac43134fca4f [file] [edit]
name: CI - Python
on:
workflow_call:
inputs:
targets:
required: false
type: string
default: ''
run-full-suite:
required: false
type: boolean
default: true
workflow_dispatch:
permissions:
contents: read
jobs:
docs:
name: Documentation
if: ${{ inputs.run-full-suite }}
runs-on: ubuntu-latest
steps:
- name: Checkout source tree
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Generate docs
run: |
tox -c py/tox.ini
env:
TOXENV: docs
typing:
name: Type Checker
if: ${{ inputs.run-full-suite }}
runs-on: ubuntu-latest
steps:
- name: Checkout source tree
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run type checking
run: |
tox -c py/tox.ini || true
env:
TOXENV: mypy
unit-tests:
name: Unit Tests
if: ${{ inputs.run-full-suite }}
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.14']
os: [ubuntu, macos, windows]
with:
name: Unit Tests (${{ matrix.python-version }}, ${{ matrix.os }})
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
run: bazel test --local_test_jobs 1 //py:unit
filter-targets:
name: Filter Targets
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.filter.outputs.targets }}
steps:
- name: Filter Python targets
id: filter
shell: bash
run: |
targets="${{ inputs.targets }}"
filtered=()
for t in $targets; do
[[ "$t" == //py* ]] && filtered+=("$t")
done
if [ ${#filtered[@]} -eq 0 ]; then
echo "targets=//py/..." >> "$GITHUB_OUTPUT"
else
echo "targets=${filtered[*]}" >> "$GITHUB_OUTPUT"
fi
browser-tests:
name: Browser Tests
needs: filter-targets
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
browser: [chrome, firefox, chrome-remote]
os: [windows]
include:
- browser: safari
os: macos
with:
name: Browser Tests (${{ matrix.browser }}, ${{ matrix.os }})
browser: ${{ matrix.browser }}
os: ${{ matrix.os }}
run: >
bazel test
--keep_going
--build_tests_only
--flaky_test_attempts 3
--local_test_jobs 1
--test_tag_filters=${{ matrix.browser }}
--pin_browsers=false
--test_env=SE_SKIP_DRIVER_IN_PATH
--test_env=SE_FORCE_BROWSER_DOWNLOAD=true
${{ needs.filter-targets.outputs.targets }}