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:
|
2023-09-25 12:34:41 +00:00
|
|
|
- "*"
|
2022-08-23 15:50:30 +00:00
|
|
|
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:
|
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"
|
2023-02-01 05:29:16 +00:00
|
|
|
- "src/lightning/app/**"
|
|
|
|
- "src/lightning_app/*"
|
2023-03-14 18:48:17 +00:00
|
|
|
- "examples/app/**"
|
2022-11-22 19:04:29 +00:00
|
|
|
- "requirements/app/**"
|
2023-01-12 15:13:52 +00:00
|
|
|
- "tests/integrations_app/**"
|
2022-11-16 10:07:02 +00:00
|
|
|
- "setup.py"
|
2022-11-22 01:25:01 +00:00
|
|
|
exclude:
|
2023-01-26 09:28:30 +00:00
|
|
|
- "!tests/integrations_app/flagship/**"
|
2022-11-22 19:04:29 +00:00
|
|
|
- "requirements/*/docs.txt"
|
2022-11-22 01:25:01 +00:00
|
|
|
- "*.md"
|
|
|
|
- "**/*.md"
|
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:
|
2023-01-12 18:12:47 +00:00
|
|
|
- job: test_e2e
|
2023-01-10 12:52:01 +00:00
|
|
|
pool: "azure-cpus"
|
2022-08-26 09:07:35 +00:00
|
|
|
container:
|
2023-01-16 17:40:05 +00:00
|
|
|
# see all available tags: https://mcr.microsoft.com/en-us/product/playwright/python/tags
|
2023-10-02 20:44:10 +00:00
|
|
|
image: mcr.microsoft.com/playwright/python:v1.38.0-focal
|
2022-09-27 07:16:46 +00:00
|
|
|
options: "--shm-size=4gb"
|
2022-08-23 15:50:30 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: v0_app":
|
2022-08-23 15:50:30 +00:00
|
|
|
name: "v0_app"
|
2022-11-22 19:04:29 +00:00
|
|
|
dir: "public"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: boring_app":
|
2022-08-23 15:50:30 +00:00
|
|
|
name: "boring_app"
|
2022-11-22 19:04:29 +00:00
|
|
|
dir: "public"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: template_streamlit_ui":
|
2023-04-24 11:27:35 +00:00
|
|
|
name: "template_streamlit_ui"
|
|
|
|
dir: "public"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: template_react_ui":
|
2022-08-23 17:31:36 +00:00
|
|
|
name: "template_react_ui"
|
2022-11-22 19:04:29 +00:00
|
|
|
dir: "public"
|
2022-10-25 13:24:20 +00:00
|
|
|
# 'App: template_jupyterlab': # TODO: clarify where these files lives
|
|
|
|
# name: "template_jupyterlab"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: installation_commands_app":
|
2022-11-09 14:45:38 +00:00
|
|
|
name: "installation_commands_app"
|
2022-11-22 19:04:29 +00:00
|
|
|
dir: "public"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: drive":
|
2022-08-23 15:50:30 +00:00
|
|
|
name: "drive"
|
2022-11-22 19:04:29 +00:00
|
|
|
dir: "public"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: payload":
|
2022-08-23 15:50:30 +00:00
|
|
|
name: "payload"
|
2022-11-22 19:04:29 +00:00
|
|
|
dir: "public"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: commands_and_api":
|
2022-10-25 13:24:20 +00:00
|
|
|
name: "commands_and_api"
|
2022-11-22 19:04:29 +00:00
|
|
|
dir: "public"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: quick_start":
|
2023-06-26 14:31:59 +00:00
|
|
|
name: "quick_start"
|
|
|
|
dir: "public"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: idle_timeout":
|
2022-11-22 19:04:29 +00:00
|
|
|
name: "idle_timeout"
|
|
|
|
dir: "local"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: collect_failures":
|
2022-11-22 19:04:29 +00:00
|
|
|
name: "collect_failures"
|
|
|
|
dir: "local"
|
2023-09-25 12:34:41 +00:00
|
|
|
"App: custom_work_dependencies":
|
2022-11-22 19:04:29 +00:00
|
|
|
name: "custom_work_dependencies"
|
|
|
|
dir: "local"
|
2022-12-05 21:58:22 +00:00
|
|
|
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
|
2023-01-10 12:52:01 +00:00
|
|
|
variables:
|
2023-01-27 11:27:04 +00:00
|
|
|
FREEZE_REQUIREMENTS: "1"
|
2023-09-25 12:34:41 +00:00
|
|
|
HEADLESS: "1"
|
|
|
|
PACKAGE_LIGHTNING: "1"
|
|
|
|
CLOUD: "1"
|
2023-01-10 12:52:01 +00:00
|
|
|
VIDEO_LOCATION: $(video_artifact_dir)
|
|
|
|
PR_NUMBER: $(local_id)
|
|
|
|
TEST_APP_NAME: $(name)
|
|
|
|
TEST_APP_FOLDER: $(dir)
|
2023-09-25 12:34:41 +00:00
|
|
|
HAR_LOCATION: "./artifacts/hars"
|
|
|
|
SLOW_MO: "50"
|
|
|
|
LIGHTNING_DEBUG: "1"
|
2022-08-23 15:50:30 +00:00
|
|
|
steps:
|
2023-09-25 12:34:41 +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-29 20:48:40 +00:00
|
|
|
|
2023-09-25 12:34:41 +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
|
|
|
|
2023-09-25 12:34:41 +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"
|
2022-08-23 15:50:30 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- bash: python -m playwright install # --with-deps
|
|
|
|
displayName: "Install Playwright system dependencies"
|
2022-08-23 15:50:30 +00:00
|
|
|
|
2023-09-25 12:34:41 +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: |
|
|
|
|
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"
|
2022-08-23 15:50:30 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
# 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"
|
2022-08-23 15:50:30 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- bash: pip --version && pip list
|
|
|
|
displayName: "List pip dependency"
|
2022-10-27 10:32:49 +00:00
|
|
|
|
2023-09-25 12:34:41 +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"
|
2022-09-27 07:16:46 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- task: PublishPipelineArtifact@1
|
|
|
|
condition: failed()
|
|
|
|
inputs:
|
|
|
|
path: "$(video_artifact_dir)/$(name)"
|
|
|
|
artifactName: $(name)
|
|
|
|
publishLocation: "pipeline"
|
|
|
|
displayName: "Publish videos"
|
2022-08-23 15:50:30 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- 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"
|