From 0a2131fd3fae4583e7009e993c881d698955881c Mon Sep 17 00:00:00 2001 From: Allen Hill Date: Tue, 26 Nov 2024 15:03:24 -0800 Subject: [PATCH] Update jupyter extension CI --- .github/workflows/jupyter-extension.yml | 98 +++++++++++++++++++ .yarnrc.yml | 1 + .../.github/workflows/build.yml | 96 ------------------ 3 files changed, 99 insertions(+), 96 deletions(-) create mode 100644 .github/workflows/jupyter-extension.yml create mode 100644 .yarnrc.yml delete mode 100644 webio_jupyter_extension/.github/workflows/build.yml diff --git a/.github/workflows/jupyter-extension.yml b/.github/workflows/jupyter-extension.yml new file mode 100644 index 00000000..375d01b6 --- /dev/null +++ b/.github/workflows/jupyter-extension.yml @@ -0,0 +1,98 @@ +name: Build + +on: + push: + branches: main + pull_request: + branches: '*' + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: webio_jupyter_extension + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Build WebIO (@webio/webio) + working-directory: . + run: | + set -eux + npm -C packages install --scripts-prepend-node-path=auto + npm -C packages run build-prod --scripts-prepend-node-path=auto + + - name: Install dependencies + run: | + set -eux + python -m pip install -U "jupyterlab>=4.0.0,<5" + jlpm install + + - name: Lint the extension + run: | + set -eux + jlpm + jlpm run eslint:check + + - name: Build the extension + run: | + set -eux + python -m pip install .[test] + + jupyter server extension list + jupyter server extension list 2>&1 | grep -ie "webio-jupyter-extension.*OK" + + jupyter labextension list + jupyter labextension list 2>&1 | grep -ie "webio-jupyterlab-provider.*OK" + python -m jupyterlab.browser_check + + - name: Package the extension + run: | + set -eux + + pip install build + python -m build + pip uninstall -y "webio-jupyter-extension" jupyterlab + + - name: Upload extension packages + uses: actions/upload-artifact@v4 + with: + name: extension-artifacts + path: dist/webio-jupyter-extension* + if-no-files-found: error + + test_isolated: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + architecture: 'x64' + - uses: actions/download-artifact@v4 + with: + name: extension-artifacts + - name: Install and Test + run: | + set -eux + # Remove NodeJS, twice to take care of system and locally installed node versions. + sudo rm -rf $(which node) + sudo rm -rf $(which node) + + pip install "jupyterlab>=4.0.0,<5" webio-jupyter-extension*.whl + + + jupyter server extension list + jupyter server extension list 2>&1 | grep -ie "webio-jupyter-extension.*OK" + + jupyter labextension list + jupyter labextension list 2>&1 | grep -ie "webio-jupyterlab-provider.*OK" + python -m jupyterlab.browser_check --no-browser-test + diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 00000000..54599219 --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +enableImmutableInstalls: false diff --git a/webio_jupyter_extension/.github/workflows/build.yml b/webio_jupyter_extension/.github/workflows/build.yml deleted file mode 100644 index 429265c0..00000000 --- a/webio_jupyter_extension/.github/workflows/build.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Build - -on: - push: - branches: main - pull_request: - branches: '*' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install node - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: '3.8' - architecture: 'x64' - - - - name: Setup pip cache - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip-3.8-${{ hashFiles('package.json') }} - restore-keys: | - pip-3.8- - pip- - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - name: Setup yarn cache - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - yarn- - - - name: Install dependencies - run: python -m pip install -U jupyterlab~=3.1 check-manifest - - name: Build the extension - run: | - set -eux - jlpm - jlpm run eslint:check - python -m pip install . - - jupyter labextension list 2>&1 | grep -ie "webio-jupyterlab-provider.*OK" - python -m jupyterlab.browser_check - - check-manifest -v - - pip install build - python -m build --sdist - cp dist/*.tar.gz myextension.tar.gz - pip uninstall -y myextension jupyterlab - rm -rf myextension - - - uses: actions/upload-artifact@v2 - with: - name: myextension-sdist - path: myextension.tar.gz - - test_isolated: - needs: build - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: '3.8' - architecture: 'x64' - - uses: actions/download-artifact@v2 - with: - name: myextension-sdist - - name: Install and Test - run: | - set -eux - # Remove NodeJS, twice to take care of system and locally installed node versions. - sudo rm -rf $(which node) - sudo rm -rf $(which node) - pip install myextension.tar.gz - pip install jupyterlab - jupyter labextension list 2>&1 | grep -ie "webio-jupyterlab-provider.*OK" - python -m jupyterlab.browser_check --no-chrome-test