chore(cpp): configure CI to extract and execute C++ code from Markdo…#3381
chore(cpp): configure CI to extract and execute C++ code from Markdo…#3381Tyooughtul wants to merge 4 commits intoapache:mainfrom
Conversation
…wn files - add extract_cpp_doc_examples.py to extract C++ code blocks from markdown - integrate doc tests into CI with --skip-doc-tests and --doc-tests-only options - fix documentation bugs discovered by tests: - index.md: change class to struct for aggregate initialization - field-configuration.md: fix smart pointer access using .get() - add cpp/doc_tests/ to .gitignore issue: apache#658
| doc.metadata = nullptr; // Allowed because nullable | ||
| doc.parent = std::make_shared<Document>(); | ||
| doc.parent->title = "Parent Doc"; | ||
| doc.parent.get()->title = "Parent Doc"; |
There was a problem hiding this comment.
is this really necessary?
There was a problem hiding this comment.
I think fory::field<std::shared_ptr>::operator->() returns a pointer to the shared_ptr itself, not to T . Using .get() gives us the shared_ptr reference, and then -> properly accesses the underlying object.
ci/extract_cpp_doc_code.py
Outdated
| def generate_bazel_build(test_files: List[Path], output_dir: Path) -> None: | ||
| build_path = output_dir / "BUILD" | ||
|
|
||
| build_content = """# Licensed to the Apache Software Foundation (ASF) under one |
There was a problem hiding this comment.
the license header is not needed, the generated code is only for CI, not for release
There was a problem hiding this comment.
Thanks for comment! 😊 I‘ve fixed it.
| try: | ||
| run_doc_example_tests() | ||
| except Exception as e: | ||
| logging.warning(f"Documentation example tests failed: {e}") |
There was a problem hiding this comment.
This should not be an warning, it should raise Exception and let ci fail
|
And Docs-only PRs won’t trigger this workflow: pull_request.paths-ignore excludes docs/** and **/*.md. |
issue: #658
Why?
Add automated testing for C++ code examples in documentation to ensure they compile and run correctly.
What does this PR do?
Related issues