From 31052fcc2d039ca15851516032390e1a026457d6 Mon Sep 17 00:00:00 2001 From: haxscramper Date: Wed, 24 Apr 2024 22:14:03 +0400 Subject: [PATCH] ci: update docker and tests for latest changes --- .dockerignore | 2 ++ pyproject.toml | 3 ++- scripts/cxx_codegen/profdata_merger/CMakeLists.txt | 2 +- scripts/py_repository/Dockerfile | 10 ++++++++-- tasks.py | 4 ++-- tests/python/test_cli.py | 9 +++++++++ tests/python/test_js_visualizations.py | 13 +++++++++---- 7 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.dockerignore b/.dockerignore index 98a672e6f..e3a2a6e2e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,5 @@ * !pyproject.toml !poetry.lock +!package.json +!package-lock.json diff --git a/pyproject.toml b/pyproject.toml index 2af37d150..e3743ecf2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,8 @@ testpaths = ["tests"] addopts = "--color=yes" console_output_style = "classic" markers = [ - "unstable: fuzzy tests that can randomly fail in CI" + "unstable: fuzzy tests that can randomly fail in CI", + "x11: must be run in x11 environment to work", ] [tool.ruff] diff --git a/scripts/cxx_codegen/profdata_merger/CMakeLists.txt b/scripts/cxx_codegen/profdata_merger/CMakeLists.txt index 2e503ed91..100640a4e 100644 --- a/scripts/cxx_codegen/profdata_merger/CMakeLists.txt +++ b/scripts/cxx_codegen/profdata_merger/CMakeLists.txt @@ -18,5 +18,5 @@ target_link_libraries(profdata_merger tbb ) -target_include_directories(profdata_merger PUBLIC "${BASE}/src") +target_include_directories(profdata_merger PUBLIC "${BASE}/src" "${BASE}/thirdparty/abseil-cpp") set_target_properties(profdata_merger PROPERTIES CXX_STANDARD 20) diff --git a/scripts/py_repository/Dockerfile b/scripts/py_repository/Dockerfile index 40c700aab..8416e49ec 100644 --- a/scripts/py_repository/Dockerfile +++ b/scripts/py_repository/Dockerfile @@ -28,8 +28,14 @@ WORKDIR /haxorg RUN apt-get install -y qt6-base-dev qt6-declarative-dev qt6-quick3d-dev RUN apt-get install -y ninja-build pkg-config libkrb5-dev libssl-dev RUN apt-get install -y libgl1-mesa-dev libglu1-mesa-dev -RUN apt-get install -y libxkbcommon-dev libpcre2-dev libgraphviz-dev libboost-all-dev +RUN apt-get install -y libxkbcommon-dev libgraphviz-dev libboost-all-dev RUN apt-get install -y mold RUN apt-get install -y elfutils libdw-dev RUN apt-get install -y libncurses5-dev doxygen graphviz -# RUN apt-get install -y libpcre3 libpcre3-dev +RUN apt-get install -y libpcre3 libpcre3-dev libtbb-dev +# For JS visualization tests -- the main part of the code does not require JS. +RUN apt-get install -y nodejs npm + +COPY package.json . +COPY package-lock.json . +RUN npm install diff --git a/tasks.py b/tasks.py index 2fc8a83a2..ab242d336 100644 --- a/tasks.py +++ b/tasks.py @@ -219,7 +219,7 @@ def ui_notify(message: str, is_ok: bool = True): cmd.run( [message] if is_ok else ["--urgency=critical", "--expire-time=1000", message]) - except plumbum.CommandNotFound: + except Exception: if is_ok: log(CAT).info(message) @@ -1114,5 +1114,5 @@ def ci(ctx: Context, build: bool = True, test: bool = True, docs: bool = True): run_command(ctx, "invoke", [ "py-tests", "--arg=-m", - "--arg=not unstable", + "--arg=not (unstable or x11)", ]) diff --git a/tests/python/test_cli.py b/tests/python/test_cli.py index 833578bb3..f1f9b0e66 100644 --- a/tests/python/test_cli.py +++ b/tests/python/test_cli.py @@ -5,6 +5,8 @@ from py_scriptutils.repo_files import get_haxorg_repo_root_path from py_scriptutils.click_utils import click_run_test from plumbum import local +import pytest +from plumbum import CommandNotFound def test_help(): @@ -57,7 +59,14 @@ def test_sqlite_export(): f"--outfile={out_file}", ]) +def has_pandoc() -> bool: + try: + local["pandoc"] + return True + except CommandNotFound: + return False +@pytest.mark.skipif(not has_pandoc(), reason="`pandoc` binary is not installed, skipping tests") def test_pandoc_export(): with TemporaryDirectory() as tmp_dir: dir = Path(tmp_dir) diff --git a/tests/python/test_js_visualizations.py b/tests/python/test_js_visualizations.py index c06dcaee8..3c1db971f 100644 --- a/tests/python/test_js_visualizations.py +++ b/tests/python/test_js_visualizations.py @@ -18,6 +18,7 @@ import _pytest.logging import pytest from py_scriptutils.rich_utils import render_debug +import pytest CAT = "test-js" @@ -116,7 +117,7 @@ def eval_js_visual(module_path: str, output_path: Path) -> None: def eval_visual_for(content: str, js_module: str, test_tmp_dir: Optional[Path] = None) -> Node: - + if test_tmp_dir and not test_tmp_dir.exists(): test_tmp_dir.mkdir(parents=True) @@ -161,6 +162,7 @@ def dom_to_json(node: Node) -> Dict: return node_dict +@pytest.mark.x11 def test_indented_subtree(): svg_content = eval_visual_for( content=""" @@ -178,6 +180,7 @@ def test_indented_subtree(): assert titles[1]["subnodes"][0]["data"] == "/Something", titles +@pytest.mark.x11 def test_collapsible_subtree(): svg_content = eval_visual_for( content=""" @@ -204,6 +207,7 @@ def test_collapsible_subtree(): ] +@pytest.mark.x11 def test_timeline_with_zoom(): svg_content = eval_visual_for( content=""" @@ -223,6 +227,7 @@ def test_timeline_with_zoom(): assert events[1]["subnodes"] == [{"kind": "Text", "data": "Event2"}], dbg(events) +@pytest.mark.x11 def test_standalone_tree_arcs(): svg_content = eval_visual_for( content=""" @@ -235,12 +240,12 @@ def test_standalone_tree_arcs(): js_module="mind_map/standalone_mind_map_arcs_test.html", ) - events = [dom_to_json(it)["subnodes"] for it in svg_content.getElementsByTagName("text")][1:] + events = [ + dom_to_json(it)["subnodes"] for it in svg_content.getElementsByTagName("text") + ][1:] assert events[0] == [{"kind": "Text", "data": "Top11"}], dbg(events) assert events[1] == [{"kind": "Text", "data": "Top12"}], dbg(events) assert events[2] == [{"kind": "Text", "data": "Top21"}], dbg(events) assert events[3] == [{"kind": "Text", "data": "Top22"}], dbg(events) assert events[4] == [{"kind": "Text", "data": "Top23"}], dbg(events) - -