Use text format for jupyter notebooks using jupytext #38
Workflow file for this run
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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Python package | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths-ignore: | |
| - "docs/**" | |
| pull_request: | |
| branches: ["main"] | |
| paths-ignore: | |
| - "docs/**" | |
| jobs: | |
| build: | |
| name: Python unit tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| # note: installing torch and torchvision together ensures their version compatibility | |
| pip install torch==2.8.0 torchvision --index-url https://download.pytorch.org/whl/cpu | |
| pip install jupyter nbconvert pandas matplotlib | |
| pip install -r test-requirements.txt | |
| pip install -e .[cpu] | |
| - name: Test with pytest | |
| shell: bash | |
| run: | | |
| export JAX_PLATFORMS=cpu | |
| # Find all Python test files recursively | |
| find ./test -name "test_*.py" -type f | while IFS= read -r test_file; do | |
| # Skip tests with known issues | |
| if [[ "$test_file" == *"test_tf_integration.py"* ]]; then | |
| echo "Skipping ${test_file}. TODO(https://github.com/pytorch/xla/issues/8770): Investigate" | |
| continue | |
| fi | |
| echo "Running tests for $test_file" | |
| pytest "$test_file" | |
| done | |
| # Run distributed tests. | |
| XLA_FLAGS=--xla_force_host_platform_device_count=4 pytest -n 0 test_dist/ | |
| echo "Tests completed." | |
| - name: Test tutorials can run | |
| shell: bash | |
| run: | | |
| export JAX_PLATFORMS=cpu | |
| for FILE in $(find docs -name '*.py'); do | |
| python $FILE | |
| done |