Skip to content

[pre-commit.ci] pre-commit autoupdate #820

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #820

Workflow file for this run

# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
name: Test
on:
pull_request:
paths-ignore:
- "docs/**"
- "contrib/**"
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/test.yaml"
push:
paths-ignore:
- "docs/**"
- "contrib/**"
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/test.yaml"
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
schedule:
# Run at 05:00 on monday and thursday, ref: https://crontab.guru/#0_5_*_*_1,4
- cron: "0 5 * * 1,4"
workflow_dispatch:
env:
# avoid warnings about config paths
JUPYTER_PLATFORM_DIRS: "1"
# avoid looking at every version of pip ever released
PIP_DISABLE_PIP_VERSION_CHECK: "1"
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/setup-node@v4
with:
cache: yarn
node-version: "lts/*"
registry-url: https://registry.npmjs.org
cache-dependency-path: labextension/yarn.lock
- name: Update root build packages
run: pip install --upgrade build
- name: Build Python package
run: pyproject-build
- name: Upload built artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ github.run_attempt }}
path: ./dist
test:
name: ${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.pip-extras }} ${{ (matrix.pip-install-constraints != '' && '(oldest deps)') || '' }}
needs: [build]
timeout-minutes: 30
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0} # windows default isn't bash
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
python-version: ["3.8", "3.12"]
pip-extras: [lab, classic]
pip-install-constraints: [""]
exclude:
# windows should work for all test variations, but a limited selection
# is run to avoid doubling the amount of test runs
- os: windows-2022
python-version: "3.12"
pip-extras: classic
- os: windows-2022
python-version: "3.8"
pip-extras: lab
# pip-extras classic (notebook v6) isn't working with python 3.12 or
# later, so we exclude it here and then include it below to run with
# python 3.11 instead.
- os: ubuntu-22.04
python-version: "3.12"
pip-extras: classic
include:
# Compensates for an excluded test case above
- os: ubuntu-22.04
python-version: "3.11"
pip-extras: classic
# this test is manually updated to reflect the lower bounds of
# versions from dependencies
- os: ubuntu-22.04
python-version: "3.8"
pip-extras: classic
pip-install-constraints: >-
jupyter-server==1.24.0
simpervisor==1.0.0
tornado==6.1.0
traitlets==5.1.0
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
- name: Update root build packages
run: python -m pip install --upgrade pip
- name: Download built artifacts
uses: actions/download-artifact@v4
with:
name: dist-${{ github.run_attempt }}
path: ./dist
- name: Install Python package
# NOTE: See CONTRIBUTING.md for a local development setup that differs
# slightly from this.
#
# Pytest options are set in `pyproject.toml`.
run: |
pip install -vv $(ls ./dist/*.whl)\[acceptance,${{ matrix.pip-extras }}\] ${{ matrix.pip-install-constraints }}
- name: List Python packages
run: |
pip freeze
pip check
- name: Check server extension for jupyter_server
run: |
jupyter server extension list
jupyter server extension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -
- name: Check server extension for notebook v6
if: contains(matrix.pip-extras, 'classic')
run: |
jupyter serverextension list
jupyter serverextension list 2>&1 | grep -iE "jupyter_server_proxy.*OK" -
- name: Check frontend extension for notebook v6
if: contains(matrix.pip-extras, 'classic')
run: |
jupyter nbextension list
PYTHONUNBUFFERED=1 jupyter nbextension list 2>&1 | grep -A1 -iE '.*jupyter_server_proxy.*enabled' | grep -B1 -iE "Validating.*OK"
- name: Check frontend extension for notebook v7+
if: ${{ !contains(matrix.pip-extras, 'classic') }}
run: |
jupyter notebook extension list
jupyter notebook extension list 2>&1 | grep -iE 'jupyter_server_proxy.*OK.*'
- name: Check frontend extension for jupyterlab
run: |
jupyter lab extension list
jupyter lab extension list 2>&1 | grep -iE 'jupyter_server_proxy.*OK.*'
# we have installed a pre-built wheel and configured code coverage to
# inspect "jupyter_server_proxy", by re-locating to another directory,
# there is no confusion about "jupyter_server_proxy" referring to our
# installed package rather than the local directory
- name: Run tests
run: |
mkdir build
cd build
pytest -c ../pyproject.toml ../tests
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: |-
tests-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.pip-extras }}-${{ (matrix.pip-install-constraints != '' && 'oldest-') || '' }}${{ github.run_attempt }}
path: |
./build/pytest
./build/coverage
./build/robot
# GitHub action reference: https://github.com/codecov/codecov-action
- uses: codecov/codecov-action@v4