2022-02-02 19:48:15 +00:00
|
|
|
name: Test full
|
2020-02-12 16:28:47 +00:00
|
|
|
|
2020-04-22 14:13:55 +00:00
|
|
|
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
|
2020-09-10 22:38:29 +00:00
|
|
|
on: # Trigger the workflow on push or pull request, but only for the master branch
|
2020-06-04 15:25:07 +00:00
|
|
|
push:
|
2021-01-12 12:56:20 +00:00
|
|
|
branches: [master, "release/*"]
|
2020-06-04 15:25:07 +00:00
|
|
|
pull_request:
|
2020-11-04 09:08:37 +00:00
|
|
|
branches: [master, "release/*"]
|
2021-04-19 13:49:25 +00:00
|
|
|
types: [opened, reopened, ready_for_review, synchronize]
|
2020-02-12 16:28:47 +00:00
|
|
|
|
2022-02-02 19:48:15 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
|
|
|
|
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
|
|
|
|
|
2020-02-12 16:28:47 +00:00
|
|
|
jobs:
|
2021-04-19 13:49:25 +00:00
|
|
|
|
2021-11-10 16:59:10 +00:00
|
|
|
cpu:
|
2020-02-12 16:28:47 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2021-04-19 13:49:25 +00:00
|
|
|
if: github.event.pull_request.draft == false
|
2020-02-12 16:28:47 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-01-13 15:01:31 +00:00
|
|
|
os: [ubuntu-20.04, windows-2019, macOS-10.15]
|
2021-11-04 17:26:24 +00:00
|
|
|
python-version: ["3.7", "3.9"] # minimum, maximum
|
|
|
|
requires: ["oldest", "latest"]
|
|
|
|
release: ["stable"]
|
2022-03-10 18:38:47 +00:00
|
|
|
exclude:
|
|
|
|
# Skip if torch<1.8 and py3.9 on Linux: https://github.com/pytorch/pytorch/issues/50014
|
|
|
|
- {os: ubuntu-20.04, python-version: "3.9", requires: "oldest"}
|
|
|
|
# TODO: re-enable RC testing
|
|
|
|
# include:
|
|
|
|
# - {os: ubuntu-20.04, python-version: "3.10", requires: "latest", release: "pre"}
|
2020-02-12 16:28:47 +00:00
|
|
|
|
2021-03-29 16:20:13 +00:00
|
|
|
timeout-minutes: 40
|
|
|
|
|
2020-02-12 16:28:47 +00:00
|
|
|
steps:
|
2020-03-06 01:44:28 +00:00
|
|
|
- uses: actions/checkout@v2
|
2020-02-12 16:28:47 +00:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2020-06-27 01:38:25 +00:00
|
|
|
uses: actions/setup-python@v2
|
2020-02-12 16:28:47 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2022-03-23 09:14:29 +00:00
|
|
|
- name: Reset caching
|
|
|
|
run: python -c "import time; days = time.time() / 60 / 60 / 24; print(f'TIME_PERIOD=d{int(days / 2) * 2}')" >> $GITHUB_ENV
|
2021-05-25 22:53:38 +00:00
|
|
|
|
2022-03-11 11:13:43 +00:00
|
|
|
- name: basic setup
|
|
|
|
run: |
|
|
|
|
pip --version
|
|
|
|
pip install -q fire
|
|
|
|
|
2020-03-25 11:46:27 +00:00
|
|
|
# Github Actions: Run step on specific OS: https://stackoverflow.com/a/57948488/4521646
|
|
|
|
- name: Setup macOS
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
2020-09-26 17:30:25 +00:00
|
|
|
brew install openmpi libuv # Horovod on macOS requires OpenMPI, Gloo not currently supported
|
2020-04-22 14:10:23 +00:00
|
|
|
- name: Setup Windows
|
2020-04-22 21:39:08 +00:00
|
|
|
if: runner.os == 'windows'
|
|
|
|
run: |
|
2022-03-21 12:50:50 +00:00
|
|
|
python .actions/assistant.py requirements_prune_pkgs horovod
|
2020-02-12 16:28:47 +00:00
|
|
|
- name: Set min. dependencies
|
2021-11-04 17:26:24 +00:00
|
|
|
if: matrix.requires == 'oldest'
|
2020-02-12 16:28:47 +00:00
|
|
|
run: |
|
2022-03-11 11:13:43 +00:00
|
|
|
python .actions/assistant.py replace_oldest_ver
|
2020-02-12 16:28:47 +00:00
|
|
|
|
2020-04-22 14:13:55 +00:00
|
|
|
# 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
|
2020-07-31 10:31:23 +00:00
|
|
|
- name: Get pip cache dir
|
2020-04-22 14:13:55 +00:00
|
|
|
id: pip-cache
|
2022-02-02 19:48:15 +00:00
|
|
|
run: echo "::set-output name=dir::$(pip cache dir)"
|
2020-04-22 14:13:55 +00:00
|
|
|
|
2020-07-31 10:31:23 +00:00
|
|
|
- name: pip cache
|
|
|
|
uses: actions/cache@v2
|
2020-02-12 16:28:47 +00:00
|
|
|
with:
|
2020-04-22 14:13:55 +00:00
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
2022-05-12 13:14:18 +00:00
|
|
|
key: ${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-${{ hashFiles('requirements/*.txt') }}
|
2020-02-12 16:28:47 +00:00
|
|
|
restore-keys: |
|
2022-03-23 09:14:29 +00:00
|
|
|
${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}-py${{ matrix.python-version }}-${{ matrix.release }}-${{ matrix.requires }}-
|
2020-02-25 14:20:41 +00:00
|
|
|
|
2022-07-12 23:40:14 +00:00
|
|
|
- name: Pull legacy checkpoints
|
|
|
|
run: bash .actions/pull_legacy_checkpoints.sh
|
2021-01-08 15:36:49 +00:00
|
|
|
|
2021-10-26 11:58:20 +00:00
|
|
|
- name: Install dependencies
|
2021-03-29 16:20:13 +00:00
|
|
|
run: |
|
2021-10-26 11:58:20 +00:00
|
|
|
flag=$(python -c "print('--pre' if '${{matrix.release}}' == 'pre' else '')" 2>&1)
|
2022-03-10 18:38:47 +00:00
|
|
|
url=$(python -c "print('test/cpu/torch_test.html' if '${{matrix.release}}' == 'pre' else 'cpu/torch_stable.html')" 2>&1)
|
2022-05-12 13:14:18 +00:00
|
|
|
pip install -r requirements.txt --upgrade $flag --find-links "https://download.pytorch.org/whl/${url}"
|
|
|
|
pip install -r requirements/test.txt --upgrade
|
2021-10-26 11:58:20 +00:00
|
|
|
pip list
|
|
|
|
shell: bash
|
2021-03-29 16:20:13 +00:00
|
|
|
|
2022-07-12 23:40:14 +00:00
|
|
|
- name: DocTests
|
|
|
|
run: coverage run --source pytorch_lightning -m pytest pytorch_lightning
|
|
|
|
|
2021-10-26 11:58:20 +00:00
|
|
|
- name: Install extra dependencies
|
2020-02-12 16:28:47 +00:00
|
|
|
run: |
|
2021-03-06 13:34:54 +00:00
|
|
|
# adjust versions according installed Torch version
|
2022-03-11 09:20:47 +00:00
|
|
|
python ./requirements/adjust-versions.py requirements/extra.txt
|
2021-10-26 11:58:20 +00:00
|
|
|
pip install --requirement ./requirements/extra.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
|
2020-02-12 16:28:47 +00:00
|
|
|
pip list
|
2020-04-22 21:39:08 +00:00
|
|
|
shell: bash
|
2020-02-12 16:28:47 +00:00
|
|
|
|
2020-05-04 17:02:57 +00:00
|
|
|
- name: Reinstall Horovod if necessary
|
2021-10-26 11:58:20 +00:00
|
|
|
if: runner.os != 'windows'
|
2020-09-26 17:30:25 +00:00
|
|
|
env:
|
|
|
|
HOROVOD_BUILD_ARCH_FLAGS: "-mfma"
|
2021-10-26 11:58:20 +00:00
|
|
|
HOROVOD_WITHOUT_MXNET: 1
|
|
|
|
HOROVOD_WITHOUT_TENSORFLOW: 1
|
2020-05-04 17:02:57 +00:00
|
|
|
run: |
|
2020-07-30 21:39:07 +00:00
|
|
|
HOROVOD_BUILT=$(python -c "import horovod.torch; horovod.torch.nccl_built(); print('SUCCESS')" || true)
|
2020-05-04 17:02:57 +00:00
|
|
|
if [[ $HOROVOD_BUILT != "SUCCESS" ]]; then
|
|
|
|
pip uninstall -y horovod
|
2022-05-04 14:06:02 +00:00
|
|
|
grep "horovod" requirements/strategies.txt > requirements/horovod.txt
|
2020-10-06 15:18:16 +00:00
|
|
|
pip install --no-cache-dir -r requirements/horovod.txt
|
2020-05-04 17:02:57 +00:00
|
|
|
fi
|
|
|
|
horovodrun --check-build
|
2022-03-11 09:20:47 +00:00
|
|
|
python -c "import horovod.torch"
|
2020-05-04 17:02:57 +00:00
|
|
|
shell: bash
|
|
|
|
|
2020-04-22 14:13:55 +00:00
|
|
|
- name: Cache datasets
|
2020-07-31 10:31:23 +00:00
|
|
|
uses: actions/cache@v2
|
2020-04-22 14:13:55 +00:00
|
|
|
with:
|
2021-01-08 15:36:49 +00:00
|
|
|
path: Datasets
|
2020-06-30 14:56:05 +00:00
|
|
|
key: pl-dataset
|
2020-04-22 14:13:55 +00:00
|
|
|
|
2022-03-11 09:20:47 +00:00
|
|
|
- name: Sanity check
|
|
|
|
run: |
|
|
|
|
python requirements/check-avail-extras.py
|
|
|
|
|
2022-07-12 23:40:14 +00:00
|
|
|
- name: UnitTests
|
2020-02-12 16:28:47 +00:00
|
|
|
run: |
|
2020-07-01 12:00:36 +00:00
|
|
|
# NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003
|
2021-04-28 13:33:15 +00:00
|
|
|
coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v --durations=50 --junitxml=junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
|
2021-03-04 16:48:17 +00:00
|
|
|
|
2021-03-05 16:50:21 +00:00
|
|
|
- name: Examples
|
|
|
|
run: |
|
2022-07-12 23:40:14 +00:00
|
|
|
# adjust versions according installed Torch version
|
|
|
|
python ./requirements/adjust-versions.py requirements/examples.txt
|
|
|
|
pip install -r requirements/examples.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
|
2021-03-05 16:50:21 +00:00
|
|
|
python -m pytest pl_examples -v --durations=10
|
2020-02-12 16:28:47 +00:00
|
|
|
|
2021-03-11 15:45:26 +00:00
|
|
|
- name: Upload pytest results
|
2020-11-04 09:08:37 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
2020-02-12 16:28:47 +00:00
|
|
|
with:
|
2022-02-21 15:03:02 +00:00
|
|
|
name: pytest-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}
|
|
|
|
path: junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
|
|
|
|
if-no-files-found: error
|
2020-12-11 23:17:19 +00:00
|
|
|
if: failure()
|
2020-02-12 16:28:47 +00:00
|
|
|
|
2020-07-01 12:00:36 +00:00
|
|
|
- name: Statistics
|
|
|
|
if: success()
|
2020-02-12 16:28:47 +00:00
|
|
|
run: |
|
2020-07-04 15:31:12 +00:00
|
|
|
coverage report
|
|
|
|
coverage xml
|
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
if: always()
|
2020-10-19 07:28:17 +00:00
|
|
|
# see: https://github.com/actions/toolkit/issues/399
|
|
|
|
continue-on-error: true
|
2020-07-04 15:31:12 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
file: coverage.xml
|
2021-03-11 15:45:26 +00:00
|
|
|
flags: cpu,pytest,python${{ matrix.python-version }}
|
2020-07-04 15:31:12 +00:00
|
|
|
name: CPU-coverage
|
2020-07-09 11:08:23 +00:00
|
|
|
fail_ci_if_error: false
|