@@ -41,63 +41,42 @@ jobs:
4141 id : changed-files
4242 uses :
tj-actions/[email protected] 4343
44- - name : Decide if the test should be skipped
45- id : skip
46- shell : bash -l {0}
47- run : |
48- FILTER='src/pytorch_lightning|requirements/pytorch|tests/tests_pytorch|examples/pl_*'
49- echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr " " "\n" > changed_files.txt
50- MATCHES=$(cat changed_files.txt | grep -E $FILTER)
51- echo $MATCHES
52- if [ -z "$MATCHES" ]; then
53- echo "Skip"
54- echo "::set-output name=continue::0"
55- else
56- echo "Continue"
57- echo "::set-output name=continue::1"
58- fi
59-
6044 - name : Set up Python ${{ matrix.python-version }}
61- if : ${{ (steps.skip.outputs.continue == '1') }}
6245 uses : actions/setup-python@v4
6346 with :
6447 python-version : ${{ matrix.python-version }}
6548
6649 - name : Reset caching
67- if : ${{ (steps.skip.outputs.continue == '1') }}
6850 run : python -c "import time; days = time.time() / 60 / 60 / 24; print(f'TIME_PERIOD=d{int(days / 2) * 2}')" >> $GITHUB_ENV
6951
7052 - name : basic setup
71- if : ${{ (steps.skip.outputs.continue == '1') }}
7253 run : |
7354 pip --version
7455 pip install -q -r .actions/requirements.txt
7556
7657 # Github Actions: Run step on specific OS: https://stackoverflow.com/a/57948488/4521646
7758 - name : Setup macOS
78- if : ${{ ( runner.os == 'macOS') && (steps.skip.outputs.continue == '1') }}
59+ if : runner.os == 'macOS'
7960 run : |
8061 brew install openmpi libuv # Horovod on macOS requires OpenMPI, Gloo not currently supported
8162
8263 - name : Setup Windows
83- if : ${{ ( runner.os == 'windows') && (steps.skip.outputs.continue == '1') }}
64+ if : runner.os == 'windows'
8465 run : |
8566 python .actions/assistant.py requirements_prune_pkgs horovod
8667
8768 - name : Set min. dependencies
88- if : ${{ ( matrix.requires == 'oldest') && (steps.skip.outputs.continue == '1') }}
69+ if : matrix.requires == 'oldest'
8970 run : |
9071 python .actions/assistant.py replace_oldest_ver
9172
9273 # Note: This uses an internal pip API and may not always work
9374 # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
9475 - name : Get pip cache dir
95- if : ${{ (steps.skip.outputs.continue == '1') }}
9676 id : pip-cache
9777 run : echo "::set-output name=dir::$(pip cache dir)"
9878
9979 - name : pip cache
100- if : ${{ (steps.skip.outputs.continue == '1') }}
10180 uses : actions/cache@v3
10281 with :
10382 path : ${{ steps.pip-cache.outputs.dir }}
@@ -106,11 +85,9 @@ jobs:
10685 ${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-
10786
10887 - name : Pull legacy checkpoints
109- if : ${{ (steps.skip.outputs.continue == '1') }}
11088 run : bash .actions/pull_legacy_checkpoints.sh
11189
11290 - name : Install dependencies
113- if : ${{ (steps.skip.outputs.continue == '1') }}
11491 env :
11592 PACKAGE_NAME : pytorch
11693 FREEZE_REQUIREMENTS : 1
@@ -122,12 +99,10 @@ jobs:
12299 shell : bash
123100
124101 - name : DocTests
125- if : ${{ (steps.skip.outputs.continue == '1') }}
126102 working-directory : ./src
127103 run : pytest pytorch_lightning --cov=pytorch_lightning
128104
129105 - name : Install extra dependencies
130- if : ${{ (steps.skip.outputs.continue == '1') }}
131106 run : |
132107 # adjust versions according installed Torch version
133108 python ./requirements/pytorch/adjust-versions.py requirements/pytorch/extra.txt
@@ -136,7 +111,7 @@ jobs:
136111 shell : bash
137112
138113 - name : Reinstall Horovod if necessary
139- if : ${{ ( runner.os != 'windows') && (steps.skip.outputs.continue == '1') }}
114+ if : runner.os != 'windows'
140115 env :
141116 HOROVOD_BUILD_ARCH_FLAGS : " -mfma"
142117 HOROVOD_WITHOUT_MXNET : 1
@@ -153,58 +128,53 @@ jobs:
153128 shell : bash
154129
155130 - name : Cache datasets
156- if : ${{ (steps.skip.outputs.continue == '1') }}
157131 uses : actions/cache@v3
158132 with :
159133 path : Datasets
160134 key : pl-dataset
161135
162136 - name : Sanity check
163- if : ${{ (steps.skip.outputs.continue == '1') }}
164137 run : python requirements/pytorch/check-avail-extras.py
165138
166139 - name : Testing Warnings
167140 # the stacklevel can only be set on >=3.7
168- if : ${{ (steps.skip.outputs.continue == '1') && ( matrix.python-version != '3.7' ) }}
141+ if : ${{ matrix.python-version != '3.7' }}
169142 working-directory : tests/tests_pytorch
170143 # needs to run outside of `pytest`
171144 run : python utilities/test_warnings.py
172145
173146 - name : Testing PyTorch
174- if : ${{ (steps.skip.outputs.continue == '1') }}
175147 working-directory : tests/tests_pytorch
176148 # NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003
177149 run : coverage run --source pytorch_lightning -m pytest -v --durations=50 --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
178150
179151 - name : Upload pytest results
180- if : ${{ ( failure()) && (steps.skip.outputs.continue == '1') }}
152+ if : failure()
181153 uses : actions/upload-artifact@v3
182154 with :
183155 name : unittest-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}
184156 path : tests/tests_pytorch/results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
185157
186158 - name : Prepare Examples
187- if : ${{ (steps.skip.outputs.continue == '1') }}
188159 run : |
189160 # adjust versions according installed Torch version
190161 python ./requirements/pytorch/adjust-versions.py requirements/pytorch/examples.txt
191162 pip install -r requirements/pytorch/examples.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
192163
193164 - name : Run Examples
194- if : ${{ (steps.skip.outputs.continue == '1') }}
195165 working-directory : ./examples
196166 run : python -m pytest test_pl_examples.py -v --durations=10
197167
198168 - name : Statistics
199- if : ${{ ( success()) && (steps.skip.outputs.continue == '1') }}
169+ if : success()
200170 working-directory : tests/tests_pytorch
201171 run : |
202172 coverage report
203173 coverage xml
204174
205175 - name : Upload coverage to Codecov
206176 uses : codecov/codecov-action@v3
207- if : ${{ ( always()) && (steps.skip.outputs.continue == '1') }}
177+ if : always()
208178 # see: https://github.com/actions/toolkit/issues/399
209179 continue-on-error : true
210180 with :
0 commit comments