Skip to content

jupyterlab cut button label depends on version #1022

jupyterlab cut button label depends on version

jupyterlab cut button label depends on version #1022

Workflow file for this run

# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions
name: Build
on:
push:
pull_request:
jobs:
# https://github.com/pre-commit/action
pre-commit:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
# Due to complications in the build process when trying to support both JupyterLab
# 2 and 3 we build the pypi packages with JupyterLab 3, but test on 2 and 3
build:
name: Build dist
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
cache: pip
cache-dependency-path: 'dev-requirements*'
- uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: yarn
- name: Install dependencies
run: python -mpip install -r dev-requirements-jl3.txt
- name: Build dist
run: |
python setup.py sdist bdist_wheel
ls dist/*tar.gz dist/*.whl
- name: Javascript format
run: |
jlpm install
jlpm run format:check
- name: Javascript package
run: |
mkdir jsdist
jlpm pack --filename jsdist/jupyter-offlinenotebook-jlpmpack.tgz
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: jsdist
path: jsdist
if-no-files-found: error
test:
name: Pytest
needs: build
strategy:
# Keep running so we can see if other tests pass
fail-fast: false
matrix:
include:
- python-version: '3.6'
jupyterlab-major: '2'
ubuntu: '20.04'
node: '16.x'
- python-version: '3.8'
jupyterlab-major: '3'
ubuntu: '22.04'
node: '18.x'
runs-on: ubuntu-${{ matrix.ubuntu }}
# Includes geckdriver and firefox
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: 'dev-requirements*'
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: yarn
- name: Download artifacts from build
uses: actions/download-artifact@v4
- name: Install dependencies
run: python -mpip install -r dev-requirements-jl${{ matrix.jupyterlab-major }}.*
- name: Install plugin
run: |
python -mpip install dist/*.whl
if [[ ${{ matrix.jupyterlab-major }} = 2 ]]; then
jupyter labextension install --debug --minimize=False ./jsdist/jupyter-offlinenotebook-jlpmpack.tgz
fi
- name: Run pytest
run: pytest -vs tests
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
publish-pypi:
if: startsWith(github.ref, 'refs/tags')
needs:
# Only publish if other jobs passed
- pre-commit
- test
runs-on: ubuntu-22.04
steps:
- uses: actions/setup-python@v5
- name: Download artifacts from build
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_PASSWORD }}
# https://docs.github.com/en/actions/language-and-framework-guides/publishing-nodejs-packages#publishing-packages-to-the-npm-registry
publish-npm:
needs:
# Only publish if other jobs passed
- pre-commit
- test
runs-on: ubuntu-22.04
steps:
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: yarn
registry-url: https://registry.npmjs.org
- name: Download artifacts from build
uses: actions/download-artifact@v4
with:
name: jsdist
path: jsdist
- run: npm publish --dry-run ./jsdist/jupyter-offlinenotebook-jlpmpack.tgz
- run: npm publish ./jsdist/jupyter-offlinenotebook-jlpmpack.tgz
if: startsWith(github.ref, 'refs/tags')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}