lightning/.github/workflows/ci-tests-app.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

176 lines
6.7 KiB
YAML
Raw Normal View History

name: Test App
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
2022-07-19 17:25:14 +00:00
branches: [master, "release/*"]
pull_request:
branches: [master, "release/*"]
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
2023-06-15 15:25:59 +00:00
- ".actions/*"
- ".github/workflows/ci-tests-app.yml"
- "src/lightning/app/**"
- "src/lightning_app/*"
- "tests/tests_app/**"
- "requirements/app/**"
- "setup.py"
2022-11-26 01:16:48 +00:00
- "!requirements/*/docs.txt"
2022-11-16 10:07:02 +00:00
- "!*.md"
- "!**/*.md"
schedule:
# At the end of every day
- cron: "0 0 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
defaults:
run:
shell: bash
jobs:
app-pytest:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
2023-08-28 15:15:12 +00:00
os: ["ubuntu-20.04", "macOS-11", "windows-2022"]
pkg-name: ["lightning"]
LAI: creating mirror package (#15105) * placeholder * mirror + prune * makedir * setup * ci * ci * name * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ci clean * empty * py * parallel * doctest * flake8 * ci * typo * replace * clean * Apply suggestions from code review * re.sub * fix UI path * full replace * ui path? * replace * updates * regex * ci * fix * ci * path * ci * replace * Update .actions/setup_tools.py Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> * also convert lightning_lite tests for PL tests to adapt mocking paths * fix app example test * update logger propagation for PL tests * update logger propagation for PL tests * Apply suggestions from code review * Revert "update logger propagation for PL tests" This reverts commit c1a5e119c740b5468daac63028de8aa799a177ac. * playwright * py * update import in tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * try edit import in overwrite * debug code * rev playwright * Revert "try edit import in overwrite" This reverts commit c02f766521c91454be36b19784c6a3ed2f715109. * ci: adjust examples * adjust examples cloud * mock lightning_app * Install assistant dependencies * lightning * setup * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com> * Apply suggestions from code review * disable cache * move doctest to install * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ) * echo ./ * ci * lru * revert disabling cache, prints * ci * prune ci jobs * prune ci jobs * training loop standalone tests * add sys modules cleanup fixture * make use of fixture * revert standalone * ci e2e * fix imports in lightning * fix imports of lightning in tests * Revert "make use of fixture" This reverts commit c15efdd205da2353187275a8d3da141d0ec0ec0a. * Revert other commits for fixtures * revert use of fixture * py3.9 * fix mocking * fix paths * hack mocking * docs * Apply suggestions from code review * rev suggestion * Minor changes to the parametrizations * Update checkgroup with the new and changed jobs * include frontend dir * cli * fix imports and entry point * Revert standalone * rc1 * e2e on staging * Revert "Revert standalone" This reverts commit 9df96685b866b1719fcdeb0b2e832255e3a5f8c0. * groups * to * ci: pt ver * docker * Apply suggestions from code review * Copy over changes from previous commit to other groups * Add back changes from bad merge * Uppercase step name everywhere * update * ci * ci: lai oldest Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com> Co-authored-by: Justus Schock <justus.schock@posteo.de> Co-authored-by: manskx <ahmed.mansy156@gmail.com> Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com> Co-authored-by: thomas chaton <thomas@grid.ai> Co-authored-by: Luca Antiga <luca.antiga@gmail.com>
2022-10-27 10:32:49 +00:00
python-version: ["3.8"]
requires: ["oldest", "latest"]
LAI: creating mirror package (#15105) * placeholder * mirror + prune * makedir * setup * ci * ci * name * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ci clean * empty * py * parallel * doctest * flake8 * ci * typo * replace * clean * Apply suggestions from code review * re.sub * fix UI path * full replace * ui path? * replace * updates * regex * ci * fix * ci * path * ci * replace * Update .actions/setup_tools.py Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com> * also convert lightning_lite tests for PL tests to adapt mocking paths * fix app example test * update logger propagation for PL tests * update logger propagation for PL tests * Apply suggestions from code review * Revert "update logger propagation for PL tests" This reverts commit c1a5e119c740b5468daac63028de8aa799a177ac. * playwright * py * update import in tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * try edit import in overwrite * debug code * rev playwright * Revert "try edit import in overwrite" This reverts commit c02f766521c91454be36b19784c6a3ed2f715109. * ci: adjust examples * adjust examples cloud * mock lightning_app * Install assistant dependencies * lightning * setup * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com> * Apply suggestions from code review * disable cache * move doctest to install * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ) * echo ./ * ci * lru * revert disabling cache, prints * ci * prune ci jobs * prune ci jobs * training loop standalone tests * add sys modules cleanup fixture * make use of fixture * revert standalone * ci e2e * fix imports in lightning * fix imports of lightning in tests * Revert "make use of fixture" This reverts commit c15efdd205da2353187275a8d3da141d0ec0ec0a. * Revert other commits for fixtures * revert use of fixture * py3.9 * fix mocking * fix paths * hack mocking * docs * Apply suggestions from code review * rev suggestion * Minor changes to the parametrizations * Update checkgroup with the new and changed jobs * include frontend dir * cli * fix imports and entry point * Revert standalone * rc1 * e2e on staging * Revert "Revert standalone" This reverts commit 9df96685b866b1719fcdeb0b2e832255e3a5f8c0. * groups * to * ci: pt ver * docker * Apply suggestions from code review * Copy over changes from previous commit to other groups * Add back changes from bad merge * Uppercase step name everywhere * update * ci * ci: lai oldest Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com> Co-authored-by: Justus Schock <justus.schock@posteo.de> Co-authored-by: manskx <ahmed.mansy156@gmail.com> Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com> Co-authored-by: thomas chaton <thomas@grid.ai> Co-authored-by: Luca Antiga <luca.antiga@gmail.com>
2022-10-27 10:32:49 +00:00
include:
2023-08-28 15:15:12 +00:00
# only run Python latest, use App scope to limit dependency issues
- { os: "macOS-12", pkg-name: "app", python-version: "3.11", requires: "latest" }
- { os: "ubuntu-22.04", pkg-name: "app", python-version: "3.11", requires: "latest" }
- { os: "windows-2022", pkg-name: "app", python-version: "3.11", requires: "latest" }
2023-02-20 14:58:44 +00:00
# "app" installs the standalone package
- { os: "macOS-11", pkg-name: "app", python-version: "3.9", requires: "latest" }
- { os: "ubuntu-20.04", pkg-name: "app", python-version: "3.9", requires: "latest" }
- { os: "windows-2022", pkg-name: "app", python-version: "3.8", requires: "latest" }
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 55
env:
PACKAGE_NAME: ${{ matrix.pkg-name }}
FREEZE_REQUIREMENTS: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
PYPI_CACHE_DIR: "_pip-wheels"
2023-08-28 15:15:12 +00:00
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: basic setup
run: pip install -q -r .actions/requirements.txt
- name: Set min. dependencies
if: ${{ matrix.requires == 'oldest' }}
run: python .actions/assistant.py replace_oldest_ver
- name: pip wheels cache
uses: actions/cache/restore@v3
with:
path: ${{ env.PYPI_CACHE_DIR }}
key: pypi_wheels
- name: List restored pkgs
run: |
mkdir -p $PYPI_CACHE_DIR
ls -lh $PYPI_CACHE_DIR
- name: Env. variables
run: |
# Switch coverage scope
python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.pkg-name}}' == 'lightning' else 'pytorch_lightning'))" >> $GITHUB_ENV
# if you install mono-package set dependency only for this subpackage
python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.pkg-name}}' != 'lightning' else 'app-'))" >> $GITHUB_ENV
- name: Install package & dependencies
timeout-minutes: 20
run: |
python -m pip install -q pip -U
pip install -e ".[${EXTRA_PREFIX}dev]" -U --prefer-binary \
--find-links="${TORCH_URL}" --find-links="${PYPI_CACHE_DIR}"
pip list
- name: Dump handy wheels
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
continue-on-error: true
uses: ./.github/actions/pip-wheels
with:
wheel-dir: ${{ env.PYPI_CACHE_DIR }}
torch-url: ${{ env.TORCH_URL }}
cache-key: "pypi_wheels"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Install Yarn
timeout-minutes: 20
run: npm install -g yarn
- name: Adjust imports -> App
if: ${{ matrix.pkg-name != 'lightning' }}
run: |
python .actions/assistant.py copy_replace_imports --source_dir="./tests" \
--source_import="lightning.app,lightning.fabric,lightning.pytorch" \
--target_import="lightning_app,lightning_fabric,pytorch_lightning" \
--lightning_by="lightning_app"
python .actions/assistant.py copy_replace_imports --source_dir="./examples" \
--source_import="lightning.app,lightning.fabric,lightning.pytorch" \
--target_import="lightning_app,lightning_fabric,pytorch_lightning" \
--lightning_by="lightning_app"
- name: Switch coverage scope
run: python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.pkg-name}}' == 'lightning' else 'lightning_app'))" >> $GITHUB_ENV
- name: Set parallel for Unix
if: ${{ runner.os != 'windows' }}
# on Win, tests takes even loner then with normal single thread
run: echo "PYTEST_XDIST_ARGS=-n auto --dist=loadfile" >> $GITHUB_ENV
- name: Tests
working-directory: ./tests
run: |
set -e
python -m coverage run --source ${{ env.COVERAGE_SCOPE }} \
-m pytest -m "not cloud" -vvvv tests_app \
--ignore="tests_app/components/python/test_python.py" \
--timeout=120 --durations=50 ${PYTEST_XDIST_ARGS}
pytest -m "not cloud" -v \
tests_app/components/python/test_python.py \
--timeout=120 --durations=50
- name: Statistics
if: success()
working-directory: ./tests
run: |
coverage xml -i
coverage report -i
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: tests/coverage.xml
flags: ${{ env.COVERAGE_SCOPE }},cpu,pytest
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@v4
# # TODO: this needs to be git submodule
# if: matrix.os == 'windows-2022' # because the install doesn't work on windows
# with:
# repository: Lightning-AI/lightning-quick-start
# ref: 'main'
# path: lightning-quick-start
#
# - name: Lightning Install quick-start
# if: matrix.os != 'windows-2022' # because the install doesn't work on windows
# run: |
# python -m lightning install app lightning/quick-start -y