2021-10-26 11:58:20 +00:00
|
|
|
# this jobs runs `pytest` over the source directory. It does not install any extra dependencies.
|
|
|
|
# this is useful to catch errors where an import has been added which is not part of the basic dependencies.
|
2022-02-02 19:48:15 +00:00
|
|
|
name: Test simple
|
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
|
|
|
|
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-06-30 23:35:54 +00:00
|
|
|
jobs:
|
2021-11-10 16:59:10 +00:00
|
|
|
source:
|
2020-06-30 23:35:54 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-10-26 11:58:20 +00:00
|
|
|
os: [ubuntu-20.04]
|
|
|
|
# this will install stable torch
|
|
|
|
python-version: [3.9]
|
2020-06-30 23:35:54 +00:00
|
|
|
|
2021-11-17 22:29:48 +00:00
|
|
|
# lower timeout as this should run very quickly
|
2020-06-30 23:35:54 +00:00
|
|
|
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 }}
|
|
|
|
|
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
|
|
|
|
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
|
2022-02-02 19:48:15 +00:00
|
|
|
run: python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
|
2020-06-30 23:35:54 +00:00
|
|
|
|
|
|
|
- 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 }}
|
2022-03-23 09:14:29 +00:00
|
|
|
key: ${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ hashFiles('requirements.txt') }}
|
|
|
|
restore-keys: ${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}-py${{ matrix.python-version }}-${{ matrix.requires }}-
|
2020-06-30 23:35:54 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python --version
|
2021-10-26 11:58:20 +00:00
|
|
|
python -m pip install --upgrade --user pip
|
2020-06-30 23:35:54 +00:00
|
|
|
pip --version
|
2021-10-26 11:58:20 +00:00
|
|
|
pip install --requirement requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
|
|
|
|
pip install --requirement requirements/test.txt
|
2020-06-30 23:35:54 +00:00
|
|
|
pip list
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Test Package [only]
|
|
|
|
run: |
|
2022-02-02 19:48:15 +00:00
|
|
|
coverage run --source pytorch_lightning -m pytest pytorch_lightning -v
|
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
|