2022-07-02 05:05:16 +00:00
|
|
|
name: Test App
|
2022-07-01 20:28:44 +00:00
|
|
|
|
|
|
|
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
|
2022-09-08 13:29:28 +00:00
|
|
|
on:
|
2022-07-01 20:28:44 +00:00
|
|
|
push:
|
2022-07-19 17:25:14 +00:00
|
|
|
branches: [master, "release/*"]
|
2022-07-01 20:28:44 +00:00
|
|
|
pull_request:
|
2022-09-08 13:29:28 +00:00
|
|
|
branches: [master, "release/*"]
|
2022-11-04 16:17:48 +00:00
|
|
|
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
|
2022-07-01 20:28:44 +00:00
|
|
|
paths:
|
2022-08-29 18:03:37 +00:00
|
|
|
- ".github/workflows/ci-app-tests.yml"
|
2022-07-01 20:28:44 +00:00
|
|
|
- "src/lightning_app/**"
|
|
|
|
- "tests/tests_app/**"
|
2022-10-28 09:20:30 +00:00
|
|
|
- "examples/app_*" # some tests_app tests call examples files
|
2022-11-03 21:28:31 +00:00
|
|
|
- "requirements/app/*"
|
|
|
|
- "!requirements/app/docs.txt"
|
2022-08-17 14:15:23 +00:00
|
|
|
- "setup.py"
|
2022-10-20 18:23:47 +00:00
|
|
|
- ".actions/**"
|
2022-07-01 20:28:44 +00:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
|
|
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
|
|
|
|
2022-10-22 11:20:49 +00:00
|
|
|
env:
|
|
|
|
FREEZE_REQUIREMENTS: 1
|
|
|
|
|
2022-10-23 06:53:58 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
2022-07-01 20:28:44 +00:00
|
|
|
jobs:
|
2022-08-29 18:03:37 +00:00
|
|
|
app-pytest:
|
2022-11-04 16:17:48 +00:00
|
|
|
if: github.event.pull_request.draft == false
|
2022-07-01 20:28:44 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-08-10 09:02:54 +00:00
|
|
|
os: [ubuntu-20.04, macOS-11, windows-2022]
|
2022-10-27 10:32:49 +00:00
|
|
|
pkg-name: ["app"]
|
|
|
|
python-version: ["3.8"]
|
2022-07-01 20:28:44 +00:00
|
|
|
requires: ["oldest", "latest"]
|
2022-10-27 10:32:49 +00:00
|
|
|
include:
|
|
|
|
# "lightning" installs the monolithic package
|
|
|
|
- {os: "macOS-11", pkg-name: "lightning", python-version: "3.9", requires: "latest"}
|
|
|
|
- {os: "ubuntu-20.04", pkg-name: "lightning", python-version: "3.9", requires: "latest"}
|
2022-10-28 11:01:55 +00:00
|
|
|
- {os: "windows-2022", pkg-name: "lightning", python-version: "3.8", requires: "latest"}
|
2022-07-01 20:28:44 +00:00
|
|
|
|
|
|
|
# Timeout: https://stackoverflow.com/a/59076067/4521646
|
2022-10-27 10:32:49 +00:00
|
|
|
timeout-minutes: 30
|
2022-07-01 20:28:44 +00:00
|
|
|
|
|
|
|
steps:
|
2022-09-05 17:13:08 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-07-01 20:28:44 +00:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2022-08-01 16:59:48 +00:00
|
|
|
uses: actions/setup-python@v4
|
2022-07-01 20:28:44 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2022-10-22 11:20:49 +00:00
|
|
|
- name: basic setup
|
|
|
|
run: pip install -q -r .actions/requirements.txt
|
|
|
|
|
2022-07-01 20:28:44 +00:00
|
|
|
- name: Set min. dependencies
|
2022-10-22 11:20:49 +00:00
|
|
|
if: ${{ matrix.requires == 'oldest' }}
|
|
|
|
run: python .actions/assistant.py replace_oldest_ver
|
|
|
|
|
2022-11-09 14:07:52 +00:00
|
|
|
- name: Get pip cache dir
|
2022-07-01 20:28:44 +00:00
|
|
|
id: pip-cache
|
2022-11-09 14:07:52 +00:00
|
|
|
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
2022-07-01 20:28:44 +00:00
|
|
|
|
|
|
|
- name: Cache pip
|
2022-07-14 20:12:56 +00:00
|
|
|
uses: actions/cache@v3
|
2022-07-01 20:28:44 +00:00
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
2022-10-23 06:53:58 +00:00
|
|
|
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.pkg-name }}-${{ matrix.requires }}-${{ hashFiles('requirements/app/base.txt') }}
|
|
|
|
restore-keys: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.pkg-name }}-${{ matrix.requires }}-
|
|
|
|
|
2022-10-27 10:32:49 +00:00
|
|
|
- name: Switch PyTorch URL
|
|
|
|
run: python -c "print('TORCH_URL=https://download.pytorch.org/whl/' + str('test/cpu/torch_test.html' if '${{matrix.release}}' == 'pre' else 'cpu/torch_stable.html'))" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install package
|
|
|
|
env:
|
|
|
|
PACKAGE_NAME: ${{ matrix.pkg-name }}
|
|
|
|
run: |
|
|
|
|
pip install -e . pytest --upgrade --find-links ${TORCH_URL}
|
|
|
|
pip list
|
2022-07-01 20:28:44 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2022-10-23 06:53:58 +00:00
|
|
|
pip install -r requirements/app/devel.txt --quiet --find-links ${TORCH_URL}
|
2022-07-01 20:28:44 +00:00
|
|
|
pip list
|
|
|
|
|
|
|
|
- name: Setup Node.js
|
2022-08-19 05:37:48 +00:00
|
|
|
uses: actions/setup-node@v3
|
2022-07-01 20:28:44 +00:00
|
|
|
with:
|
|
|
|
node-version: '16'
|
|
|
|
|
|
|
|
- name: Install Yarn
|
|
|
|
run: npm install -g yarn
|
|
|
|
|
2022-10-23 06:53:58 +00:00
|
|
|
- name: Adjust tests
|
2022-10-27 10:32:49 +00:00
|
|
|
if: ${{ matrix.pkg-name == 'lightning' }}
|
2022-10-23 06:53:58 +00:00
|
|
|
run: python .actions/assistant.py copy_replace_imports --source_dir="./tests" --source_import="lightning_app" --target_import="lightning.app"
|
|
|
|
|
2022-10-24 13:52:04 +00:00
|
|
|
- name: Adjust examples
|
2022-10-27 10:32:49 +00:00
|
|
|
if: ${{ matrix.pkg-name != 'lightning' }}
|
2022-10-24 13:52:04 +00:00
|
|
|
run: |
|
2022-11-04 16:51:03 +00:00
|
|
|
python .actions/assistant.py copy_replace_imports --source_dir="./examples" --source_import="lightning.app,lightning" --target_import="lightning_app,lightning_app"
|
2022-10-24 13:52:04 +00:00
|
|
|
|
2022-10-27 10:32:49 +00:00
|
|
|
- name: Switch coverage scope
|
|
|
|
run: python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.pkg-name}}' == 'lightning' else 'lightning_app'))" >> $GITHUB_ENV
|
2022-10-23 06:53:58 +00:00
|
|
|
|
2022-07-01 20:28:44 +00:00
|
|
|
- name: Tests
|
|
|
|
working-directory: ./tests
|
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
AWS_DEFAULT_REGION: us-east-1
|
|
|
|
PYTEST_ARTIFACT: results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
|
|
|
|
run: |
|
2022-10-23 06:53:58 +00:00
|
|
|
coverage run --source ${COVERAGE_SCOPE} -m pytest -m "not cloud" tests_app --timeout=300 -vvvv --junitxml=$PYTEST_ARTIFACT --durations=50
|
2022-07-01 20:28:44 +00:00
|
|
|
|
|
|
|
- name: Upload pytest test results
|
2022-07-12 16:34:18 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-07-01 20:28:44 +00:00
|
|
|
with:
|
|
|
|
name: unittest-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}
|
|
|
|
path: tests/results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
|
|
|
|
if: failure()
|
|
|
|
|
|
|
|
- name: Statistics
|
|
|
|
if: success()
|
|
|
|
working-directory: ./tests
|
|
|
|
run: |
|
|
|
|
coverage xml -i
|
|
|
|
coverage report -i
|
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
2022-07-12 16:13:34 +00:00
|
|
|
uses: codecov/codecov-action@v3
|
2022-07-01 20:28:44 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
file: tests/coverage.xml
|
2022-10-23 06:53:58 +00:00
|
|
|
flags: ${COVERAGE_SCOPE},cpu,pytest
|
2022-07-01 20:28:44 +00:00
|
|
|
env_vars: OS,PYTHON
|
|
|
|
name: codecov-umbrella
|
|
|
|
fail_ci_if_error: false
|
|
|
|
|
|
|
|
# TODO: figure out why we clone and install quick-start
|
|
|
|
# - name: Clone Quick Start Example Repo
|
|
|
|
# uses: actions/checkout@v3
|
|
|
|
# # TODO: this needs to be git submodule
|
2022-08-10 09:02:54 +00:00
|
|
|
# if: matrix.os == 'windows-2022' # because the install doesn't work on windows
|
2022-07-01 20:28:44 +00:00
|
|
|
# with:
|
|
|
|
# repository: Lightning-AI/lightning-quick-start
|
|
|
|
# ref: 'main'
|
|
|
|
# path: lightning-quick-start
|
|
|
|
#
|
|
|
|
# - name: Lightning Install quick-start
|
2022-08-10 09:02:54 +00:00
|
|
|
# if: matrix.os != 'windows-2022' # because the install doesn't work on windows
|
2022-07-01 20:28:44 +00:00
|
|
|
# run: |
|
|
|
|
# python -m lightning install app lightning/quick-start -y
|