Skip to content

Commit

Permalink
Build all cpp binaries of test_wheels ci job in the wheel-test-min
Browse files Browse the repository at this point in the history
…environment (rerun-io#7009)

### What

Similar to rerun-io#6911
May fix Windows issues or at least make it easier to diagnose


### Checklist
* [x]  pass main ci

- [PR Build Summary](https://build.rerun.io/pr/7009)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
Wumpf authored Jul 29, 2024
1 parent a76daf7 commit 02367e5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 43 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/reusable_test_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,26 @@ jobs:
# Only check that we have the archetype roundtrip tests, but don't spend time actually running them
run: pixi run -e wheel-test-min RUST_LOG=debug python tests/roundtrips.py --no-run

- name: Build C++ roundtrips
if: ${{ !inputs.FAST }}
# Separated out of roundtrips.py run so we control the pixi environment.
# This used to cause issues on Windows during the setup of the pixi environment when running from inside `roundtrips.py`.
run: pixi run -e wheel-test-min cpp-build-roundtrips

- name: Run tests/roundtrips.py
if: ${{ !inputs.FAST }}
# --release so we can inherit from some of the artifacts that maturin has just built before
# explicit target because otherwise cargo loses the target cache… even though this is the target anyhow…
# --no-py-build because rerun-sdk is already built and installed
run: pixi run -e wheel-test-min RUST_LOG=debug python tests/roundtrips.py --release --target ${{ needs.set-config.outputs.TARGET }} --no-py-build
run: pixi run -e wheel-test-min RUST_LOG=debug python tests/roundtrips.py --target ${{ needs.set-config.outputs.TARGET }} --no-py-build --no-cpp-build

- name: Build C++ examples
- name: Build C++ snippets
if: ${{ !inputs.FAST }}
# Separated out of compare_snippet_output.py run so we control the pixi environment.
# This used to cause issues on Windows during the setup of the pixi environment when running from inside `compare_snippet_output.py`.
run: pixi run -e wheel-test-min cpp-build-snippets

- name: Run docs/snippets/compare_snippet_output.py
if: ${{ !inputs.FAST }}
# --release so we can inherit from some of the artifacts that maturin has just built before
# explicit target because otherwise cargo loses the target cache… even though this is the target anyhow…
# --no-py-build because rerun-sdk is already built and installed
run: pixi run -e wheel-test-min RUST_LOG=debug python docs/snippets/compare_snippet_output.py --release --target ${{ needs.set-config.outputs.TARGET }} --no-py-build --no-cpp-build
run: pixi run -e wheel-test-min RUST_LOG=debug python docs/snippets/compare_snippet_output.py --target ${{ needs.set-config.outputs.TARGET }} --no-py-build --no-cpp-build
6 changes: 1 addition & 5 deletions docs/snippets/compare_snippet_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ def main() -> None:
help="Skip cmake configure and ahead of time build for rerun_c & rerun_cpp",
)
parser.add_argument("--full-dump", action="store_true", help="Dump both rrd files as tables")
parser.add_argument(
"--release",
action="store_true",
help="Run cargo invocations with --release and CMake with `-DCMAKE_BUILD_TYPE=Release` & `--config Release`",
)
parser.add_argument("--release", action="store_true", help="Run cargo invocations with --release")
parser.add_argument("--target", type=str, default=None, help="Target used for cargo invocations")
parser.add_argument("--target-dir", type=str, default=None, help="Target directory used for cargo invocations")
parser.add_argument("example", nargs="*", type=str, default=None, help="Run only the specified examples")
Expand Down
46 changes: 13 additions & 33 deletions tests/roundtrips.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ def main() -> None:
help="Skip cmake configure and ahead of time build for rerun_c & rerun_cpp",
)
parser.add_argument("--full-dump", action="store_true", help="Dump both rrd files as tables")
parser.add_argument(
"--release",
action="store_true",
help="Run cargo invocations with --release and CMake with `-DCMAKE_BUILD_TYPE=Release` & `--config Release`",
)
parser.add_argument("--release", action="store_true", help="Run cargo invocations with --release")
parser.add_argument("--target", type=str, default=None, help="Target used for cargo invocations")
parser.add_argument("--target-dir", type=str, default=None, help="Target directory used for cargo invocations")
parser.add_argument("archetype", nargs="*", type=str, default=None, help="Run only the specified archetypes")
Expand Down Expand Up @@ -90,56 +86,44 @@ def main() -> None:
print("----------------------------------------------------------")
print("Building rerun-sdk for Python…")
start_time = time.time()
run(["pixi", "run", "py-build", "--quiet"], env=build_env)
run(["pixi", "run", "-e", "py", "py-build", "--quiet"], env=build_env)
elapsed = time.time() - start_time
print(f"rerun-sdk for Python built in {elapsed:.1f} seconds")
print("")

