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
25 changes: 2 additions & 23 deletions .github/workflows/ci-pytorch-test-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,7 @@ jobs:
id: changed-files
uses: tj-actions/[email protected]

- name: Decide if the test should be skipped
id: skip
shell: bash -l {0}
run: |
FILTER='src/pytorch_lightning|requirements/pytorch|tests/tests_pytorch|examples/pl_*'
echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr " " "\n" > changed_files.txt
MATCHES=$(cat changed_files.txt | grep -E $FILTER)
echo $MATCHES
if [ -z "$MATCHES" ]; then
echo "Skip"
echo "::set-output name=continue::0"
else
echo "Continue"
echo "::set-output name=continue::1"
fi

- name: Update base dependencies
if: ${{ (steps.skip.outputs.continue == '1') }}
env:
PACKAGE_NAME: pytorch
FREEZE_REQUIREMENTS: 1
Expand All @@ -70,12 +53,10 @@ jobs:
run: pip install "Pillow<9.0" # It messes with torchvision

- name: DocTests
if: ${{ (steps.skip.outputs.continue == '1') }}
working-directory: ./src
run: pytest pytorch_lightning --cov=pytorch_lightning

- name: Update all dependencies
if: ${{ (steps.skip.outputs.continue == '1') }}
env:
HOROVOD_BUILD_ARCH_FLAGS: "-mfma"
HOROVOD_WITHOUT_MXNET: 1
Expand All @@ -95,11 +76,9 @@ jobs:
python requirements/pytorch/check-avail-extras.py

- name: Pull legacy checkpoints
if: ${{ (steps.skip.outputs.continue == '1') }}
run: bash .actions/pull_legacy_checkpoints.sh

- name: Testing PyTorch
if: ${{ (steps.skip.outputs.continue == '1') }}
working-directory: tests/tests_pytorch
run: coverage run --source pytorch_lightning -m pytest -v --timeout 150 --durations=50 --junitxml=results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml

Expand All @@ -111,15 +90,15 @@ jobs:
if: failure()

- name: Statistics
if: ${{ success() && (steps.skip.outputs.continue == '1') }}
if: success()
working-directory: tests/tests_pytorch
run: |
coverage report
coverage xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: ${{ success() && (steps.skip.outputs.continue == '1') }}
if: success()
# see: https://github.com/actions/toolkit/issues/399
continue-on-error: true
with:
Expand Down
46 changes: 8 additions & 38 deletions .github/workflows/ci-pytorch-test-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,63 +41,42 @@ jobs:
id: changed-files
uses: tj-actions/[email protected]

- name: Decide if the test should be skipped
id: skip
shell: bash -l {0}
run: |
FILTER='src/pytorch_lightning|requirements/pytorch|tests/tests_pytorch|examples/pl_*'
echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr " " "\n" > changed_files.txt
MATCHES=$(cat changed_files.txt | grep -E $FILTER)
echo $MATCHES
if [ -z "$MATCHES" ]; then
echo "Skip"
echo "::set-output name=continue::0"
else
echo "Continue"
echo "::set-output name=continue::1"
fi

