Skip to content

Commit

Permalink
add canary tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bollwyvl committed Jan 13, 2024
1 parent 0e1adff commit 55c618a
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 36 deletions.
36 changes: 36 additions & 0 deletions .github/environment-test-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: jupyterlab-deck-test-canary

channels:
- conda-forge/label/jupyterlab_beta
- conda-forge/label/notebook_alpha
- conda-forge
- nodefaults

dependencies:
# a more precise python pin is added in CI
- jupyterlab >=4.1.0b0
- notebook >=7.1.0a2
### environment-base.yml ###
- doit-with-toml
- ipywidgets >=7
- jupyterlab >=3.5,<5.0.0a0
- jupyterlab-fonts >=3.0.0
- notebook >=6.5,<8.0.0a0
- pip
- python >=3.8,<3.13
- python-dotenv
### environment-base.yml ###
### environment-test.yml ###
# test
- pytest-cov
- pytest-html
### environment-test.yml ###
### environment-robot.yml ###
- robotframework >=6.1
- robotframework-pabot
# browser
- firefox 115.*
- geckodriver
- robotframework-jupyterlibrary >=0.5.0
- lxml
### environment-robot.yml ###
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,15 @@ jobs:
- name: dev (legacy)
run: doit legacy:pip

- name: test legacy
- name: test (legacy)
run: doit legacy:robot

- name: dev (canary)
run: doit canary:pip

- name: test (canary)
run: doit canary:robot

- name: report
run: doit report

