name: Python Unit Tests on: pull_request: branches: ["main", "feature*"] paths: - "python/**" env: # Configure a constant location for the uv cache UV_CACHE_DIR: /tmp/.uv-cache jobs: python-unit-tests: name: Python Unit Tests runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: true matrix: python-version: ["3.10", "3.11", "3.12"] os: [ubuntu-latest, windows-latest, macos-latest] experimental: [false] test-suite: ["unit-all-except-dapr", "dapr"] exclude: - python-version: "3.10" os: macos-latest - python-version: "3.11" os: macos-latest include: - python-version: "3.13" os: "ubuntu-latest" experimental: true test-suite: "unit-all-except-dapr" env: UV_PYTHON: ${{ matrix.python-version }} permissions: contents: write defaults: run: working-directory: python steps: - uses: actions/checkout@v5 - name: Set up uv uses: astral-sh/setup-uv@v6 with: version: "0.5.x" enable-cache: true cache-suffix: ${{ runner.os }}-${{ matrix.python-version }} cache-dependency-glob: "**/uv.lock" - name: Install the project (all extras) if: matrix.test-suite == 'unit-all-except-dapr' run: uv sync --all-extras --dev -U --prerelease=if-necessary-or-explicit - name: Install the project (dapr tests) if: matrix.test-suite == 'dapr' run: uv sync --extra pandas --dev -U --prerelease=if-necessary-or-explicit && uv pip install "dapr>=1.14.0" "dapr-ext-fastapi>=1.14.0" "flask-dapr>=1.14.0" - name: Test with pytest (all except dapr) if: matrix.test-suite == 'unit-all-except-dapr' env: PYTHON_GIL: ${{ matrix.gil }} run: uv run --frozen pytest --junitxml=pytest.xml ./tests/unit --ignore=tests/unit/processes/dapr_runtime - name: Test dapr with pytest if: matrix.test-suite == 'dapr' env: PYTHON_GIL: ${{ matrix.gil }} run: uv run --frozen pytest --junitxml=pytest-dapr.xml ./tests/unit/processes/dapr_runtime - name: Surface failing tests if: ${{ !matrix.experimental && matrix.test-suite == 'unit-all-except-dapr' }} uses: pmeier/pytest-results-action@v0.7.2 with: path: python/pytest.xml summary: true display-options: fEX fail-on-empty: true title: Test results