if args.no_cpp_build:
print("Skipping cmake configure & build for rerun_c & rerun_cpp - assuming it is already built and up-to-date!")
print("Skipping cmake configure & build - assuming all tests are already built and up-to-date!")
else:
print("----------------------------------------------------------")
print("Build rerun_c & rerun_cpp…")
print("Build roundtrips for C++…")
start_time = time.time()
cmake_configure(args.release, build_env)
cmake_build("rerun_sdk", args.release)
cmake_build("roundtrips", args.release)
elapsed = time.time() - start_time
print(f"rerun-sdk for C++ built in {elapsed:.1f} seconds")
print(f"C++ roundtrips built in {elapsed:.1f} seconds")
print("")

print("----------------------------------------------------------")
print(f"Building {len(archetypes)} archetypes…")

# Running CMake in parallel causes failures during rerun_sdk & arrow build.
# TODO(andreas): Tell cmake in a single command to build everything at once.
if not args.no_cpp_build:
start_time = time.time()
for arch in archetypes:
arch_opt_out = opt_out.get(arch, [])
if "cpp" in arch_opt_out:
continue
build(arch, "cpp", args)
elapsed = time.time() - start_time
print(f"C++ examples compiled and ran in {elapsed:.1f} seconds")

with multiprocessing.Pool() as pool:
start_time = time.time()
jobs = []
for arch in archetypes:
arch_opt_out = opt_out.get(arch, [])
for language in ["python", "rust"]:
for language in ["python", "rust", "cpp"]:
if language in arch_opt_out:
continue
job = pool.apply_async(build, (arch, language, args))
job = pool.apply_async(run_roundtrips, (arch, language, args))
jobs.append(job)
print(f"Waiting for {len(jobs)} build jobs to finish…")
for job in jobs:
job.get()
elapsed = time.time() - start_time
print(f"Python and Rust examples ran in {elapsed:.1f} seconds")
print(f"C++, Python and Rust examples ran in {elapsed:.1f} seconds")

print("----------------------------------------------------------")
print(f"Comparing recordings for{len(archetypes)} archetypes…")
print(f"Comparing recordings for {len(archetypes)} archetypes…")
start_time = time.time()

for arch in archetypes:
Expand Down Expand Up @@ -168,7 +152,7 @@ def main() -> None:
print("All tests passed!")


def build(arch: str, language: str, args: argparse.Namespace) -> None:
def run_roundtrips(arch: str, language: str, args: argparse.Namespace) -> None:
if language == "cpp":
run_roundtrip_cpp(arch, args.release)
elif language == "python":
Expand Down Expand Up @@ -221,12 +205,8 @@ def run_roundtrip_cpp(arch: str, release: bool) -> str:
target_name = f"roundtrip_{arch}"
output_path = f"tests/cpp/roundtrips/{arch}/out.rrd"

cmake_build(target_name, release)

config_dir = "Release" if release else "Debug"

target_path = f"{config_dir}/{target_name}.exe" if os.name == "nt" else target_name
cmd = [f"{cpp_build_dir}/tests/cpp/roundtrips/{target_path}", output_path]
extension = ".exe" if os.name == "nt" else ""
cmd = [f"./build/debug/tests/cpp/roundtrips/{target_name}{extension}", output_path]
run(cmd, env=roundtrip_env(), timeout=12000)

return output_path
Expand Down

0 comments on commit 02367e5

Please sign in to comment.