2020-02-12 16:28:47 +00:00
|
|
|
name: CI testing
|
|
|
|
|
2020-03-07 00:19:19 +00:00
|
|
|
# https://help.github.com/en/actions/reference/events-that-trigger-workflows
|
|
|
|
on:
|
|
|
|
# Trigger the workflow on push or pull request,
|
|
|
|
# but only for the master branch
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-02-12 16:28:47 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
# max-parallel: 6
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-18.04, windows-2016, 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:
|
|
|
|
# excludes node 4 on macOS
|
|
|
|
- python-version: 3.8
|
|
|
|
requires: 'minimal'
|
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-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
|
|
|
|
|
|
|
- name: Cache pip
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pip # This path is specific to Ubuntu
|
|
|
|
# Look to see if there is a cache hit for the corresponding requirements file
|
|
|
|
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pip-${{ matrix.python-version }}-
|
|
|
|
${{ runner.os }}-${{ matrix.python-version }}-
|
|
|
|
|
2020-02-25 14:20:41 +00:00
|
|
|
- name: Cache datasets
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
2020-04-02 16:28:44 +00:00
|
|
|
path: tests/Datasets # This path is specific to Ubuntu
|
2020-02-25 14:20:41 +00:00
|
|
|
# Look to see if there is a cache hit for the corresponding requirements file
|
|
|
|
key: mnist-dataset
|
|
|
|
|
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
|
|
|
|
pip install -r ./tests/requirements.txt -q
|
2020-02-12 16:28:47 +00:00
|
|
|
# pip install tox coverage
|
|
|
|
python --version
|
|
|
|
pip --version
|
|
|
|
pip list
|
|
|
|
|
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-03-25 11:46:27 +00:00
|
|
|
coverage run --source pytorch_lightning -m py.test pytorch_lightning tests -v --doctest-modules --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.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:
|
|
|
|
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }}
|
|
|
|
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
|
|
|
|
# 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: |
|
|
|
|
coverage report
|