blob: 54b378a8a96343fa82d7fdd30887081d22c983be [file] [log] [blame] [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
env:
TOXENV: typecheck
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
requirements:
name: Requirements Lock
if: ${{ inputs.run-full-suite }}
uses: ./.github/workflows/bazel.yml
with:
name: Requirements Lock
os: ubuntu
python-version: '3.10'
run: bazel test //py:requirements.test
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]
bidi: [true, false]
os: [windows]
include:
- browser: safari
bidi: false
os: macos
with:
name: Browser Tests (${{ matrix.browser }}${{ matrix.bidi && '-bidi' || '' }})
browser: ${{ matrix.browser }}
os: ${{ matrix.os }}
run: >
bazel test
--keep_going
--build_tests_only
--flaky_test_attempts 3
--local_test_jobs 1
--test_size_filters large
--test_tag_filters=${{ matrix.bidi && format('{0}-bidi', matrix.browser) || format('{0},-bidi,-remote', matrix.browser) }}
${{ needs.filter-targets.outputs.targets }}