2020-02-12 16:28:47 +00:00
name : CI testing
2020-04-22 14:13:55 +00:00
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
2020-06-01 14:21:52 +00:00
# Trigger the workflow on push or pull request
on : [ push, pull_request]
2020-02-12 16:28:47 +00:00
jobs :
build :
runs-on : ${{ matrix.os }}
strategy :
fail-fast : false
# max-parallel: 6
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-05-22 11:14:08 +00:00
# excludes PT 1.3 as it is missing on pypi
2020-04-02 16:20:45 +00:00
- python-version : 3.8
requires : 'minimal'
2020-06-03 12:38:56 +00:00
# TODO: temporary fix till hanging jobs on macOS for py38 is resolved
2020-06-03 10:48:20 +00:00
- python-version : 3.8
2020-06-03 12:38:56 +00:00
os : macOS-10.15
2020-02-12 16:28:47 +00:00
2020-03-25 11:46:27 +00:00
# Timeout: https://stackoverflow.com/a/59076067/4521646
2020-04-15 00:32:33 +00:00
timeout-minutes : 15
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 }}
uses : actions/setup-python@v1
with :
python-version : ${{ matrix.python-version }}
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-04-22 21:39:08 +00:00
brew install openmpi # 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 : |
python -c "lines = [line for line in open('requirements-extra.txt').readlines() if not line.startswith('horovod')] ; open('requirements-extra.txt', 'w').writelines(lines)"
# TODO: remove after https://github.com/pytorch/pytorch/issues/32186 is resolved
- name : Setup Windows on Latest
2020-04-22 14:10:23 +00:00
if : runner.os == 'windows' && matrix.requires == 'latest'
run : |
2020-05-22 11:14:08 +00:00
python -c "req = open('requirements.txt').read().replace('torch>=1.3', 'torch<1.5') ; open('requirements.txt', 'w').write(req)"
2020-04-22 14:10:23 +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)
- name : Setup MacOS Minimal
2020-05-20 11:46:18 +00:00
if : runner.os == 'macOS' && matrix.requires == 'minimal'
2020-05-19 15:05:07 +00:00
run : |
2020-05-22 11:14:08 +00:00
python -c "req = open('requirements.txt').read().replace('torch>=1.3', 'torch>=1.4') ; open('requirements.txt', '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 : |
python -c "req = open('requirements.txt').read().replace('>', '=') ; open('requirements.txt', 'w').write(req)"
2020-02-21 18:30:27 +00:00
python -c "req = open('requirements-extra.txt').read().replace('>', '=') ; open('requirements-extra.txt', 'w').write(req)"
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
- name : Get pip cache
id : pip-cache
run : |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
2020-02-12 16:28:47 +00:00
- name : Cache pip
uses : actions/cache@v1
with :
2020-04-22 14:13:55 +00:00
path : ${{ steps.pip-cache.outputs.dir }}
2020-05-04 11:13:11 +00:00
key : ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-extra.txt') }}
2020-02-12 16:28:47 +00:00
restore-keys : |
2020-05-04 11:13:11 +00:00
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-pip-
2020-02-25 14:20:41 +00:00
2020-02-12 16:28:47 +00:00
- name : Install dependencies
run : |
# python -m pip install --upgrade --user pip
2020-04-02 16:28:44 +00:00
pip install -r requirements.txt -U -f https://download.pytorch.org/whl/torch_stable.html -q
2020-04-23 16:52:59 +00:00
HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install -r ./tests/requirements-devel.txt -q
2020-02-12 16:28:47 +00:00
# pip install tox coverage
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
if : runner.os != 'windows' && matrix.python-version != '3.8'
run : |
HOROVOD_BUILT=$(python -c "import horovod.torch; horovod.torch.nccl_built(); print('SUCCESS')")
if [[ $HOROVOD_BUILT != "SUCCESS" ]]; then
pip uninstall -y horovod
HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install --no-cache-dir $(grep "horovod" requirements-extra.txt)
fi
horovodrun --check-build
shell : bash
2020-04-22 14:13:55 +00:00
- name : Cache datasets
uses : actions/cache@v1
with :
path : tests/Datasets # This path is specific to Ubuntu
# Look to see if there is a cache hit for the corresponding requirements file
key : mnist-dataset
2020-03-20 19:51:14 +00:00
- name : Tests
2020-02-12 16:28:47 +00:00
# env:
# TOXENV: py${{ matrix.python-version }}
run : |
# tox --sitepackages
2020-03-20 19:51:14 +00:00
# flake8 .
2020-06-03 12:28:19 +00:00
coverage run --source pytorch_lightning -m py.test pytorch_lightning tests -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
2020-03-20 19:51:14 +00:00
coverage report
2020-02-12 16:28:47 +00:00
- name : Upload pytest test results
uses : actions/upload-artifact@master
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-02-12 16:28:47 +00:00
# Use always() to always run this step to publish test results when there are test failures
if : always()
- name : Package Setup
run : |
check-manifest
python setup.py check --metadata --strict
python setup.py sdist
twine check dist/*
#- name: Try install package
# if: ! startsWith(matrix.os, 'windows')
# run: |
# virtualenv vEnv ; source vEnv/bin/activate
# pip install --editable . ; cd .. & python -c "import pytorch_lightning ; print(pytorch_lightning.__version__)"
# deactivate ; rm -rf vEnv
- name : Statistics
if : success()
run : |
2020-05-19 15:05:07 +00:00
coverage report