Tests #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
schedule: | |
- cron: "0 8 * * *" | |
jobs: | |
# Run "pre-commit run --all-files --hook-stage=manual" | |
pre-commit: | |
name: Run pre-commit hook | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Base Setup | |
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- name: Install dependencies | |
run: | | |
pip install "jupyterlab>=4.0.0,<5" | |
pip install -e . | |
jlpm | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
with: | |
extra_args: --all-files --hook-stage=manual | |
- name: Help message if pre-commit fail | |
if: ${{ failure() }} | |
run: | | |
echo "You can install pre-commit hooks to automatically run formatting" | |
echo "on each commit with:" | |
echo " pre-commit install" | |
echo "or you can run by hand on staged files with" | |
echo " pre-commit run" | |
echo "or after-the-fact on already committed files with" | |
echo " pre-commit run --all-files --hook-stage=manual" | |
- name: Lint frontend | |
run: | | |
jlpm run lint:check | |
test-js: | |
name: Test JavaScript | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Base Setup | |
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- name: Install dependencies | |
run: | | |
pip install "jupyterlab>=4.0.0,<5" | |
pip install -e . | |
jlpm | |
- name: Run Tests | |
run: | | |
set -eux | |
jlpm run test | |
test-py: | |
name: Test Python | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.8", "3.11", "3.12"] | |
# PyPy is not supported because we use the file_id_manager. See: | |
# https://github.com/jupyter-server/jupyter_server_fileid/issues/44 | |
#include: | |
# - os: ubuntu-latest | |
# python-version: "pypy-3.8" | |
exclude: | |
- os: windows-latest | |
python-version: "3.12" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Base Setup | |
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- name: Install the Python dependencies | |
run: | | |
python -m pip install "jupyterlab>=4.0.0,<5" | |
pip install -e ".[test]" codecov | |
- name: List installed packages | |
run: | | |
pip freeze | |
pip check | |
- name: Run the tests with Coverage | |
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(runner.os, 'Windows') }} | |
run: | | |
python -m pytest -vv --cov jupyter_collaboration --cov-branch --cov-report term-missing:skip-covered | |
#- name: Run the tests on pypy | |
# if: ${{ startsWith(matrix.python-version, 'pypy') }} | |
# run: | | |
# PyPy is not supported because we use the file_id_manager. See: | |
# https://github.com/jupyter-server/jupyter_server_fileid/issues/44 | |
# python -W ignore::ImportWarning -m pytest -vv | |
- name: Run the tests on Windows | |
if: ${{ startsWith(runner.os, 'Windows') }} | |
run: | | |
python -W ignore::ImportWarning -m pytest -vv --cov jupyter_collaboration --cov-branch --cov-report term-missing:skip-covered | |
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1 | |
- name: Build the extension | |
if: ${{ !startsWith(matrix.python-version, 'pypy') }} | |
shell: bash | |
run: | | |
set -eux | |
jupyter server extension list | |
jupyter server extension list 2>&1 | grep -ie "jupyter_collaboration.*OK" | |
jupyter labextension list | |
jupyter labextension list 2>&1 | grep -ie "@jupyter/collaboration-extension.*OK" | |
python -m jupyterlab.browser_check | |
test_minimum_versions: | |
name: Test Minimum Versions | |
needs: [pre-commit, test-js, test-py] | |
timeout-minutes: 20 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Base Setup | |
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
with: | |
python_version: "3.11" | |
- name: Install minimum versions | |
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1 | |
- name: Run the unit tests | |
run: | | |
pytest -vv -W default || pytest -vv -W default --lf | |
test_prereleases: | |
name: Test Prereleases | |
needs: [pre-commit, test-js, test-py] | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Base Setup | |
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- name: Install the Python dependencies | |
run: | | |
pip install -e ".[test]" | |
- name: List installed packages | |
run: | | |
pip freeze | |
pip check | |
- name: Run the tests | |
run: | | |
pytest -vv -W default || pytest -vv --lf | |
make_sdist: | |
name: Make SDist | |
needs: [pre-commit, test-js, test-py] | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- uses: jupyterlab/maintainer-tools/.github/actions/make-sdist@v1 | |
test_sdist: | |
runs-on: ubuntu-latest | |
needs: [make_sdist] | |
name: Install from SDist and Test | |
timeout-minutes: 15 | |
steps: | |
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- name: Download sdist | |
uses: actions/download-artifact@v3 | |
- name: Install From SDist | |
shell: bash | |
run: | | |
echo "::group::Install from SDist" | |
set -ex | |
cd sdist | |
mkdir test | |
tar --strip-components=1 -zxvf *.tar.gz -C ./test | |
cd test | |
python -m pip install "jupyterlab>=4.0.0,<5" | |
python -m pip install ".[test]" | |
echo "::endgroup::" | |
- name: Run Test | |
shell: bash | |
run: | | |
echo "::group::Run test" | |
set -ex | |
cd sdist/test | |
python -m pytest -vv -raXxs --durations 10 --color=yes | |
jupyter server extension list | |
jupyter server extension list 2>&1 | grep -ie "jupyter_collaboration.*OK" | |
jupyter labextension list | |
jupyter labextension list 2>&1 | grep -ie "@jupyter/collaboration-extension.*OK" | |
python -m jupyterlab.browser_check --no-browser-test | |
echo "::endgroup::" | |
check_links: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1 | |
with: | |
ignore_links: "../api/*.* ./api/* .*/images/[\\w-]+.png https://docs.github.com/en/.* https://mybinder.org/v2/gh/jupyterlab/jupyter_collaboration/.*" | |
ui_tests: | |
runs-on: ubuntu-latest | |
needs: [pre-commit, test-js] | |
timeout-minutes: 30 | |
env: | |
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | |
- name: Install dependencies | |
run: | | |
pip install jupyterlab . | |
- name: Install playwright | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
run: | | |
jlpm install | |
working-directory: ui-tests | |
- 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: run tests | |
working-directory: ui-tests | |
run: | | |
jlpm test | |
- name: Upload Playwright Test report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jupyter-collaboration-playwright-report | |
path: | | |
ui-tests/test-results | |
ui-tests/playwright-report |