|
| 1 | +name: Test App - flagships |
| 2 | + |
| 3 | +# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: ["release/*"] |
| 7 | + pull_request: |
| 8 | + branches: [master, "release/*"] |
| 9 | + types: [opened, reopened, ready_for_review, synchronize] |
| 10 | + paths: |
| 11 | + - ".github/workflows/ci-flagship-apps.yml" |
| 12 | + - "tests/integrations_app/flagship/**" |
| 13 | + workflow_dispatch: {} |
| 14 | + # TODO: inputs specifying lightning branch and switch prod/staging |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} |
| 18 | + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} |
| 19 | + |
| 20 | +defaults: |
| 21 | + run: |
| 22 | + shell: bash |
| 23 | + |
| 24 | +jobs: |
| 25 | + app-flagships: |
| 26 | + if: github.event.pull_request.draft == false |
| 27 | + runs-on: ubuntu-latest |
| 28 | + container: |
| 29 | + image: mcr.microsoft.com/playwright/python:v1.29.1-focal |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + include: |
| 34 | + - {app: "flashy", repo: "Lightning-AI/LAI-Flashy-App"} |
| 35 | + - {app: "muse", repo: "Lightning-AI/stable-diffusion-deploy"} |
| 36 | + - {app: "jupyter", repo: "Lightning-AI/LAI-Jupyter-Component"} |
| 37 | + |
| 38 | + # TODO: |
| 39 | + # - Training Studio |
| 40 | + # - Echo |
| 41 | + # - StreamLit / Gradio |
| 42 | + # - All homepage & docs apps |
| 43 | + |
| 44 | + env: |
| 45 | + HEADLESS: '1' |
| 46 | + PACKAGE_LIGHTNING: '1' |
| 47 | + CLOUD: '1' |
| 48 | + VIDEO_LOCATION: './videos' |
| 49 | + HAR_LOCATION: './artifacts/hars' |
| 50 | + SLOW_MO: '50' |
| 51 | + LIGHTNING_DEBUG: '1' |
| 52 | + TORCH_URL: 'https://download.pytorch.org/whl/cpu/torch_stable.html' |
| 53 | + # Timeout: https://stackoverflow.com/a/59076067/4521646 |
| 54 | + timeout-minutes: 20 |
| 55 | + |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v3 |
| 58 | + - name: Set up Python ${{ matrix.python-version }} |
| 59 | + uses: actions/setup-python@v4 |
| 60 | + with: |
| 61 | + python-version: ${{ matrix.python-version }} |
| 62 | + |
| 63 | + - name: basic setup |
| 64 | + run: | |
| 65 | + mkdir -p tests/_flagships |
| 66 | + mkdir -p $VIDEO_LOCATION |
| 67 | + python -m playwright install # --with-deps |
| 68 | +
|
| 69 | + - name: Adjust testing |
| 70 | + run: | |
| 71 | + pip install -q -r .actions/requirements.txt |
| 72 | + python .actions/assistant.py copy_replace_imports --source_dir="./tests" \ |
| 73 | + --source_import="lightning_app" --target_import="lightning.app" |
| 74 | +
|
| 75 | + - name: Clone the Repo/App |
| 76 | + uses: actions/checkout@v3 |
| 77 | + with: |
| 78 | + repository: ${{ matrix.repo }} |
| 79 | + path: tests/_flagship-app |
| 80 | + |
| 81 | + - name: Adjust env. for this App |
| 82 | + uses: ./.github/actions/prep-apps |
| 83 | + with: |
| 84 | + name: ${{ matrix.app }} |
| 85 | + |
| 86 | + - name: Install Lightning package |
| 87 | + run: pip install -e .[cloud,test] -f $TORCH_URL |
| 88 | + - name: List pip dependency |
| 89 | + run: pip --version && pip list |
| 90 | + |
| 91 | + - name: Run the tests |
| 92 | + working-directory: tests/ |
| 93 | + env: |
| 94 | + LIGHTNING_USER_ID: ${{ secrets.LIGHTNING_USER_ID_PROD }} |
| 95 | + LIGHTNING_API_KEY: ${{ secrets.LIGHTNING_API_KEY_PROD }} |
| 96 | + LIGHTNING_USERNAME: ${{ secrets.LIGHTNING_USERNAME_PROD }} |
| 97 | + LIGHTNING_CLOUD_URL: ${{ secrets.LIGHTNING_CLOUD_URL_PROD }} |
| 98 | + run: | |
| 99 | + ls -l _flagship-app |
| 100 | + python -m pytest integrations_app/flagship/test_${{ matrix.app }}.py \ |
| 101 | + --capture=no -v --color=yes |
| 102 | +
|
| 103 | + - name: Upload recordings |
| 104 | + uses: actions/upload-artifact@v3 |
| 105 | + if: failure() |
| 106 | + with: |
| 107 | + name: flahship-app-${{ matrix.app }} |
| 108 | + path: ${{ env.VIDEO_LOCATION }} |
| 109 | + |
| 110 | + - name: Clean Previous Apps |
| 111 | + if: always() |
| 112 | + timeout-minutes: 3 |
| 113 | + env: |
| 114 | + LIGHTNING_USER_ID: ${{ secrets.LIGHTNING_USER_ID_PROD }} |
| 115 | + LIGHTNING_API_KEY: ${{ secrets.LIGHTNING_API_KEY_PROD }} |
| 116 | + LIGHTNING_USERNAME: ${{ secrets.LIGHTNING_USERNAME_PROD }} |
| 117 | + LIGHTNING_CLOUD_URL: ${{ secrets.LIGHTNING_CLOUD_URL_PROD }} |
| 118 | + run: | |
| 119 | + time python -c "from lightning.app import testing; testing.delete_cloud_lightning_apps()" |
0 commit comments