2021-01-05 19:34:47 +00:00
|
|
|
name: CI basic testing
|
2020-06-30 23:35:54 +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-30 23:35:54 +00:00
|
|
|
push:
|
2021-01-12 12:56:20 +00:00
|
|
|
branches: [master, "release/*"]
|
2020-06-30 23:35:54 +00:00
|
|
|
pull_request:
|
2020-11-04 09:08:37 +00:00
|
|
|
branches: [master, "release/*"]
|
2020-06-30 23:35:54 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
doctest:
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
# max-parallel: 6
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-20.04, windows-2019, macOS-10.15]
|
2021-03-29 16:20:13 +00:00
|
|
|
python-version: [3.8]
|
2020-06-30 23:35:54 +00:00
|
|
|
|
|
|
|
# Timeout: https://stackoverflow.com/a/59076067/4521646
|
|
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2021-05-25 22:53:38 +00:00
|
|
|
- name: Weekly reset caching
|
|
|
|
run: echo "::set-output name=period::$(python -c 'import time ; days = time.time() / 60 / 60 / 24 ; print(int(days / 7))' 2>&1)"
|
|
|
|
id: times
|
|
|
|
|
2020-06-30 23:35:54 +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)"
|
|
|
|
|
|
|
|
- name: Cache pip
|
2020-07-31 10:31:23 +00:00
|
|
|
uses: actions/cache@v2
|
2020-06-30 23:35:54 +00:00
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
2021-05-25 22:53:38 +00:00
|
|
|
key: ${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}
|
2020-06-30 23:35:54 +00:00
|
|
|
restore-keys: |
|
2021-05-25 22:53:38 +00:00
|
|
|
${{ runner.os }}-pip-td${{ steps.times.outputs.period }}-py${{ matrix.python-version }}-${{ matrix.requires }}-
|
2020-06-30 23:35:54 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade --user pip
|
2021-03-15 11:07:23 +00:00
|
|
|
pip install --requirement ./requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
|
|
|
|
pip install "pytest>6.0" "pytest-cov>2.10" --upgrade-strategy only-if-needed
|
2020-06-30 23:35:54 +00:00
|
|
|
python --version
|
|
|
|
pip --version
|
|
|
|
pip list
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Cache datasets
|
2020-07-31 10:31:23 +00:00
|
|
|
uses: actions/cache@v2
|
2020-06-30 23:35:54 +00:00
|
|
|
with:
|
|
|
|
path: Datasets # This path is specific to Ubuntu
|
|
|
|
# Look to see if there is a cache hit for the corresponding requirements file
|
|
|
|
key: PL-dataset
|
|
|
|
|
|
|
|
- name: Test Package [only]
|
|
|
|
run: |
|
|
|
|
# NOTE: run coverage on tests does not propagare faler status for Win, https://github.com/nedbat/coveragepy/issues/1003
|
2021-03-23 22:05:04 +00:00
|
|
|
coverage run --source pytorch_lightning -m pytest pytorch_lightning -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
|
2020-06-30 23:35:54 +00:00
|
|
|
|
|
|
|
- name: Upload pytest test results
|
2020-11-04 09:08:37 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
2020-06-30 23:35:54 +00:00
|
|
|
with:
|
|
|
|
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-07-04 15:31:12 +00:00
|
|
|
|
|
|
|
- name: Statistics
|
|
|
|
if: success()
|
|
|
|
run: |
|
|
|
|
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: Base-coverage
|
2020-07-09 11:08:23 +00:00
|
|
|
fail_ci_if_error: false
|