Skip to content

Commit

Permalink
ci: update reflection defs autogen file
Browse files Browse the repository at this point in the history
  • Loading branch information
haxscramper committed Apr 24, 2024
1 parent 31052fc commit fc7051c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
1 change: 1 addition & 0 deletions invoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ tasks:
force_task: [
# "cmake_configure_haxorg",
# "cmake_haxorg",
"python_protobuf_files",
]

2 changes: 1 addition & 1 deletion scripts/py_codegen/py_codegen/refl_read.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from copy import copy

import py_codegen.proto_lib.reflection_defs as pb
import py_codegen.proto_lib.reflection_tool.reflection_defs as pb
import re

from beartype import beartype
Expand Down
39 changes: 30 additions & 9 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ def is_forced(ctx: Context, name: str) -> bool:
return name in get_config(ctx).force_task


@beartype
def is_ci() -> bool:
return bool(os.getenv("INVOKE_CI"))


@beartype
def cmake_opt(name: str, value: Union[str, bool]) -> str:
result = "-D" + name + "="
Expand Down Expand Up @@ -521,8 +526,10 @@ def python_protobuf_files(ctx: Context):
[proto_config],
stamp_path=get_task_stamp("python-protobuf-files"),
) as op:
if op.should_run():
log(CAT).info(f"Running protc {op.explain('python protobuf')}")
explain = op.explain("python protobuf")
forced = is_forced(ctx, "python_protobuf_files")
if forced or op.should_run():
log(CAT).info(f"Running protc {explain}")
_, stdout, _ = run_command(ctx,
"poetry", ["env", "info", "--path"],
capture=True)
Expand All @@ -548,11 +555,13 @@ def python_protobuf_files(ctx: Context):
"-I",
get_script_root("scripts/cxx_codegen"),
"--proto_path=" +
str(get_script_root("scripts/py_codegen/py_codegen")),
str(get_script_root("scripts/py_codegen/py_codegen/reflection_tool")),
"--python_betterproto_out=" + str(proto_lib),
proto_config,
],
)
else:
log(CAT).info("Skipping protoc run " + explain)


@org_task(pre=[base_environment])
Expand Down Expand Up @@ -1107,12 +1116,24 @@ def docs_custom(ctx: Context):
@org_task()
def ci(ctx: Context, build: bool = True, test: bool = True, docs: bool = True):
"Execute all CI tasks"
env = {"INVOKE_CI": "ON"}
if build:
run_command(ctx, "invoke", ["cmake-all"])
run_command(
ctx,
"invoke",
["cmake-all"],
env=env,
)

if test:
run_command(ctx, "invoke", [
"py-tests",
"--arg=-m",
"--arg=not (unstable or x11)",
])
python_protobuf_files(ctx)
run_command(
ctx,
"invoke",
[
"py-tests",
"--arg=-m",
"--arg=not (unstable or x11)",
],
env=env,
)

0 comments on commit fc7051c

Please sign in to comment.