lightning/.azure/app-flagships.yml

155 lines
4.9 KiB
YAML

# 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:
- "release/*"
- "refs/tags/*"
# TODO: just for debugging this PR
- "ci/flagship-*"
schedules:
- cron: "0 0 * * *" # At the end of every day
displayName: Daily midnight testing
branches:
include:
- "release/*"
pr: none
# 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
- name: local_id
value: $(Build.BuildId)
- name: video_artifact_dir
value: ./videos
jobs:
- job: test_flagships
pool: azure-cpus
container:
image: mcr.microsoft.com/playwright/python:v1.29.1-focal
options: "--shm-size=4gb"
# TODO:
# - Training Studio
# - Echo
# - StreamLit / Gradio
# - All homepage & docs apps
strategy:
matrix:
'App: Flashy':
name: "flashy"
repo: "https://github.com/Lightning-AI/LAI-Flashy-App.git"
'App: Muse':
name: "stable-diffusion"
repo: "https://github.com/Lightning-AI/stable-diffusion-deploy.git"
'Component: Jupyter':
name: "jupyter"
repo: "https://github.com/Lightning-AI/LAI-Jupyter-Component.git"
timeoutInMinutes: "25"
cancelTimeoutInMinutes: "1"
# values: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#workspace
workspace:
clean: all
variables:
HEADLESS: '1'
PACKAGE_LIGHTNING: '1'
CLOUD: '1'
VIDEO_LOCATION: $(video_artifact_dir)
HAR_LOCATION: './artifacts/hars'
SLOW_MO: '50'
LIGHTNING_DEBUG: '1'
steps:
- bash: |
whoami
mkdir -p tests/_flagships
mkdir -p $(video_artifact_dir)/$(name)
printf "local id: $(local_id)\n"
python --version
pip --version
displayName: 'Info'
- script: |
pip install -q -r .actions/requirements.txt
python .actions/assistant.py copy_replace_imports \
--source_dir="./tests" --source_import="lightning_app" --target_import="lightning.app"
displayName: 'Adjust testing'
- script: |
pip install playwright
python -m playwright install # --with-deps
displayName: 'Install Playwright system dependencies'
- script: git clone $(repo) tests/_flagships/$(name)
displayName: 'Clone the Repo/App'
- script: |
ls -l .
pip install -r requirements-dev.txt
pip install -e .
workingDirectory: tests/_flagships/$(name)
condition: eq(variables['name'], 'flashy')
displayName: 'adjust env -> Flashy'
- script: |
pip install -e _flagships/$(name)
cp _flagships/$(name)/tests/test_app.py integrations_app/flagship/test_stable-diffusion.py
workingDirectory: tests/
condition: eq(variables['name'], 'stable-diffusion')
displayName: 'adjust env -> Muse'
- script: |
pip install -e _flagships/$(name)
# pip install -r _flagships/$(name)/tests/requirements-dev.txt
cp _flagships/$(name)/tests/test_jupyter_app.py integrations_app/flagship/test_jupyter.py
workingDirectory: tests/
condition: eq(variables['name'], 'jupyter')
displayName: 'adjust env -> Jupyter'
- script: pip install -e .[cloud,test] -f https://download.pytorch.org/whl/cpu/torch_stable.html
displayName: 'Install Lightning & dependencies'
- bash: pip --version && pip list
displayName: 'List pip dependency'
- script: |
ls -l tests/_flagships
python -m pytest tests/integrations_app/flagship/test_$(name).py \
--timeout=540 --capture=no -v --color=yes
env:
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: 'Run the tests'
- task: PublishPipelineArtifact@1
condition: failed()
inputs:
path: "$(video_artifact_dir)/$(name)"
artifactName: $(name)
publishLocation: 'pipeline'
displayName: 'Publish videos'
- script: |
time python -c "from lightning.app import testing; testing.delete_cloud_lightning_apps()"
condition: always()
timeoutInMinutes: "3"
env:
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'