diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml new file mode 100644 index 0000000000..a4166ccad3 --- /dev/null +++ b/.github/workflows/packaging.yml @@ -0,0 +1,149 @@ +name: Packaging + +on: + push: + branches: [ master ] + pull_request: + branches: '*' + +env: + PIP_DISABLE_PIP_VERSION_CHECK: 1 + +defaults: + run: + shell: bash -l {0} + +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.9' + architecture: 'x64' + + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - 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: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel + python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4" + - name: Build PyPI distributions for ipywidgets + run: | + python setup.py sdist bdist_wheel + - name: Build PyPI distributions for jupyterlab_widgets + run: | + jlpm + jlpm run build + cd jupyterlab_widgets + python setup.py sdist bdist_wheel + cp ./dist/* ../dist + - name: Build PyPI distributions for widgetsnbextension + run: | + jlpm + jlpm run build + cd widgetsnbextension + python setup.py sdist bdist_wheel + cp ./dist/* ../dist + - name: Build checksum file + run: | + cd dist + sha256sum * | tee SHA256SUMS + - name: Upload distributions + uses: actions/upload-artifact@v2 + with: + name: dist ${{ github.run_number }} + path: ./dist + + install: + runs-on: ${{ matrix.os }}-latest + needs: [build] + strategy: + fail-fast: false + matrix: + os: [ubuntu, windows] + python: ['3.6', '3.9'] + dist: ['ipywidgets*.tar.gz'] + include: + - python: '3.9' + dist: 'jupyterlab_widgets*.tar.gz' + os: 'ubuntu' + - python: '3.9' + dist: 'widgetsnbextension*.tar.gz' + os: 'ubuntu' + - python: '3.9' + dist: 'ipywidgets*.whl' + os: 'ubuntu' + steps: + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + architecture: 'x64' + - name: Checkout # For the cache keys + uses: actions/checkout@v2 + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + - name: pip cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install the prerequisites + run: | + python -m pip install pip wheel + - uses: actions/download-artifact@v2 + with: + name: dist ${{ github.run_number }} + path: ./dist + - name: Install the package + run: | + cd dist + python -m pip install -vv ${{ matrix.dist }} + - name: Validate environment + run: | + python -m pip freeze + python -m pip check + - name: Check the JupyterLab extension is installed + if: matrix.dist != 'widgetsnbextension*.tar.gz' + run: | + python -m pip install jupyterlab~=3.0 + + jupyter labextension list + jupyter labextension list 2>&1 | grep -ie "@jupyter-widgets/jupyterlab-manager.*enabled.*ok" - + - name: Check the Classic Notebook extension is installed + if: matrix.dist != 'jupyterlab_widgets*.tar.gz' + run: | + python -m pip install notebook~=6.0 + + jupyter nbextension list + jupyter nbextension list 2>&1 | grep -ie "jupyter-js-widgets/extension.*enabled" -