141 lines
4.7 KiB
YAML
141 lines
4.7 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:
|
||
|
- "master"
|
||
|
- "release/*"
|
||
|
- "refs/tags/*"
|
||
|
|
||
|
pr:
|
||
|
- "master"
|
||
|
- "release/*"
|
||
|
|
||
|
variables:
|
||
|
# variables are automatically exported as environment variables so this will override pip's default cache dir
|
||
|
- name: pip_cache_dir
|
||
|
value: $(Pipeline.Workspace)/.pip
|
||
|
|
||
|
jobs:
|
||
|
- job: App_cloud_e2e_testing
|
||
|
pool:
|
||
|
vmImage: 'ubuntu-latest'
|
||
|
timeoutInMinutes: "30"
|
||
|
cancelTimeoutInMinutes: "2"
|
||
|
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': # TODO: clarify visibility private/public
|
||
|
# 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"
|
||
|
'App: commands_and_api':
|
||
|
name: "commands_and_api"
|
||
|
workspace:
|
||
|
clean: all
|
||
|
steps:
|
||
|
- bash: |
|
||
|
python --version
|
||
|
pip --version
|
||
|
displayName: 'Info'
|
||
|
|
||
|
# TODO: parse the PR number
|
||
|
- bash: |
|
||
|
ID=$(date +%s)
|
||
|
echo "##vso[task.setvariable variable=local_id]$ID"
|
||
|
|
||
|
- task: Cache@2
|
||
|
inputs:
|
||
|
key: 'pip | "$(name)" | requirements/app/base.txt'
|
||
|
restoreKeys: |
|
||
|
pip | "$(Agent.OS)"
|
||
|
path: $(pip_cache_dir)
|
||
|
displayName: Cache pip
|
||
|
|
||
|
- bash: python -m pip install -r requirements/app/devel.txt --quiet --find-links ${TORCH_URL}
|
||
|
env:
|
||
|
TORCH_URL: https://download.pytorch.org/whl/cpu/torch_stable.html
|
||
|
displayName: 'Install dependencies'
|
||
|
|
||
|
- bash: |
|
||
|
python -m pip install playwright
|
||
|
python -m playwright install --with-deps
|
||
|
displayName: 'Install Playwright system dependencies'
|
||
|
|
||
|
- bash: pip install -e .
|
||
|
displayName: 'Install lightning'
|
||
|
|
||
|
- bash: |
|
||
|
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: 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: |
|
||
|
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=900 --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)
|
||
|
LIGHTNING_API_KEY: $(LIGHTNING_API_KEY)
|
||
|
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME)
|
||
|
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL)
|
||
|
displayName: 'Run the tests'
|
||
|
|
||
|
- publish: '$(Build.ArtifactStagingDirectory)/videos'
|
||
|
displayName: 'Publish videos'
|
||
|
artifact: $(name)
|
||
|
|
||
|
- bash: |
|
||
|
time python -c "from lightning.app import testing; testing.delete_cloud_lightning_apps()"
|
||
|
env:
|
||
|
LAI_USER: $(LAI_USER)
|
||
|
LAI_PASS: $(LAI_PASS)
|
||
|
LIGHTNING_USER_ID: $(LIGHTNING_USER_ID)
|
||
|
LIGHTNING_API_KEY: $(LIGHTNING_API_KEY)
|
||
|
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME)
|
||
|
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL)
|
||
|
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'
|