2022-08-23 15:50:30 +00:00
|
|
|
# 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/*"
|
|
|
|
|
2022-10-25 19:18:01 +00:00
|
|
|
schedules:
|
|
|
|
- cron: "0 0 * * *" # At the end of every day
|
|
|
|
displayName: Daily midnight testing
|
|
|
|
branches:
|
|
|
|
include:
|
|
|
|
- "master"
|
|
|
|
|
2022-08-23 15:50:30 +00:00
|
|
|
pr:
|
2022-09-05 17:11:12 +00:00
|
|
|
branches:
|
|
|
|
include:
|
|
|
|
- "master"
|
|
|
|
- "release/*"
|
|
|
|
paths:
|
|
|
|
include:
|
|
|
|
- ".azure/app-cloud-e2e.yml"
|
|
|
|
- "requirements/app/**"
|
|
|
|
- "src/lightning_app/**"
|
|
|
|
- "examples/app_*"
|
2022-10-04 15:38:40 +00:00
|
|
|
- "tests/tests_app_examples/**"
|
2022-10-20 18:23:47 +00:00
|
|
|
- ".actions/**"
|
2022-08-23 15:50:30 +00:00
|
|
|
|
2022-08-29 20:48:40 +00:00
|
|
|
# variables are automatically exported as environment variables so this will override pip's default cache dir
|
2022-08-23 15:50:30 +00:00
|
|
|
variables:
|
|
|
|
- name: pip_cache_dir
|
|
|
|
value: $(Pipeline.Workspace)/.pip
|
2022-08-29 20:48:40 +00:00
|
|
|
- name: local_id
|
|
|
|
value: $(Build.BuildId)
|
2022-11-01 11:12:57 +00:00
|
|
|
- name: video_artifact_dir
|
|
|
|
value: ./videos
|
2022-08-23 15:50:30 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
- job: App_cloud_e2e_testing
|
2022-08-26 09:07:35 +00:00
|
|
|
pool: azure-cpus
|
|
|
|
container:
|
2022-10-24 08:52:32 +00:00
|
|
|
image: mcr.microsoft.com/playwright/python:v1.27.1-focal
|
2022-09-27 07:16:46 +00:00
|
|
|
options: "--shm-size=4gb"
|
2022-08-23 15:50:30 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
'App: v0_app':
|
|
|
|
name: "v0_app"
|
|
|
|
'App: boring_app':
|
|
|
|
name: "boring_app"
|
|
|
|
'App: template_streamlit_ui':
|
|
|
|
name: "template_streamlit_ui"
|
2022-08-23 17:31:36 +00:00
|
|
|
'App: template_react_ui':
|
|
|
|
name: "template_react_ui"
|
2022-10-25 13:24:20 +00:00
|
|
|
# 'App: template_jupyterlab': # TODO: clarify where these files lives
|
|
|
|
# name: "template_jupyterlab"
|
2022-08-23 15:50:30 +00:00
|
|
|
'App: idle_timeout':
|
|
|
|
name: "idle_timeout"
|
|
|
|
'App: collect_failures':
|
|
|
|
name: "collect_failures"
|
|
|
|
'App: custom_work_dependencies':
|
|
|
|
name: "custom_work_dependencies"
|
|
|
|
'App: drive':
|
|
|
|
name: "drive"
|
|
|
|
'App: payload':
|
|
|
|
name: "payload"
|
2022-10-25 13:24:20 +00:00
|
|
|
'App: commands_and_api':
|
|
|
|
name: "commands_and_api"
|
2022-11-08 16:47:38 +00:00
|
|
|
'App: quick_start':
|
|
|
|
name: "quick_start"
|
2022-11-03 14:19:13 +00:00
|
|
|
timeoutInMinutes: "20"
|
2022-08-30 10:33:58 +00:00
|
|
|
cancelTimeoutInMinutes: "2"
|
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
|
2022-08-23 15:50:30 +00:00
|
|
|
steps:
|
2022-08-29 20:48:40 +00:00
|
|
|
|
|
|
|
- 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-23 15:50:30 +00:00
|
|
|
- bash: |
|
2022-08-26 09:07:35 +00:00
|
|
|
whoami
|
2022-11-01 11:12:57 +00:00
|
|
|
mkdir -p $(video_artifact_dir)
|
2022-08-29 20:48:40 +00:00
|
|
|
printf "local id: $(local_id)\n"
|
2022-08-23 15:50:30 +00:00
|
|
|
python --version
|
|
|
|
pip --version
|
|
|
|
displayName: 'Info'
|
|
|
|
|
2022-10-27 10:32:49 +00:00
|
|
|
# TODO: we are testing it as `lightning`, so add also version for `lightning_app`
|
2022-10-25 13:54:38 +00:00
|
|
|
- bash: git restore . && python -m pip install -e . -r requirements/app/test.txt -r requirements/app/ui.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
|
|
|
|
displayName: 'Install Lightning & dependencies'
|
2022-08-23 15:50:30 +00:00
|
|
|
|
|
|
|
- bash: |
|
|
|
|
python -m pip install playwright
|
2022-08-26 09:07:35 +00:00
|
|
|
python -m playwright install # --with-deps
|
2022-08-23 15:50:30 +00:00
|
|
|
displayName: 'Install Playwright system dependencies'
|
|
|
|
|
2022-11-08 16:47:38 +00:00
|
|
|
# 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: |
|
|
|
|
rm -rf examples/lightning-quick-start || true
|
|
|
|
git clone https://github.com/Lightning-AI/lightning-quick-start examples/lightning-quick-start
|
|
|
|
condition: eq(variables['name'], 'quick_start')
|
|
|
|
displayName: 'Clone Quick start Repo'
|
|
|
|
|
|
|
|
|
2022-10-25 13:24:20 +00:00
|
|
|
# - bash: |
|
|
|
|
# rm -rf examples/app_template_jupyterlab || true
|
|
|
|
# git clone https://github.com/Lightning-AI/LAI-lightning-template-jupyterlab-App examples/app_template_jupyterlab
|
|
|
|
# cp examples/app_template_jupyterlab/tests/test_template_jupyterlab.py tests/tests_app_examples/test_template_jupyterlab.py
|
|
|
|
# condition: eq(variables['name'], 'template_jupyterlab')
|
|
|
|
# displayName: 'Clone Template Jupyter Lab Repo'
|
2022-08-23 15:50:30 +00:00
|
|
|
|
2022-10-25 13:24:20 +00:00
|
|
|
- bash: |
|
2022-09-12 14:47:24 +00:00
|
|
|
rm -rf examples/app_template_react_ui || true
|
|
|
|
git clone https://github.com/Lightning-AI/lightning-template-react examples/app_template_react_ui
|
2022-08-23 15:50:30 +00:00
|
|
|
condition: eq(variables['name'], 'template_react_ui')
|
|
|
|
displayName: 'Clone Template React UI Repo'
|
|
|
|
|
2022-10-27 10:32:49 +00:00
|
|
|
- bash: python -m pip install -q -r .actions/requirements.txt
|
|
|
|
displayName: 'Install assistant dependencies'
|
|
|
|
|
|
|
|
# Fix imports to use `lightning` instead of `lightning_app` since we install lightning only ATM
|
|
|
|
# TODO: fixme when installing `lightning_app` as well
|
|
|
|
- bash: |
|
|
|
|
python .actions/assistant.py copy_replace_imports --source_dir="./examples" --source_import="lightning_app" --target_import="lightning.app"
|
|
|
|
python .actions/assistant.py copy_replace_imports --source_dir="./tests" --source_import="lightning_app" --target_import="lightning.app"
|
|
|
|
displayName: 'Adjust examples'
|
|
|
|
|
2022-09-27 07:16:46 +00:00
|
|
|
- bash: |
|
|
|
|
pip --version
|
|
|
|
pip list
|
|
|
|
displayName: 'List pip dependency'
|
|
|
|
|
2022-08-23 15:50:30 +00:00
|
|
|
- bash: |
|
|
|
|
mkdir -p ${VIDEO_LOCATION}
|
|
|
|
ls -l examples/${TEST_APP_NAME}
|
|
|
|
ls -l tests/tests_app_examples
|
2022-09-27 07:16:46 +00:00
|
|
|
python -m pytest tests/tests_app_examples/test_${TEST_APP_NAME}.py::test_${TEST_APP_NAME}_example_cloud --timeout=1200 --capture=no -v --color=yes
|
2022-08-23 15:50:30 +00:00
|
|
|
env:
|
|
|
|
HEADLESS: '1'
|
|
|
|
PACKAGE_LIGHTNING: '1'
|
|
|
|
CLOUD: '1'
|
2022-11-01 11:12:57 +00:00
|
|
|
VIDEO_LOCATION: $(video_artifact_dir)
|
2022-08-23 15:50:30 +00:00
|
|
|
PR_NUMBER: $(local_id)
|
|
|
|
TEST_APP_NAME: $(name)
|
|
|
|
HAR_LOCATION: './artifacts/hars'
|
|
|
|
SLOW_MO: '50'
|
2022-10-27 17:54:36 +00:00
|
|
|
#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)
|
2022-08-23 15:50:30 +00:00
|
|
|
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME)
|
2022-10-27 17:54:36 +00:00
|
|
|
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL_PROD)
|
2022-09-12 14:47:24 +00:00
|
|
|
LIGHTNING_DEBUG: '1'
|
2022-08-23 15:50:30 +00:00
|
|
|
displayName: 'Run the tests'
|
|
|
|
|
2022-11-01 11:12:57 +00:00
|
|
|
- task: PublishPipelineArtifact@1
|
2022-08-29 13:16:22 +00:00
|
|
|
condition: failed()
|
2022-11-01 11:12:57 +00:00
|
|
|
inputs:
|
|
|
|
path: $(video_artifact_dir)
|
|
|
|
artifactName: $(name)
|
2022-08-23 15:50:30 +00:00
|
|
|
displayName: 'Publish videos'
|
|
|
|
|
|
|
|
- bash: |
|
|
|
|
time python -c "from lightning.app import testing; testing.delete_cloud_lightning_apps()"
|
2022-08-29 13:16:22 +00:00
|
|
|
condition: always()
|
2022-08-23 15:50:30 +00:00
|
|
|
env:
|
2022-10-27 17:54:36 +00:00
|
|
|
#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)
|
2022-08-23 15:50:30 +00:00
|
|
|
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME)
|
2022-10-27 17:54:36 +00:00
|
|
|
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL_PROD)
|
2022-08-23 15:50:30 +00:00
|
|
|
PR_NUMBER: $(local_id)
|
|
|
|
TEST_APP_NAME: $(name)
|
2022-08-26 09:07:35 +00:00
|
|
|
# GRID_USER_ID: $(LIGHTNING_USER_ID) # TODO: clarify the meaning
|
|
|
|
# GRID_USER_KEY: $(LIGHTNING_API_KEY) # TODO: clarify the meaning
|
|
|
|
# GRID_URL: $(LIGHTNING_CLOUD_URL)
|
|
|
|
# _GRID_USERNAME: $(LIGHTNING_USERNAME)
|
2022-08-23 15:50:30 +00:00
|
|
|
displayName: 'Clean Previous Apps'
|