Expand Down
114 changes: 79 additions & 35 deletions dodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class P:
DEMO_ENV_YAML = BINDER / "environment.yml"
TEST_ENV_YAML = CI / "environment-test.yml"
TEST_35_ENV_YAML = CI / "environment-test-lab35.yml"
TEST_CANARY_ENV_YAML = CI / "environment-test-canary.yml"
DOCS_ENV_YAML = CI / "environment-docs.yml"
BASE_ENV_YAML = CI / "environment-base.yml"
BUILD_ENV_YAML = CI / "environment-build.yml"
Expand All @@ -73,6 +74,7 @@ class P:
DOCS_ENV_YAML: [BUILD_ENV_YAML, BASE_ENV_YAML],
TEST_ENV_YAML: [BASE_ENV_YAML, BUILD_ENV_YAML, ROBOT_ENV_YAML],
TEST_35_ENV_YAML: [BASE_ENV_YAML, TEST_ENV_YAML, ROBOT_ENV_YAML],
TEST_CANARY_ENV_YAML: [BASE_ENV_YAML, TEST_ENV_YAML, ROBOT_ENV_YAML],
LINT_ENV_YAML: [BASE_ENV_YAML, BUILD_ENV_YAML, ROBOT_ENV_YAML],
}
YARNRC = ROOT / ".yarnrc.yml"
Expand Down Expand Up @@ -137,6 +139,8 @@ class B:
HISTORY = [ENV / C.HISTORY] if E.LOCAL else []
ENV_LEGACY = BUILD / ".venv-legacy"
HISTORY_LEGACY = ENV_LEGACY / C.HISTORY
ENV_CANARY = BUILD / ".venv-canary"
HISTORY_CANARY = ENV_CANARY / C.HISTORY
NODE_MODULES = P.ROOT / "node_modules"
YARN_INTEGRITY = NODE_MODULES / ".yarn-state.yml"
JS_META_TSBUILDINFO = P.JS_META / ".src.tsbuildinfo"
Expand All @@ -156,20 +160,25 @@ class B:
ENV_PKG_JSON = ENV / f"share/jupyter/labextensions/{C.NPM_NAME}/{C.PACKAGE_JSON}"
PIP_FROZEN = BUILD / "pip-freeze.txt"
PIP_FROZEN_LEGACY = BUILD / "pip-freeze-legacy.txt"
PIP_FROZEN_CANARY = BUILD / "pip-freeze-canary.txt"
REPORTS = BUILD / "reports"
ROBOCOV = BUILD / "__robocov__"
REPORTS_NYC = REPORTS / "nyc"
REPORTS_NYC_LCOV = REPORTS_NYC / "lcov.info"
REPORTS_COV_XML = REPORTS / "coverage-xml"
PYTEST_HTML = REPORTS / "pytest.html"
PYTEST_HTML_LEGACY = REPORTS / "pytest-legacy.html"
PYTEST_HTML_CANARY = REPORTS / "pytest-canary.html"
PYTEST_COV_XML = REPORTS_COV_XML / "pytest.coverage.xml"
PYTEST_COV_XML_LEGACY = REPORTS_COV_XML / "pytest-legacy.coverage.xml"
PYTEST_COV_XML_CANARY = REPORTS_COV_XML / "pytest-canary.coverage.xml"
HTMLCOV_HTML = REPORTS / "htmlcov/index.html"
HTMLCOV_HTML_LEGACY = REPORTS / "htmlcov-legacy/index.html"
HTMLCOV_HTML_CANARY = REPORTS / "htmlcov-canary/index.html"
ROBOT = REPORTS / "robot"
ROBOT_LATEST = ROBOT / "latest"
ROBOT_LEGACY = ROBOT / "legacy"
ROBOT_CANARY = ROBOT / "canary"
ROBOT_LOG_HTML = ROBOT_LATEST / "log.html"
PAGES_LITE = BUILD / "pages-lite"
PAGES_LITE_SHASUMS = PAGES_LITE / "SHA256SUMS"
Expand Down Expand Up @@ -581,6 +590,56 @@ def merge_spell_dictonaries(
dest.write_text("\n".join(sorted(set(lines))).strip(), encoding="utf-8")
return True

@staticmethod
def make_epoch_tasks(
env_yml: Path,
prefix: Path,
frozen: Path,
history: Path,
pytest_html: Path,
cov_html: Path,
cov_xml: Path,
robot_out: Path,
):
yield {
"name": "conda",
"file_dep": [env_yml],
"targets": [history],
"actions": [
[
"mamba",
"env",
"update",
"--prefix",
prefix,
"--file",
env_yml,
],
],
}

pip = [*C.CONDA_RUN, prefix, "python", "-m", "pip"]

yield {
"name": "pip",
"file_dep": [history, B.WHEEL],
"targets": [frozen],
"actions": [
[*pip, "install", "--no-deps", "--ignore-installed", B.WHEEL],
[*pip, "check"],
(U.pip_list, [frozen, pip]),
],
}

yield from U.make_pytest_tasks(
file_dep=[frozen],
pytest_html=pytest_html,
htmlcov=cov_html,
pytest_cov_xml=cov_xml,
)

yield from U.make_robot_tasks(lab_env=prefix, out_root=robot_out)

@staticmethod
def check_one_spell(dictionary: Path, html: Path, findings: Path):
proc = subprocess.Popen(
Expand Down Expand Up @@ -717,44 +776,29 @@ def task_setup():


def task_legacy():
yield {
"name": "conda",
"file_dep": [P.TEST_35_ENV_YAML],
"targets": [B.HISTORY_LEGACY],
"actions": [
[
"mamba",
"env",
"update",
"--prefix",
B.ENV_LEGACY,
"--file",
P.TEST_35_ENV_YAML,
],
],
}

legacy_pip = [*C.CONDA_RUN, B.ENV_LEGACY, "python", "-m", "pip"]

yield {
"name": "pip",
"file_dep": [B.HISTORY_LEGACY, B.WHEEL],
"targets": [B.PIP_FROZEN_LEGACY],
"actions": [
[*legacy_pip, "install", "--no-deps", "--ignore-installed", B.WHEEL],
[*legacy_pip, "check"],
(U.pip_list, [B.PIP_FROZEN_LEGACY, legacy_pip]),
],
}

yield from U.make_pytest_tasks(
file_dep=[B.PIP_FROZEN_LEGACY],
yield from U.make_epoch_tasks(
env_yml=P.TEST_35_ENV_YAML,
prefix=B.ENV_LEGACY,
frozen=B.PIP_FROZEN_LEGACY,
history=B.HISTORY_LEGACY,
pytest_html=B.PYTEST_HTML_LEGACY,
htmlcov=B.HTMLCOV_HTML_LEGACY,
pytest_cov_xml=B.PYTEST_COV_XML_LEGACY,
cov_html=B.HTMLCOV_HTML_LEGACY,
cov_xml=B.PYTEST_COV_XML_LEGACY,
robot_out=B.ROBOT_LEGACY,
)

yield from U.make_robot_tasks(lab_env=B.ENV_LEGACY, out_root=B.ROBOT_LEGACY)

def task_canary():
yield from U.make_epoch_tasks(
env_yml=P.TEST_CANARY_ENV_YAML,
prefix=B.ENV_CANARY,
frozen=B.PIP_FROZEN_CANARY,
history=B.HISTORY_CANARY,
pytest_html=B.PYTEST_HTML_CANARY,
cov_html=B.HTMLCOV_HTML_CANARY,
cov_xml=B.PYTEST_COV_XML_CANARY,
robot_out=B.ROBOT_CANARY,
)


def task_watch():
Expand Down

0 comments on commit 55c618a

Please sign in to comment.