Skip to content

Commit 8dd590c

Browse files
committed
add config field
1 parent bd19075 commit 8dd590c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

.github/workflows/ci-tests-pytorch.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
fail-fast: false
4444
matrix:
4545
os: [macOS-14, ubuntu-22.04, windows-2022]
46-
include:
46+
config:
4747
# only run PyTorch latest
4848
- { pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
4949
- { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
@@ -64,7 +64,7 @@ jobs:
6464
- { pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
6565
timeout-minutes: 50
6666
env:
67-
PACKAGE_NAME: ${{ matrix.pkg-name }}
67+
PACKAGE_NAME: ${{ matrix.config.pkg-name }}
6868
TORCH_URL: "https://download.pytorch.org/whl/cpu/"
6969
TORCH_URL_STABLE: "https://download.pytorch.org/whl/cpu/"
7070
TORCH_URL_TEST: "https://download.pytorch.org/whl/test/cpu/"
@@ -75,10 +75,10 @@ jobs:
7575
steps:
7676
- uses: actions/checkout@v5
7777

78-
- name: Set up Python ${{ matrix.python-version }}
78+
- name: Set up Python ${{ matrix.config.python-version }}
7979
uses: actions/setup-python@v5
8080
with:
81-
python-version: ${{ matrix.python-version || '3.9' }}
81+
python-version: ${{ matrix.config.python-version || '3.9' }}
8282

8383
- name: basic setup
8484
run: pip install -q -r .actions/requirements.txt
@@ -98,7 +98,7 @@ jobs:
9898
pip install -q -r requirements/ci.txt
9999
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
100100
for fpath in `ls requirements/**/*.txt`; do \
101-
python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \
101+
python ./adjust-torch-versions.py $fpath ${{ matrix.config.pytorch-version }}; \
102102
done
103103
cat requirements/pytorch/base.txt
104104
@@ -114,13 +114,13 @@ jobs:
114114
- name: Env. variables
115115
run: |
116116
# Switch PyTorch URL between stable and test/future
117-
python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV
117+
python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.config.pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV
118118
# Switch coverage scope
119-
python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.pkg-name}}' == 'lightning' else 'pytorch_lightning'))" >> $GITHUB_ENV
119+
python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.config.pkg-name}}' == 'lightning' else 'pytorch_lightning'))" >> $GITHUB_ENV
120120
# if you install mono-package set dependency only for this subpackage
121-
python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.pkg-name}}' != 'lightning' else 'pytorch-'))" >> $GITHUB_ENV
121+
python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.config.pkg-name}}' != 'lightning' else 'pytorch-'))" >> $GITHUB_ENV
122122
# Avoid issue on Windows with PyTorch 2.4: "RuntimeError: use_libuv was requested but PyTorch was build without libuv support"
123-
python -c "print('USE_LIBUV=0' if '${{matrix.os}}' == 'windows-2022' and '${{matrix.pytorch-version}}' == '2.4' else '')" >> $GITHUB_ENV
123+
python -c "print('USE_LIBUV=0' if '${{matrix.os}}' == 'windows-2022' and '${{matrix.config.pytorch-version}}' == '2.4' else '')" >> $GITHUB_ENV
124124
125125
- name: Install package & dependencies
126126
timeout-minutes: 20
@@ -133,11 +133,11 @@ jobs:
133133
--find-links="https://download.pytorch.org/whl/torch-tensorrt"
134134
pip list
135135
- name: Drop LAI from extensions
136-
if: ${{ matrix.pkg-name != 'lightning' }}
136+
if: ${{ matrix.config.pkg-name != 'lightning' }}
137137
# Lightning is dependency of Habana or other accelerators/integrations so in case we test PL we need to remove it
138138
run: pip uninstall -y lightning
139139
- name: Drop PL for LAI
140-
if: ${{ matrix.pkg-name == 'lightning' }}
140+
if: ${{ matrix.config.pkg-name == 'lightning' }}
141141
run: pip uninstall -y pytorch-lightning
142142
- name: Dump handy wheels
143143
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
@@ -158,10 +158,10 @@ jobs:
158158
run: |
159159
set -e
160160
python requirements/pytorch/check-avail-extras.py
161-
python -c "from torch import __version__ as ver; assert ver.startswith('${{ matrix.pytorch-version }}'), ver"
161+
python -c "from torch import __version__ as ver; assert ver.startswith('${{ matrix.config.pytorch-version }}'), ver"
162162
163163
- name: Adjust tests / env. -> PL
164-
if: ${{ matrix.pkg-name != 'lightning' }}
164+
if: ${{ matrix.config.pkg-name != 'lightning' }}
165165
run: |
166166
python .actions/assistant.py copy_replace_imports --source_dir="./tests" \
167167
--source_import="lightning.fabric,lightning.pytorch" \
@@ -211,7 +211,7 @@ jobs:
211211
with:
212212
token: ${{ secrets.CODECOV_TOKEN }}
213213
file: tests/tests_pytorch/coverage.xml
214-
flags: ${{ env.COVERAGE_SCOPE }},cpu,pytest-full,python${{ matrix.python-version }},pytorch${{ matrix.pytorch-version }}
214+
flags: ${{ env.COVERAGE_SCOPE }},cpu,pytest-full,python${{ matrix.config.python-version }},pytorch${{ matrix.config.pytorch-version }}
215215
name: CPU-coverage
216216
fail_ci_if_error: false
217217

0 commit comments

Comments
 (0)