Framework-agnostic rework #100
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: tox | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| # ============================================================================ | |
| # Minimal tests - no backend required (fastest, catches interface issues) | |
| # ============================================================================ | |
| minimal-tests: | |
| name: Minimal (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11"] | |
| 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 tox tox-gh-actions | |
| - name: Run minimal tests | |
| run: tox -e py$(echo ${{ matrix.python-version }} | tr -d .)-minimal | |
| # ============================================================================ | |
| # Backend-specific tests - run in parallel | |
| # ============================================================================ | |
| backend-tests: | |
| name: ${{ matrix.backend }} (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11"] | |
| backend: [tensorflow, pytorch] | |
| exclude: | |
| # TensorFlow 2.x has limited support for Python 3.11 | |
| - python-version: "3.11" | |
| backend: tensorflow | |
| 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 tox tox-gh-actions | |
| - name: Run ${{ matrix.backend }} tests | |
| run: tox -e py$(echo ${{ matrix.python-version }} | tr -d .)-${{ matrix.backend }} | |
| env: | |
| CUDA_VISIBLE_DEVICES: "" | |
| # ============================================================================ | |
| # Full integration tests - both backends (runs on main/release only) | |
| # ============================================================================ | |
| integration-tests: | |
| name: Integration (Both backends) | |
| runs-on: ubuntu-latest | |
| # Only run full integration on main branch or releases | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10"] | |
| 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 tox tox-gh-actions | |
| - name: Run integration tests with both backends | |
| run: tox -e py$(echo ${{ matrix.python-version }} | tr -d .)-all | |
| env: | |
| CUDA_VISIBLE_DEVICES: "" | |
| # ============================================================================ | |
| # Test summary gate | |
| # ============================================================================ | |
| tests-complete: | |
| name: All Tests Complete | |
| needs: [minimal-tests, backend-tests] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Check test results | |
| run: | | |
| if [[ "${{ needs.minimal-tests.result }}" == "failure" ]] || \ | |
| [[ "${{ needs.backend-tests.result }}" == "failure" ]]; then | |
| echo "Some tests failed!" | |
| exit 1 | |
| fi | |
| echo "All tests passed!" | |