From 5ee292d112295a0fbd75bf96bebd925775916b48 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Wed, 29 Jan 2025 17:45:27 +0100 Subject: [PATCH 1/4] Split build tests and integration tests in 2 workflows --- .github/workflows/build.yml | 114 -------------------------------- .github/workflows/ui-tests.yml | 116 +++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 114 deletions(-) create mode 100644 .github/workflows/ui-tests.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4d457a..acf79a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,120 +102,6 @@ jobs: path: python/jupyterlab-chat/dist/jupyterlab_chat* if-no-files-found: error - integration-tests: - name: Integration tests - needs: build_extension - runs-on: ubuntu-latest - - env: - PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Base Setup - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - - - name: Download extension package - uses: actions/download-artifact@v3 - with: - name: jupyterlab_chat-artifacts - - - name: Install the extension - run: | - set -eux - python -m pip install "jupyterlab>=4.0.0,<5" jupyterlab_chat*.whl - - - name: Install dependencies - working-directory: ui-tests - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: 0 - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: jlpm install - - - name: Set up browser cache - uses: actions/cache@v3 - with: - path: | - ${{ github.workspace }}/pw-browsers - key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} - - - name: Install browser - run: jlpm playwright install chromium - working-directory: ui-tests - - - name: Execute integration tests - working-directory: ui-tests - run: | - jlpm test --retries=2 - - - name: Upload Playwright Test report - if: always() - uses: actions/upload-artifact@v3 - with: - name: jupyterlab_chat-playwright-tests - path: | - ui-tests/test-results - ui-tests/playwright-report - - integration-tests-notebook: - name: Integration tests notebook - needs: build_extension - runs-on: ubuntu-latest - - env: - PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Base Setup - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - - - name: Download extension package - uses: actions/download-artifact@v3 - with: - name: jupyterlab_chat-artifacts - - - name: Install the extension - run: | - set -eux - python -m pip install "notebook>=7.0.0,<8" jupyterlab_chat*.whl - - - name: Install dependencies - working-directory: ui-tests - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: 0 - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: jlpm install - - - name: Set up browser cache - uses: actions/cache@v3 - with: - path: | - ${{ github.workspace }}/pw-browsers - key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} - - - name: Install browser - run: jlpm playwright install chromium - working-directory: ui-tests - - - name: Execute integration tests - working-directory: ui-tests - run: | - jlpm test:notebook --retries=2 - - - name: Upload Playwright Test report - if: always() - uses: actions/upload-artifact@v3 - with: - name: jupyterlab_chat-notebook-playwright-tests - path: | - ui-tests/test-results - ui-tests/playwright-report - typing-tests: name: Typing test runs-on: ubuntu-latest diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml new file mode 100644 index 0000000..3e7c45c --- /dev/null +++ b/.github/workflows/ui-tests.yml @@ -0,0 +1,116 @@ +name: Build + +on: + push: + branches: main + pull_request: + branches: '*' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + jupyterlab: + name: Integration tests jupyterlab + runs-on: ubuntu-latest + + env: + PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Install the extension + run: | + set -eux + python -m pip install "jupyterlab>=4.0.0,<5" + ./scripts/dev_install.sh + + - name: Install tests dependencies + working-directory: ui-tests + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: 0 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + run: jlpm install + + - name: Set up browser cache + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/pw-browsers + key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} + + - name: Install browser + run: jlpm playwright install chromium + working-directory: ui-tests + + - name: Execute integration tests + working-directory: ui-tests + run: | + jlpm test --retries=2 + + - name: Upload Playwright Test report + if: always() + uses: actions/upload-artifact@v3 + with: + name: integration-jupyterlab + path: | + ui-tests/test-results + ui-tests/playwright-report + + notebook: + name: Integration tests notebook + runs-on: ubuntu-latest + + env: + PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Install the extension + run: | + set -eux + python -m pip install "notebook>=7.0.0,<8" + ./scripts/dev_install.sh + + - name: Install dependencies + working-directory: ui-tests + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: 0 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + run: jlpm install + + - name: Set up browser cache + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/pw-browsers + key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }} + + - name: Install browser + run: jlpm playwright install chromium + working-directory: ui-tests + + - name: Execute integration tests + working-directory: ui-tests + run: | + jlpm test:notebook --retries=2 + + - name: Upload Playwright Test report + if: always() + uses: actions/upload-artifact@v3 + with: + name: integration-notebook + path: | + ui-tests/test-results + ui-tests/playwright-report From 95a783fdc30833eff4546d4b2a378b618fbf04b1 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Wed, 29 Jan 2025 18:58:55 +0100 Subject: [PATCH 2/4] Rename the new test --- .github/workflows/ui-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 3e7c45c..adf0b3d 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -1,4 +1,4 @@ -name: Build +name: UI tests on: push: @@ -12,7 +12,7 @@ concurrency: jobs: jupyterlab: - name: Integration tests jupyterlab + name: jupyterlab runs-on: ubuntu-latest env: @@ -64,7 +64,7 @@ jobs: ui-tests/playwright-report notebook: - name: Integration tests notebook + name: notebook runs-on: ubuntu-latest env: From 473d9e46f372578eeab8c1dd868d819eb660fe3f Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Thu, 30 Jan 2025 14:45:45 +0100 Subject: [PATCH 3/4] Fix mypy that complains sometime (?) --- python/jupyterlab-chat/jupyterlab_chat/ychat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/jupyterlab-chat/jupyterlab_chat/ychat.py b/python/jupyterlab-chat/jupyterlab_chat/ychat.py index 242687d..d80679d 100644 --- a/python/jupyterlab-chat/jupyterlab_chat/ychat.py +++ b/python/jupyterlab-chat/jupyterlab_chat/ychat.py @@ -21,9 +21,9 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._background_tasks: Set[asyncio.Task] = set() self.dirty = True - self._ydoc["users"] = self._yusers = Map() - self._ydoc["messages"] = self._ymessages = Array() - self._ydoc["metadata"] = self._ymetadata = Map() + self._ydoc["users"] = self._yusers = Map() # type:ignore[var-annotated] + self._ydoc["messages"] = self._ymessages = Array() # type:ignore[var-annotated] + self._ydoc["metadata"] = self._ymetadata = Map() # type:ignore[var-annotated] self._ymessages.observe(self._on_messages_change) # Observe the state to initialize the file as soon as the document is not dirty. From 6377ba0f38b6727ef356b1b6ca91ced252d8c1c2 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Thu, 30 Jan 2025 15:11:54 +0100 Subject: [PATCH 4/4] Update github actions --- .github/workflows/build.yml | 10 +++++----- .github/workflows/check-release.yml | 4 ++-- .github/workflows/license-header.yml | 2 +- .github/workflows/ui-tests.yml | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index acf79a0..f54b8f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 @@ -52,7 +52,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 @@ -75,7 +75,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 @@ -96,7 +96,7 @@ jobs: pip uninstall -y "jupyterlab_chat" jupyterlab - name: Upload package - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: jupyterlab_chat-artifacts path: python/jupyterlab-chat/dist/jupyterlab_chat* @@ -126,6 +126,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1 diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index 2c80cbc..ba2a9cd 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 @@ -25,7 +25,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Upload Distributions - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: jupyter_chat-releaser-dist-${{ github.run_number }} path: .jupyter_releaser_checkout/dist diff --git a/.github/workflows/license-header.yml b/.github/workflows/license-header.yml index 7ed6132..a139763 100644 --- a/.github/workflows/license-header.yml +++ b/.github/workflows/license-header.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index adf0b3d..8fb00ee 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 @@ -56,7 +56,7 @@ jobs: - name: Upload Playwright Test report if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: integration-jupyterlab path: | @@ -72,7 +72,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 @@ -108,7 +108,7 @@ jobs: - name: Upload Playwright Test report if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: integration-notebook path: |