2020-06-30 23:35:54 +00:00
name : CI complete testing
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 :
2020-11-04 09:08:37 +00:00
branches : [ master, "release/*"] # include release branches like release/1.0.x
2020-06-04 15:25:07 +00:00
pull_request :
2020-11-04 09:08:37 +00:00
branches : [ master, "release/*"]
2020-02-12 16:28:47 +00:00
jobs :
2020-06-27 20:25:33 +00:00
pytest :
2020-02-12 16:28:47 +00:00
runs-on : ${{ matrix.os }}
strategy :
fail-fast : false
matrix :
2020-04-22 14:10:23 +00:00
os : [ ubuntu-18.04, windows-2019, macOS-10.15]
2020-04-02 16:20:45 +00:00
python-version : [ 3.6 , 3.7 , 3.8 ]
2020-02-12 16:28:47 +00:00
requires : [ 'minimal' , 'latest' ]
2020-04-02 16:20:45 +00:00
exclude :
2020-12-02 16:18:14 +00:00
# # todo: segmentation fault for minimal and hanging for latest
2020-12-02 21:49:47 +00:00
- python-version : 3.8
2020-12-02 16:18:14 +00:00
os : ubuntu-18.04
2020-02-12 16:28:47 +00:00
2020-03-25 11:46:27 +00:00
# Timeout: https://stackoverflow.com/a/59076067/4521646
2020-09-09 11:11:53 +00:00
timeout-minutes: 35 # TODO : the macOS is taking too long, probably caching did not work...
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 }}
2020-07-31 10:31:23 +00:00
- name : Update Pip
run : |
2020-12-01 17:19:44 +00:00
# todo: unfreeze PIP after resolving minimal dependencies
pip install --quiet "pip==20.1" --upgrade --user # needed for get pip cacher folder
2020-07-31 10:31:23 +00:00
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 : |
brew install libomp # https://github.com/pytorch/pytorch/issues/20030
2020-09-26 17:30:25 +00:00
brew install openmpi libuv # Horovod on macOS requires OpenMPI, Gloo not currently supported
2020-03-25 11:46:27 +00:00
2020-04-22 14:10:23 +00:00
- name : Setup Windows
2020-04-22 21:39:08 +00:00
if : runner.os == 'windows'
run : |
2020-07-31 18:50:06 +00:00
# remove Horovod from requirements
2020-06-30 14:56:05 +00:00
python -c "fname = 'requirements/extra.txt' ; lines = [line for line in open(fname).readlines() if not line.startswith('horovod')] ; open(fname, 'w').writelines(lines)"
2020-04-22 21:39:08 +00:00
2020-05-19 15:05:07 +00:00
# versions <= 1.3 may have issues on mac with some BLAS ops due to missing mkl (https://github.com/pytorch/pytorch/issues/18996)
2020-12-02 16:18:14 +00:00
- name : Adjust minimal for Python 3.8 and MacOS
if : matrix.requires == 'minimal' && (runner.os == 'macOS' || matrix.python-version == 3.8)
2020-05-19 15:05:07 +00:00
run : |
2020-10-18 18:40:18 +00:00
python -c "fname = 'requirements.txt' ; req = open(fname).read().replace('torch>=1.3', 'torch>=1.4') ; open(fname, 'w').write(req)"
2020-12-01 17:19:44 +00:00
python -c "fname = 'requirements/examples.txt' ; req = open(fname).read().replace('torchvision>=0.4.1', 'torchvision>=0.5.0') ; open(fname, 'w').write(req)"
python -c "fname = 'requirements/extra.txt' ; req = open(fname).read().replace('torchtext>=0.3.1', 'torchtext>=0.5.0') ; open(fname, 'w').write(req)"
2020-05-20 11:46:18 +00:00
2020-02-12 16:28:47 +00:00
- name : Set min. dependencies
if : matrix.requires == 'minimal'
run : |
2020-10-18 18:40:18 +00:00
python -c "fname = 'requirements.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
2020-06-30 14:56:05 +00:00
python -c "fname = 'requirements/extra.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
2020-12-01 17:19:44 +00:00
python -c "fname = 'requirements/loggers.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
2020-09-10 22:38:29 +00:00
python -c "fname = 'requirements/test.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
2020-09-24 15:33:11 +00:00
python -c "fname = 'requirements/examples.txt' ; req = open(fname).read().replace('>=', '==') ; open(fname, 'w').write(req)"
2020-11-30 23:19:30 +00:00
# remove Fairscale from requirements
python -c "fname = 'requirements/extra.txt' ; lines = [line for line in open(fname).readlines() if 'fairscale' not in line] ; open(fname, 'w').writelines(lines)"
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
run : |
2020-07-31 10:31:23 +00:00
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 }}
2020-10-18 18:40:18 +00:00
key : ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements/extra.txt') }}
2020-02-12 16:28:47 +00:00
restore-keys : |
2020-09-15 21:48:48 +00:00
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.requires }}-
2020-02-25 14:20:41 +00:00
2020-02-12 16:28:47 +00:00
- name : Install dependencies
2020-09-26 17:30:25 +00:00
env :
# MAKEFLAGS: "-j2"
HOROVOD_BUILD_ARCH_FLAGS : "-mfma"
HOROVOD_WITHOUT_MXNET : 1
HOROVOD_WITHOUT_TENSORFLOW : 1
2020-02-12 16:28:47 +00:00
run : |
2020-07-31 18:50:06 +00:00
# python -m pip install --upgrade --user pip
2020-10-18 18:40:18 +00:00
pip install --requirement requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet --upgrade
2020-10-30 15:42:14 +00:00
pip install --requirement ./requirements/devel.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet --upgrade
2020-02-12 16:28:47 +00:00
python --version
pip --version
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
2020-07-30 21:39:07 +00:00
if : runner.os != 'windows'
2020-09-26 17:30:25 +00:00
env :
HOROVOD_BUILD_ARCH_FLAGS : "-mfma"
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
2020-10-06 15:18:16 +00:00
echo $(grep "horovod" requirements/extra.txt) > requirements/horovod.txt
pip install --no-cache-dir -r requirements/horovod.txt
2020-05-04 17:02:57 +00:00
fi
horovodrun --check-build
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 :
2020-06-30 14:56:05 +00:00
path : Datasets # This path is specific to Ubuntu
2020-04-22 14:13:55 +00:00
# Look to see if there is a cache hit for the corresponding requirements file
2020-06-30 14:56:05 +00:00
key : pl-dataset
2020-04-22 14:13:55 +00:00
2020-03-20 19:51:14 +00:00
- name : Tests
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
2020-11-18 10:53:44 +00:00
coverage run --source pytorch_lightning -m pytest pytorch_lightning tests pl_examples -v --durations=50 --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
2020-02-12 16:28:47 +00:00
- name : Upload pytest test results
2020-11-04 09:08:37 +00:00
uses : actions/upload-artifact@v2
2020-02-12 16:28:47 +00:00
with :
2020-05-04 11:13:11 +00:00
name : pytest-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}
path : junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
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
flags : cpu,pytest
name : CPU-coverage
2020-07-09 11:08:23 +00:00
fail_ci_if_error : false