Skip to content

Commit

Permalink
ci: update docker and tests for latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
haxscramper committed Apr 24, 2024
1 parent 1624c68 commit 31052fc
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*
!pyproject.toml
!poetry.lock
!package.json
!package-lock.json
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion scripts/cxx_codegen/profdata_merger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 8 additions & 2 deletions scripts/py_repository/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)",
])
9 changes: 9 additions & 0 deletions tests/python/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 9 additions & 4 deletions tests/python/test_js_visualizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import _pytest.logging
import pytest
from py_scriptutils.rich_utils import render_debug
import pytest

CAT = "test-js"

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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="""
Expand All @@ -178,6 +180,7 @@ def test_indented_subtree():
assert titles[1]["subnodes"][0]["data"] == "<document>/Something", titles


@pytest.mark.x11
def test_collapsible_subtree():
svg_content = eval_visual_for(
content="""
Expand All @@ -204,6 +207,7 @@ def test_collapsible_subtree():
]


@pytest.mark.x11
def test_timeline_with_zoom():
svg_content = eval_visual_for(
content="""
Expand All @@ -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="""
Expand All @@ -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)


0 comments on commit 31052fc

Please sign in to comment.