lightning/.azure/app-cloud-e2e.yml

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

207 lines
7.2 KiB
YAML
Raw Normal View History

# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
trigger:
tags:
include:
- "*"
branches:
include:
- "master"
- "release/*"
- "refs/tags/*"
schedules:
- cron: "0 0 * * *" # At the end of every day
displayName: Daily midnight testing
branches:
include:
- "master"
pr:
branches:
include:
- "master"
- "release/*"
paths:
include:
2023-06-15 15:25:59 +00:00
- ".actions/*"
2022-11-16 10:07:02 +00:00
- ".azure/app-cloud-e2e.yml"
2023-03-06 17:19:50 +00:00
- "src/lightning/__about__.py"
- "src/lightning/__init__.py"
- "src/lightning/__main__.py"
- "src/lightning/__setup__.py"
- "src/lightning/__version__.py"
- "src/lightning/app/**"
- "src/lightning_app/*"
- "examples/app/**"
- "requirements/app/**"
- "tests/integrations_app/**"
2022-11-16 10:07:02 +00:00
- "setup.py"
exclude:
- "!tests/integrations_app/flagship/**"
- "requirements/*/docs.txt"
- "*.md"
- "**/*.md"
2022-08-29 20:48:40 +00:00
# variables are automatically exported as environment variables so this will override pip's default cache dir
variables:
- name: pip_cache_dir
value: $(Pipeline.Workspace)/.pip
2022-08-29 20:48:40 +00:00
- name: local_id
value: $(Build.BuildId)
- name: video_artifact_dir
value: ./videos
jobs:
- job: test_e2e
pool: "azure-cpus"
container:
# see all available tags: https://mcr.microsoft.com/en-us/product/playwright/python/tags
image: mcr.microsoft.com/playwright/python:v1.38.0-focal
options: "--shm-size=4gb"
strategy:
matrix:
"App: v0_app":
name: "v0_app"
dir: "public"
"App: boring_app":
name: "boring_app"
dir: "public"
"App: template_streamlit_ui":
name: "template_streamlit_ui"
dir: "public"
"App: template_react_ui":
name: "template_react_ui"
dir: "public"
# 'App: template_jupyterlab': # TODO: clarify where these files lives
# name: "template_jupyterlab"
"App: installation_commands_app":
name: "installation_commands_app"
dir: "public"
"App: drive":
name: "drive"
dir: "public"
"App: payload":
name: "payload"
dir: "public"
"App: commands_and_api":
name: "commands_and_api"
dir: "public"
"App: quick_start":
2023-06-26 14:31:59 +00:00
name: "quick_start"
dir: "public"
"App: idle_timeout":
name: "idle_timeout"
dir: "local"
"App: collect_failures":
name: "collect_failures"
dir: "local"
"App: custom_work_dependencies":
name: "custom_work_dependencies"
dir: "local"
timeoutInMinutes: "15"
2022-11-26 01:16:48 +00:00
cancelTimeoutInMinutes: "1"
2022-08-31 19:11:06 +00:00
# values: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#workspace
workspace:
clean: all
variables:
FREEZE_REQUIREMENTS: "1"
HEADLESS: "1"
PACKAGE_LIGHTNING: "1"
CLOUD: "1"
VIDEO_LOCATION: $(video_artifact_dir)
PR_NUMBER: $(local_id)
TEST_APP_NAME: $(name)
TEST_APP_FOLDER: $(dir)
HAR_LOCATION: "./artifacts/hars"
SLOW_MO: "50"
LIGHTNING_DEBUG: "1"
steps:
- script: echo '##vso[task.setvariable variable=local_id]$(System.PullRequest.PullRequestNumber)'
displayName: "Set id for this PR"
condition: eq(variables['Build.Reason'], 'PullRequest')
2022-08-29 20:48:40 +00:00
- bash: |
whoami
mkdir -p "$(video_artifact_dir)/$(name)"
printf "local id: $(local_id)\n"
python --version
pip --version
echo "allow fail: ${{ in(variables['name'], 'quick_start', 'template_react_ui') }}"
displayName: "Info"
2022-08-29 20:48:40 +00:00
# TODO: we are testing it as `lightning`, so add also version for `lightning_app`
- bash: |
pip install -e .[app-dev] \
-f https://download.pytorch.org/whl/cpu/torch_stable.html
displayName: "Install Lightning & dependencies"
- bash: python -m playwright install # --with-deps
displayName: "Install Playwright system dependencies"
# The magic happens here it doesn't need to install the quick start dependencies.
# This test is very important to test the main user story of lightning app.
# It also e2e tests running on cloud without installing dependencies.
- bash: |
git clone https://github.com/Lightning-AI/lightning-quick-start examples/app/quick-start
# without succeeded this could run even if the job has already failed
condition: and(succeeded(), eq(variables['name'], 'quick_start'))
displayName: "Clone Quick start Repo"
- bash: |
git clone https://github.com/Lightning-AI/lightning-template-react examples/app/template_react_ui
# without succeeded this could run even if the job has already failed
condition: and(succeeded(), eq(variables['name'], 'template_react_ui'))
displayName: "Clone Template React UI Repo"
# Replace imports to use `lightning` instead of `lightning_app` since we install lightning only ATM
- bash: |
pip install -q -r .actions/requirements.txt
python .actions/assistant.py copy_replace_imports \
--source_dir="./examples" --source_import="lightning_app" --target_import="lightning.app"
displayName: "Adjust examples"
- bash: pip --version && pip list
displayName: "List pip dependency"
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
- bash: |
ls -l examples/app/$(TEST_APP_NAME)
echo ${TEST_FILE}
python -m pytest ${TEST_FILE}::test_$(TEST_APP_NAME)_example_cloud \
--timeout=360 --capture=no -v --color=yes
env:
TEST_FILE: tests/integrations_app/$(TEST_APP_FOLDER)/test_$(TEST_APP_NAME).py
#LAI_USER: $(LAI_USER) # for STAGING
#LAI_PASS: $(LAI_PASS) # for STAGING
LIGHTNING_USER_ID: $(LIGHTNING_USER_ID_PROD)
LIGHTNING_API_KEY: $(LIGHTNING_API_KEY_PROD)
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME_PROD)
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL_PROD)
# Todo: investigate why these apps are failing
continueOnError: ${{ in(variables['name'], 'quick_start', 'template_react_ui') }}
displayName: "Run the tests"
- task: PublishPipelineArtifact@1
condition: failed()
inputs:
path: "$(video_artifact_dir)/$(name)"
artifactName: $(name)
publishLocation: "pipeline"
displayName: "Publish videos"
- bash: |
time python -c "from lightning.app import testing; testing.delete_cloud_lightning_apps()"
condition: always()
continueOnError: "true"
timeoutInMinutes: "3"
env:
#LAI_USER: $(LAI_USER) # for STAGING
#LAI_PASS: $(LAI_PASS) # for STAGING
LIGHTNING_USER_ID: $(LIGHTNING_USER_ID_PROD)
LIGHTNING_API_KEY: $(LIGHTNING_API_KEY_PROD)
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME_PROD)
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL_PROD)
displayName: "Clean Previous Apps"