diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index f4c66f425cc71..939f986cc187a 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -38,42 +38,29 @@ jobs: strategy: fail-fast: false matrix: - include: + os: [macOS-14, ubuntu-22.04, windows-2022] + config: # only run PyTorch latest - - { os: "macOS-14", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - - { os: "windows-2022", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - - { os: "macOS-14", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" } - - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" } - - { os: "windows-2022", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" } - - { os: "macOS-14", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" } - - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" } - - { os: "windows-2022", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" } - - { os: "macOS-14", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" } - - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" } - - { os: "windows-2022", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" } - - { os: "macOS-14", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" } - - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" } - - { os: "windows-2022", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" } + - { pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } + - { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" } + - { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" } + - { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" } + - { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" } + # only run PyTorch latest with Python latest, use Fabric scope to limit dependency issues - - { os: "macOS-14", pkg-name: "fabric", python-version: "3.12.7", pytorch-version: "2.6" } - - { os: "ubuntu-22.04", pkg-name: "fabric", python-version: "3.12.7", pytorch-version: "2.6" } - - { os: "windows-2022", pkg-name: "fabric", python-version: "3.12.7", pytorch-version: "2.6" } - # "oldest" versions tests, only on minimum Python - - { os: "macOS-14", pkg-name: "fabric", pytorch-version: "2.1", requires: "oldest" } - - { os: "ubuntu-22.04", pkg-name: "fabric", pytorch-version: "2.1", requires: "oldest" } - - { os: "windows-2022", pkg-name: "fabric", pytorch-version: "2.1", requires: "oldest" } + - { pkg-name: "fabric", python-version: "3.12.7", pytorch-version: "2.6" } + # "fabric" installs the standalone package - - { os: "macOS-14", pkg-name: "fabric", python-version: "3.10", pytorch-version: "2.7" } - - { os: "ubuntu-22.04", pkg-name: "fabric", python-version: "3.10", pytorch-version: "2.7" } - - { os: "windows-2022", pkg-name: "fabric", python-version: "3.10", pytorch-version: "2.7" } + - { pkg-name: "fabric", python-version: "3.10", pytorch-version: "2.7" } + # adding recently cut Torch 2.7 - FUTURE - - { os: "macOS-14", pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.8" } - - { os: "ubuntu-22.04", pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.8" } - - { os: "windows-2022", pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.8" } + - { pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.8" } + + # "oldest" versions tests, only on minimum Python + - { pkg-name: "fabric", pytorch-version: "2.1", requires: "oldest" } timeout-minutes: 25 # because of building grpcio on Mac env: - PACKAGE_NAME: ${{ matrix.pkg-name }} + PACKAGE_NAME: ${{ matrix.config.pkg-name }} FREEZE_REQUIREMENTS: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }} PYPI_CACHE_DIR: "_pip-wheels" TORCH_URL_STABLE: "https://download.pytorch.org/whl/cpu/" @@ -83,10 +70,10 @@ jobs: steps: - uses: actions/checkout@v5 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.config.python-version }} uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version || '3.9' }} + python-version: ${{ matrix.config.python-version || '3.9' }} - name: basic setup run: pip install -q -r .actions/requirements.txt @@ -106,7 +93,7 @@ jobs: pip install -q -r requirements/ci.txt python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py for fpath in `ls requirements/**/*.txt`; do \ - python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \ + python ./adjust-torch-versions.py $fpath ${{ matrix.config.pytorch-version }}; \ done - name: pip wheels cache @@ -121,11 +108,11 @@ jobs: - name: Expand Env. variables run: | # Switch PyTorch URL between stable and test/future - python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV + python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.config.pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV # Switch coverage scope - python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.pkg-name}}' == 'lightning' else 'lightning_fabric'))" >> $GITHUB_ENV + python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.config.pkg-name}}' == 'lightning' else 'lightning_fabric'))" >> $GITHUB_ENV # if you install mono-package set dependency only for this subpackage - python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.pkg-name}}' != 'lightning' else 'fabric-'))" >> $GITHUB_ENV + python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.config.pkg-name}}' != 'lightning' else 'fabric-'))" >> $GITHUB_ENV - name: Append Env. vars for MacOS if: ${{ runner.os == 'macOS' }} run: | @@ -155,7 +142,7 @@ jobs: cache-key: "pypi_wheels" - name: Adjust tests - if: ${{ matrix.pkg-name != 'lightning' }} + if: ${{ matrix.config.pkg-name != 'lightning' }} run: | python .actions/assistant.py copy_replace_imports --source_dir="./tests" \ --source_import="lightning.fabric" --target_import="lightning_fabric" @@ -188,7 +175,7 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} file: tests/tests_fabric/coverage.xml - flags: ${{ env.COVERAGE_SCOPE }},cpu,pytest,python${{ matrix.python-version }} + flags: ${{ env.COVERAGE_SCOPE }},cpu,pytest,python${{ matrix.config.python-version }} name: CPU-coverage fail_ci_if_error: false