Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 34 additions & 33 deletions .github/workflows/ci-tests-fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,49 +62,57 @@ jobs:
env:
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/"
TORCH_URL_TEST: "https://download.pytorch.org/whl/test/cpu/"
# TODO: Remove this - Enable running MPS tests on this platform
DISABLE_MPS: ${{ matrix.os == 'macOS-14' && '1' || '0' }}
steps:
- uses: actions/checkout@v5

- name: Set up Python ${{ matrix.config.python-version }}
uses: actions/setup-python@v5
- name: Install uv and set Python version
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.config.python-version || '3.9' }}
# TODO: Avoid activating environment like this
# see: https://github.com/astral-sh/setup-uv/tree/v6/?tab=readme-ov-file#activate-environment
activate-environment: true
enable-cache: true

- name: basic setup
run: pip install -q -r .actions/requirements.txt
- name: Basic setup
run: uv pip install -q -r .actions/requirements.txt

- name: Append Env. vars for Linux
if: ${{ runner.os == 'Linux' }}
run: echo "GLOO_SOCKET_IFNAME=eth0" >> $GITHUB_ENV

- name: Append Env. vars for MacOS
if: ${{ runner.os == 'macOS' }}
run: echo "GLOO_SOCKET_IFNAME=lo0" >> $GITHUB_ENV

- name: Append Env. vars for Windows
if: ${{ runner.os == 'windows' }}
run: |
# Avoid issue on Windows with PyTorch 2.4: "RuntimeError: use_libuv was requested but PyTorch was build without libuv support"
echo "USE_LIBUV=0" >> $GITHUB_ENV

- name: Set min. dependencies
if: ${{ matrix.config.requires == 'oldest' }}
run: |
cd requirements/fabric
pip install -U "lightning-utilities[cli]"
uv pip install -U "lightning-utilities[cli]"
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'strategies.txt', 'test.txt']"
pip install "cython<3.0" wheel
pip install "pyyaml==5.4" --no-build-isolation
uv pip install "cython<3.0" wheel
uv pip install "pyyaml==5.4" --no-build-isolation

- name: Adjust PyTorch versions in requirements files
if: ${{ matrix.config.requires != 'oldest' }}
run: |
pip install -q -r requirements/ci.txt
uv 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.config.pytorch-version }}; \
done

- name: pip wheels cache
uses: actions/cache/restore@v4
with:
path: ${{ env.PYPI_CACHE_DIR }}
key: pypi_wheels
- run: |
mkdir -p $PYPI_CACHE_DIR
ls -lh $PYPI_CACHE_DIR

- name: Expand Env. variables
run: |
# Switch PyTorch URL between stable and test/future
Expand All @@ -113,25 +121,15 @@ jobs:
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.config.pkg-name}}' != 'lightning' else 'fabric-'))" >> $GITHUB_ENV
- name: Append Env. vars for MacOS
if: ${{ runner.os == 'macOS' }}
run: |
# trying to avoid "gloo" issue with SIGABRT
echo "GLOO_SOCKET_IFNAME=lo0" >> $GITHUB_ENV
- name: Append Env. vars for Windows
if: ${{ runner.os == 'windows' }}
run: |
# Avoid issue on Windows with PyTorch 2.4: "RuntimeError: use_libuv was requested but PyTorch was build without libuv support"
echo "USE_LIBUV=0" >> $GITHUB_ENV

- name: Install package & dependencies
timeout-minutes: 20
run: |
pip install -e ".[${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
-U --upgrade-strategy=eager --prefer-binary \
--extra-index-url="${TORCH_URL}" \
--find-links="${PYPI_CACHE_DIR}"
pip list
uv pip install ".[${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
--upgrade \
--find-links="${TORCH_URL}"
uv pip list

- name: Dump handy wheels
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
continue-on-error: true
Expand Down Expand Up @@ -179,6 +177,9 @@ jobs:
name: CPU-coverage
fail_ci_if_error: false

- name: Minimize uv cache
run: uv cache prune --ci

fabric-cpu-guardian:
runs-on: ubuntu-latest
needs: fabric-cpu
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-tests-pytorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobs:
- name: Append Env. vars for Linux
if: ${{ runner.os == 'Linux' }}
run: echo "GLOO_SOCKET_IFNAME=eth0" >> $GITHUB_ENV

- name: Append Env. vars for MacOS
if: ${{ runner.os == 'macOS' }}
run: echo "GLOO_SOCKET_IFNAME=lo0" >> $GITHUB_ENV
Expand Down
Loading