- name: Set up Python ${{ matrix.python-version }}
if: ${{ (steps.skip.outputs.continue == '1') }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Reset caching
if: ${{ (steps.skip.outputs.continue == '1') }}
run: python -c "import time; days = time.time() / 60 / 60 / 24; print(f'TIME_PERIOD=d{int(days / 2) * 2}')" >> $GITHUB_ENV

- name: basic setup
if: ${{ (steps.skip.outputs.continue == '1') }}
run: |
pip --version
pip install -q -r .actions/requirements.txt

# Github Actions: Run step on specific OS: https://stackoverflow.com/a/57948488/4521646
- name: Setup macOS
if: ${{ (runner.os == 'macOS') && (steps.skip.outputs.continue == '1') }}
if: runner.os == 'macOS'
run: |
brew install openmpi libuv # Horovod on macOS requires OpenMPI, Gloo not currently supported

- name: Setup Windows
if: ${{ (runner.os == 'windows') && (steps.skip.outputs.continue == '1') }}
if: runner.os == 'windows'
run: |
python .actions/assistant.py requirements_prune_pkgs horovod

- name: Set min. dependencies
if: ${{ (matrix.requires == 'oldest') && (steps.skip.outputs.continue == '1') }}
if: matrix.requires == 'oldest'
run: |
python .actions/assistant.py replace_oldest_ver

# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Get pip cache dir
if: ${{ (steps.skip.outputs.continue == '1') }}
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"

- name: pip cache
if: ${{ (steps.skip.outputs.continue == '1') }}
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
Expand All @@ -106,11 +85,9 @@ jobs:
${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-

- name: Pull legacy checkpoints
if: ${{ (steps.skip.outputs.continue == '1') }}
run: bash .actions/pull_legacy_checkpoints.sh

- name: Install dependencies
if: ${{ (steps.skip.outputs.continue == '1') }}
env:
PACKAGE_NAME: pytorch
FREEZE_REQUIREMENTS: 1
Expand All @@ -122,12 +99,10 @@ jobs:
shell: bash

- name: DocTests
if: ${{ (steps.skip.outputs.continue == '1') }}
working-directory: ./src
run: pytest pytorch_lightning --cov=pytorch_lightning

- name: Install extra dependencies
if: ${{ (steps.skip.outputs.continue == '1') }}
run: |
# adjust versions according installed Torch version
python ./requirements/pytorch/adjust-versions.py requirements/pytorch/extra.txt
Expand All @@ -136,7 +111,7 @@ jobs:
shell: bash

- name: Reinstall Horovod if necessary
if: ${{ (runner.os != 'windows') && (steps.skip.outputs.continue == '1') }}
if: runner.os != 'windows'
env:
HOROVOD_BUILD_ARCH_FLAGS: "-mfma"
HOROVOD_WITHOUT_MXNET: 1
Expand All @@ -153,58 +128,53 @@ jobs:
shell: bash

- name: Cache datasets
if: ${{ (steps.skip.outputs.continue == '1') }}
uses: actions/cache@v3
with:
path: Datasets
key: pl-dataset

- name: Sanity check
if: ${{ (steps.skip.outputs.continue == '1') }}
run: python requirements/pytorch/check-avail-extras.py

- name: Testing Warnings
# the stacklevel can only be set on >=3.7
if: ${{ (steps.skip.outputs.continue == '1') && ( matrix.python-version != '3.7' ) }}
if: ${{ matrix.python-version != '3.7' }}
working-directory: tests/tests_pytorch
# needs to run outside of `pytest`
run: python utilities/test_warnings.py

- name: Testing PyTorch
if: ${{ (steps.skip.outputs.continue == '1') }}
working-directory: tests/tests_pytorch
# NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003
run: coverage run --source pytorch_lightning -m pytest -v --durations=50 --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml

- name: Upload pytest results
if: ${{ (failure()) && (steps.skip.outputs.continue == '1') }}
if: failure()
uses: actions/upload-artifact@v3
with:
name: unittest-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}
path: tests/tests_pytorch/results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml

- name: Prepare Examples
if: ${{ (steps.skip.outputs.continue == '1') }}
run: |
# adjust versions according installed Torch version
python ./requirements/pytorch/adjust-versions.py requirements/pytorch/examples.txt
pip install -r requirements/pytorch/examples.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade

- name: Run Examples
if: ${{ (steps.skip.outputs.continue == '1') }}
working-directory: ./examples
run: python -m pytest test_pl_examples.py -v --durations=10

- name: Statistics
if: ${{ (success()) && (steps.skip.outputs.continue == '1') }}
if: success()
working-directory: tests/tests_pytorch
run: |
coverage report
coverage xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: ${{ (always()) && (steps.skip.outputs.continue == '1') }}
if: always()
# see: https://github.com/actions/toolkit/issues/399
continue-on-error: true
with:
Expand Down