Merge pull request #33 from yacchin1205/feature/update-scipy-notebook… #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Tests | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| workflow_dispatch: | |
| jobs: | |
| notebook-e2e: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('ui-tests/e2e-notebook/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install Python dependencies | |
| run: | | |
| set -euxo pipefail | |
| pip install --upgrade pip | |
| pip install -r ui-tests/e2e-notebook/requirements.txt | |
| - name: Install Playwright browsers | |
| run: | | |
| set -euxo pipefail | |
| python -m playwright install --with-deps | |
| - name: Build Docker image | |
| run: | | |
| set -euxo pipefail | |
| docker build -t lc_notebook_diff:test . | |
| - name: Prepare test workspace | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ui-tests/e2e-notebook/artifacts/jupyter-work | |
| cp -r html/* ui-tests/e2e-notebook/artifacts/jupyter-work/ | |
| chmod -R a+w ui-tests/e2e-notebook/artifacts/jupyter-work | |
| - name: Start lc_notebook_diff container | |
| run: | | |
| set -euxo pipefail | |
| docker run -d \ | |
| --name lc-notebook-diff-test \ | |
| -p 8888:8888 \ | |
| -v $(pwd)/ui-tests/e2e-notebook/artifacts/jupyter-work:/home/jovyan/work \ | |
| lc_notebook_diff:test \ | |
| start-notebook.sh --ServerApp.token='test-token' --ServerApp.allow_origin='*' --ServerApp.root_dir='/home/jovyan/work' | |
| sleep 30 | |
| # Health check | |
| curl --retry 10 --retry-delay 5 --retry-connrefused --fail http://localhost:8888/lab?token=test-token || (docker logs lc-notebook-diff-test && exit 1) | |
| - name: Run notebook E2E tests | |
| env: | |
| E2E_TRANSITION_TIMEOUT: '60000' | |
| E2E_DEFAULT_DELAY: '200' | |
| JUPYTERLAB_URL: 'http://localhost:8888/lab?token=test-token' | |
| NOTEBOOK7_URL: 'http://localhost:8888/tree?token=test-token' | |
| NBCLASSIC_URL: 'http://localhost:8888/nbclassic/tree?token=test-token' | |
| JUPYTER_WORK_DIR: ${{ github.workspace }}/ui-tests/e2e-notebook/artifacts/jupyter-work | |
| run: | | |
| set -euxo pipefail | |
| python ui-tests/e2e-notebook/run_notebooks.py --skip-failed-test | |
| - name: Gather Docker logs | |
| if: always() | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p ui-tests/e2e-notebook/artifacts | |
| docker logs lc-notebook-diff-test > ui-tests/e2e-notebook/artifacts/lc-notebook-diff-container.log 2>&1 || true | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-results | |
| path: | | |
| ui-tests/e2e-notebook/artifacts | |
| - name: Shutdown container | |
| if: always() | |
| run: | | |
| set -euxo pipefail | |
| docker stop lc-notebook-diff-test || true | |
| docker rm lc-notebook-diff-test || true |