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

186 lines
6.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/*"
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/**"
- ".actions/**"
pr:
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/**"
- ".actions/**"
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)
jobs:
- job: App_cloud_e2e_testing
pool: azure-cpus
container:
image: mcr.microsoft.com/playwright/python:v1.27.1-focal
options: "--shm-size=4gb"
strategy:
matrix:
'App: v0_app':
name: "v0_app"
'App: boring_app':
name: "boring_app"
'App: template_streamlit_ui':
name: "template_streamlit_ui"
'App: template_react_ui':
name: "template_react_ui"
'App: template_jupyterlab': # TODO: clarify where these files lives
name: "template_jupyterlab"
'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-04 15:38:40 +00:00
# 'App: commands_and_api':
# name: "commands_and_api"
'App: quick_start':
name: "quick_start"
timeoutInMinutes: "30"
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
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')
- bash: |
whoami
2022-08-29 20:48:40 +00:00
printf "local id: $(local_id)\n"
python --version
pip --version
displayName: 'Info'
- task: Cache@2
condition: ne(variables['name'], 'quick_start')
inputs:
key: 'pip | "$(name)" | requirements/app/base.txt'
restoreKeys: |
pip | "$(Agent.OS)"
path: $(pip_cache_dir)
displayName: Cache pip
- bash: git restore . && python -m pip install -e .[ui] --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
2022-09-28 17:20:57 +00:00
env:
PACKAGE_NAME: app
displayName: 'Install lightning app'
2022-09-28 17:20:57 +00:00
- bash: python -m pip install -r requirements/app/test.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
2022-09-28 17:20:57 +00:00
env:
PACKAGE_NAME: pytorch
displayName: 'Install dependencies'
- bash: |
python -m pip install playwright
python -m playwright install # --with-deps
displayName: 'Install Playwright system dependencies'
- 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'
- bash: |
rm -rf examples/app_template_react_ui || true
git clone https://github.com/Lightning-AI/lightning-template-react examples/app_template_react_ui
condition: eq(variables['name'], 'template_react_ui')
displayName: 'Clone Template React UI Repo'
- bash: python -m lightning install app lightning/quick-start -y
condition: eq(variables['name'], 'quick_start')
displayName: 'Install Quick Start'
- bash: |
pip --version
pip list
displayName: 'List pip dependency'
- bash: |
mkdir -p ${VIDEO_LOCATION}
ls -l examples/${TEST_APP_NAME}
ls -l tests/tests_app_examples
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
env:
HEADLESS: '1'
PACKAGE_LIGHTNING: '1'
CLOUD: '1'
VIDEO_LOCATION: '$(Build.ArtifactStagingDirectory)/videos'
PR_NUMBER: $(local_id)
TEST_APP_NAME: $(name)
HAR_LOCATION: './artifacts/hars'
SLOW_MO: '50'
# LAI_USER: $(LAI_USER)
# LAI_PASS: $(LAI_PASS)
LIGHTNING_USER_ID: $(LIGHTNING_USER_ID_PROD)
LIGHTNING_API_KEY: $(LIGHTNING_API_KEY_PROD)
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME)
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL_PROD)
LIGHTNING_DEBUG: '1'
displayName: 'Run the tests'
- publish: '$(Build.ArtifactStagingDirectory)/videos'
condition: failed()
displayName: 'Publish videos'
artifact: $(name)
- bash: |
time python -c "from lightning.app import testing; testing.delete_cloud_lightning_apps()"
condition: always()
env:
# LAI_USER: $(LAI_USER)
# LAI_PASS: $(LAI_PASS)
LIGHTNING_USER_ID: $(LIGHTNING_USER_ID_PROD)
LIGHTNING_API_KEY: $(LIGHTNING_API_KEY_PROD)
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME)
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL_PROD)
PR_NUMBER: $(local_id)
TEST_APP_NAME: $(name)
# 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)
displayName: 'Clean Previous Apps'