Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI test matrix #521

Merged
merged 10 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/actions/build-dist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ runs:
steps:
- uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Setup pip (base)
shell: bash
Expand All @@ -27,7 +27,7 @@ runs:
- name: Install node
uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16.x

- name: Cache (node_modules)
uses: actions/cache@v2
Expand All @@ -48,6 +48,16 @@ runs:
restore-keys: |
${{ env.CACHE_EPOCH }}-yarn-packages-

- name: Cache (wepback)
uses: actions/cache@v2
with:
path: build/webpack
key: |
${{ env.CACHE_EPOCH }}-webpack-${{ hashFiles('yarn.lock') }}-${{ hashFiles('app/webpack.config.js') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-webpack-${{ hashFiles('yarn.lock') }}-
${{ env.CACHE_EPOCH }}-webpack-

- name: Install
shell: bash
if: steps.cache-node-modules.outputs.cache-hit != 'true'
Expand Down
39 changes: 28 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Setup pip (base)
run: python3 -m pip install --user -U pip setuptools wheel
- name: Cache (pip)
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: '16.x'
- name: Cache (node_modules)
uses: actions/cache@v2
id: cache-node-modules
Expand Down Expand Up @@ -93,26 +93,43 @@ jobs:
runs-on: ${{ matrix.os }}-latest
env:
TESTING_IN_CI: 1
PYTEST_ARGS: ${{ matrix.pytest-args }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
python-version: [3.7, 3.9, pypy-3.7]
python-version: ['3.7', '3.10', 'pypy-3.7']
include:
# OS-specifics for running pip
- os: ubuntu
pip-cache: ~/.cache/pip
python-command: python3
- os: macos
pip-cache: ~/Library/Caches/pip
python-command: python3
- os: windows
pip-cache: ~\AppData\Local\pip\Cache
python-command: python
# python-specifics for tests
- python-version: '3.7'
pytest-args: '[]'
- python-version: '3.10'
pytest-args: '[]'
- python-version: 'pypy-3.7'
# TODO: some instability with libarchive, might be better with pypy-3.8
# after https://github.com/cloudpipe/cloudpickle/pull/461
pytest-args: '["-k", "not _archive_is_"]'
exclude:
- os: windows
python-version: pypy-3.7
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup pip (base)
run: python3 -m pip install --user -U pip setuptools wheel
run: ${{ matrix.python-command }} -m pip install --user -U pip setuptools wheel
- name: Download (dist)
uses: actions/download-artifact@v2
with:
Expand All @@ -130,9 +147,9 @@ jobs:
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-
- name: Install (py)
run: |
python3 -m pip install entrypoints doit jupyter_core
python3 -m pip install --find-links dist --no-index jupyterlite
python3 -m pip check
${{ matrix.python-command }} -m pip install entrypoints doit jupyter_core
${{ matrix.python-command }} -m pip install --find-links dist --no-index jupyterlite
${{ matrix.python-command }} -m pip check
- name: Prepare smoke test folder
shell: bash
run: mkdir -p build/smoke-test
Expand All @@ -153,7 +170,7 @@ jobs:
jupyter lite list || exit 1
jupyter lite status --debug || exit 1
- name: Setup pip (test)
run: python3 -m pip install -r requirements-test.txt
run: ${{ matrix.python-command }} -m pip install -r requirements-test.txt
- name: Test (py)
run: doit test:py:*
- name: Upload (reports)
Expand All @@ -167,7 +184,7 @@ jobs:
build/pytest

docs:
needs: [build, lint-js-test]
needs: [build]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like typedoc is built and uploaded in the lint job:

- name: Docs (typedoc)
run: doit -n4 docs:typedoc:mystify
- name: Upload (typedoc)
uses: actions/upload-artifact@v2
with:
name: jupyterlite typedoc ${{ github.run_number }}
path: ./docs/api/ts

Which makes the docs check flaky as these artifacts might not be available when the docs job runs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, good catch.

runs-on: ubuntu-latest
env:
DOCS_IN_CI: 1
Expand All @@ -187,11 +204,11 @@ jobs:
path: ./docs/api/ts
- uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.9'
- name: Install node
uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: '16.x'
- name: Cache (node_modules)
uses: actions/cache@v2
id: cache-node-modules
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.9'
architecture: 'x64'

- name: Install node
uses: actions/setup-node@v2
with:
node-version: '14.x'
node-version: '16.x'

- name: Get pip cache dir
id: pip-cache
Expand Down
7 changes: 7 additions & 0 deletions app/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ module.exports = [
// to generate valid wheel names
assetModuleFilename: '[name][ext][query]',
},
cache: {
type: 'filesystem',
cacheDirectory: path.resolve(__dirname, '../build/webpack'),
buildDependencies: {
config: [__filename],
},
},
module: {
rules: [
{
Expand Down
50 changes: 25 additions & 25 deletions dodo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
import platform
import re
import shutil
import subprocess
Expand Down Expand Up @@ -716,10 +717,8 @@ def task_test():
"--script-launch-mode=subprocess",
f"-n={C.PYTEST_PROCS}",
"-vv",
f"--cov-fail-under={C.COV_THRESHOLD}",
"--cov-report=term-missing:skip-covered",
"--no-cov-on-fail",
"--durations=5",
*(C.PYTEST_ARGS or []),
]

for py_name, setup_py in P.PY_SETUP_PY.items():
Expand All @@ -728,16 +727,29 @@ def task_test():
continue

py_mod = py_name.replace("-", "_")
cov_path = B.BUILD / f"htmlcov/{py_name}"
cov_index = cov_path / "index.html"
html_index = B.BUILD / f"pytest/{py_name}/index.html"
pkg_targets = [html_index]
pkg_args = [
f"--html={html_index}",
"--self-contained-html",
]
cwd = setup_py.parent

if C.CI:
cwd = B.DIST
pkg_args = ["--pyargs", py_mod]
else:
cwd = setup_py.parent
pkg_args = []
pkg_args += ["--pyargs", py_mod]

if not C.PYPY:
# coverage is very slow/finicky on pypy
cov_path = B.BUILD / f"htmlcov/{py_name}"
pkg_args += [
"--cov-report=term-missing:skip-covered",
"--no-cov-on-fail",
f"--cov-fail-under={C.COV_THRESHOLD}",
f"--cov-report=html:{cov_path}",
f"--cov={py_mod}",
]
pkg_targets += [cov_path / "index.html"]

yield U.ok(
B.OK_LITE_PYTEST,
Expand All @@ -748,22 +760,8 @@ def task_test():
*setup_py.parent.rglob("*.py"),
setup_py.parent / "pyproject.toml",
],
targets=[cov_index, html_index],
actions=[
U.do(
*pytest_args,
*(C.PYTEST_ARGS or []),
"--cov",
py_mod,
"--cov-report",
f"html:{cov_path}",
f"--html={html_index}",
"--self-contained-html",
*pkg_args,
env=env,
cwd=cwd,
)
],
targets=pkg_targets,
actions=[U.do(*pytest_args, *pkg_args, env=env, cwd=cwd)],
)


Expand All @@ -783,6 +781,8 @@ class C:
ENC = dict(encoding="utf-8")
JSON = dict(indent=2, sort_keys=True)
CI = bool(json.loads(os.environ.get("CI", "0")))
PY_IMPL = platform.python_implementation()
PYPY = "pypy" in PY_IMPL.lower()
RTD = bool(json.loads(os.environ.get("READTHEDOCS", "False").lower()))
IN_CONDA = bool(os.environ.get("CONDA_PREFIX"))
IN_SPHINX = json.loads(os.environ.get("IN_SPHINX", "0"))
Expand Down
6 changes: 4 additions & 2 deletions py/jupyterlite/src/jupyterlite/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
"""integration tests for overall CLI functionality"""
import sys
import platform
import time

from pytest import mark

from jupyterlite import __version__
from jupyterlite.constants import HOOKS

IS_PYPY = "__pypy__" in sys.builtin_module_names
PY_IMPL = platform.python_implementation()
IS_PYPY = "pypy" in PY_IMPL.lower()


# TODO: others?
LITE_INVOCATIONS = [
Expand Down