Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an example of including UnoDB as a CMake subdirectory #633

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

laurynas-biveinis
Copy link
Owner

@laurynas-biveinis laurynas-biveinis commented Jan 13, 2025

  • Update UnoDB CMakeLists.txt to use GSL, Google Test, & Google Benchmark CMake
    targets if they are already set up by parent CMake.
  • Convert examples/CMakeLists.txt to be a top-level CMake script, showing an
    example of using UnoDB as a dependency.
  • Update STANDALONE CMake option to skip building benchmarks and tests when OFF.
  • Update CI to build examples from the top-level script.

Summary by CodeRabbit

  • Chores

    • Enhanced continuous integration workflows across multiple platforms with improved example builds, dependency installations, and streamlined build steps.
  • New Features

    • Introduced a centralized preset configuration for streamlined build setups across various compilers and sanitization conditions.
    • Added a new GitHub Actions workflow for building and testing examples.
    • Implemented new environment variables for example and static analysis presets in the MSVC build workflow.
  • Refactor

    • Simplified build configurations and test utility linkages to enhance clarity and efficiency in the build and test processes.
    • Updated CMake configurations to consolidate build directory management and improve overall workflow structure.
    • Streamlined the handling of example builds and dependencies across various workflows.
    • Removed redundant steps in workflows to enhance efficiency and clarity.

@laurynas-biveinis laurynas-biveinis self-assigned this Jan 13, 2025
Copy link

coderabbitai bot commented Jan 13, 2025

Walkthrough

This pull request reorganizes the build and CI configuration for the project. Multiple CI workflows (CircleCI, GitHub Actions for various environments) now include conditional steps to handle example builds only when sanitizer flags are disabled. The order of submodule checkout has been updated, and new dependencies for testing and benchmarking are installed. Additionally, CMake configurations across the main project, examples, and tests are streamlined. A new CMakePresets.json file has also been introduced to facilitate managing varied build configurations.

Changes

Files Change Summary
.circleci/config.yml, .github/workflows/msvc-build.yml, .github/workflows/valgrind.yml, .github/workflows/examples.yml, .github/workflows/codeql-analysis.yml, .github/workflows/experimental-build.yml, .github/workflows/feature-matrix-build.yml, .github/workflows/build.yml, .github/workflows/old-compilers.yml, .github/workflows/ubuntu-20.04.yml Updated CI workflows with new conditional blocks for building examples when sanitizer flags are off, reordered submodule checkouts, and added steps for dependency installation, CMake configuration, and execution of examples across multiple platforms.
CMakeLists.txt, examples/CMakeLists.txt, test/CMakeLists.txt Revised CMake configurations by clarifying options, restructuring custom targets, and simplifying conditional linking and build conditions for tests and examples.
examples/CMakePresets.json New configuration file defining multiple CMake presets for diverse build setups including MSVC, LLVM, and address sanitization configurations.

Possibly related PRs

  • Add simple usage examples #614: The changes in the main PR, which enhance the CircleCI configuration and build process for examples, are related to the retrieved PR that adds a step to build examples in the same CircleCI configuration file.
  • Add CMake option -DBENCHMARKS=ON #679: The changes in the main PR, which enhance the CircleCI configuration and build steps, are related to the modifications in the retrieved PR that introduce a new CMake option for enabling benchmarks, as both involve updates to the build configuration and handling of benchmarks.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f896f77 and 6872415.

📒 Files selected for processing (9)
  • .circleci/config.yml (2 hunks)
  • .github/workflows/build.yml (3 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .gitignore (1 hunks)
  • CMakeLists.txt (5 hunks)
  • README.md (2 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • test/CMakeLists.txt (1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[formatting] ~67-~67: Consider inserting a comma after an introductory phrase for better readability.
Context: ...ct, ON if you work on UnoDB itself. In this case the vendored development dependencies...

(IN_THAT_CASE_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms (35)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: SonarCloud
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
🔇 Additional comments (18)
.gitignore (1)

49-49: LGTM!

Appropriate addition to ignore the compile commands database for the examples build directory.

examples/CMakeLists.txt (2)

8-10: LGTM! Well-structured project configuration.

Good practice to include version, description, and homepage URL in the project configuration.


15-17: Verify package version compatibility.

The find_package commands don't specify version requirements. Consider adding minimum version requirements to ensure compatibility.

Run this script to check the minimum required versions used in the main UnoDB CMakeLists.txt:

test/CMakeLists.txt (1)

29-30: LGTM! Improved Google Test dependency management.

Good improvement to use namespaced targets (GTest::) instead of raw targets. This is a CMake best practice that provides better dependency management and clarity.

Also applies to: 36-36, 43-44

.github/workflows/ubuntu-20.04.yml (1)

205-208: LGTM! Well-organized build directory structure.

Good practice to create separate build directories for the main project and examples.

.circleci/config.yml (1)

70-118: LGTM! Well-structured example build configuration.

The changes appropriately handle:

  • Conditional example building when sanitizers are disabled
  • Compiler-specific configurations for both Linux and macOS
  • Proper package installation and build directory setup

Also applies to: 215-241

CMakeLists.txt (4)

348-350: LGTM! Well-structured conditional target addition.

The conditional check for Microsoft.GSL::GSL target prevents conflicts when UnoDB is included as a subdirectory in projects that already have GSL configured.


384-392: LGTM! Well-structured conditional Google Test integration.

The changes demonstrate good CMake practices:

  • Prevents duplicate target definitions
  • Properly handles Windows-specific settings with gtest_force_shared_crt
  • Correctly manages compiler flags using the ADD_CXX_FLAGS_FOR_SUBDIR macro

394-418: LGTM! Well-structured Google Benchmark integration.

The changes demonstrate excellent CMake practices:

  • Prevents duplicate target definitions
  • Properly configures benchmark options (testing and installation)
  • Handles LTO configuration comprehensively based on build type and compiler
  • Correctly manages compiler flags using the ADD_CXX_FLAGS_FOR_SUBDIR macro

512-515: LGTM! Well-structured benchmark compile definitions.

The conditional compile definitions for the benchmark target are properly scoped and handle GCC debug mode correctly.

.github/workflows/build.yml (4)

289-289: LGTM! Proper submodules handling.

Setting submodules: false in the initial checkout aligns with making the dependencies optional.


359-365: LGTM! Proper macOS dependencies setup.

The dependencies setup for macOS examples is well-structured with correct package names and proper conditions.


367-370: LGTM! Well-structured build environment setup.

The creation of separate build directories for the main project and examples is clean and well-organized.


371-420: LGTM! Well-structured CMake configuration for examples.

The configuration:

  • Properly handles different compilers and their versions
  • Correctly sets up LLVM toolchain for Release builds
  • Has appropriate conditions for skipping builds with sanitizers
.github/workflows/old-compilers.yml (4)

449-449: LGTM! Consistent submodules handling.

Setting submodules: false matches the changes in build.yml and aligns with making dependencies optional.


488-493: Package name typos already reported.

The same package name typos exist here as in build.yml.


495-498: LGTM! Consistent build environment setup.

The creation of separate build directories matches the structure in build.yml.


499-531: LGTM! Consistent CMake configuration for examples.

The configuration matches the structure in build.yml with appropriate conditions for skipping builds with sanitizers.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
.github/workflows/build.yml (1)

343-349: ⚠️ Potential issue

Fix package name typos in apt-get install command.

The package names contain typos:

-sudo apt-get install -y libmsgsl-dev libgtest-dev libbencmark-dev
+sudo apt-get install -y libmsgsl-dev libgtest-dev libbenchmark-dev
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6872415 and 5092fb9.

📒 Files selected for processing (9)
  • .circleci/config.yml (2 hunks)
  • .github/workflows/build.yml (3 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .gitignore (1 hunks)
  • CMakeLists.txt (5 hunks)
  • README.md (2 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • test/CMakeLists.txt (1 hunks)
🔇 Additional comments (13)
.gitignore (1)

49-49: LGTM!

Appropriate addition to ignore the compile commands JSON file in the examples directory.

examples/CMakeLists.txt (2)

1-20: LGTM! Well-structured CMake configuration.

The conversion to a top-level CMake script is well done, with clear project metadata and proper package dependencies.


32-34: Consider adding error handling for example execution.

The example targets are executed directly without checking their exit status.

test/CMakeLists.txt (1)

29-30: LGTM! Good modernization of CMake targets.

The update to use namespaced GTest targets (GTest::gtest_main, GTest::gmock_main) follows CMake best practices.

Also applies to: 36-36, 43-44

.github/workflows/ubuntu-20.04.yml (2)

198-202: Fix package name typo.

The package name contains a typo: 'libbencmark-dev' should be 'libbenchmark-dev'.


205-241: LGTM! Well-structured workflow for examples.

The workflow correctly handles example builds when sanitizers are disabled, with proper environment setup and build steps.

.circleci/config.yml (2)

70-118: LGTM! Well-structured Linux example configuration.

The Linux example build setup is properly configured with correct dependency installation and build steps.


215-241: LGTM! Well-structured macOS example configuration.

The macOS example build setup correctly uses Homebrew for dependencies and maintains consistency with the Linux configuration.

README.md (1)

39-39: LGTM: CMake version update matches implementation.

The minimum CMake version requirement of 3.16 aligns with the changes in CMakeLists.txt.

.github/workflows/old-compilers.yml (1)

495-498: LGTM: Two-phase build setup looks good.

The workflow correctly implements a two-phase build strategy:

  1. First phase builds examples using system-provided dependencies
  2. Second phase builds UnoDB itself using submodules

This demonstrates both usage patterns effectively.

Also applies to: 499-524, 525-531

.github/workflows/build.yml (1)

359-365: LGTM: macOS dependency setup looks good.

The macOS-specific package installation using Homebrew is correct and includes all necessary dependencies.

CMakeLists.txt (2)

348-350: LGTM: Conditional subdirectory additions are well-implemented.

The changes correctly implement conditional subdirectory additions for GSL, Google Test, and Google Benchmark. This allows UnoDB to:

  1. Use existing targets when available from the parent project
  2. Fall back to bundled versions when needed

The implementation follows CMake best practices for dependency management.

Also applies to: 384-392, 394-418


512-515: LGTM: Conditional compile definitions are properly scoped.

The compile definitions for the benchmark target are correctly wrapped in a conditional block to avoid modifying targets from the parent project.

Copy link

coderabbitai bot commented Jan 13, 2025

✅ Actions performed

Full review triggered.

@laurynas-biveinis laurynas-biveinis force-pushed the parent-deps branch 6 times, most recently from 9cc1ce4 to d86fe48 Compare January 13, 2025 09:02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34e417a and d86fe48.

📒 Files selected for processing (10)
  • .circleci/config.yml (2 hunks)
  • .github/workflows/build.yml (3 hunks)
  • .github/workflows/msvc-build.yml (0 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .gitignore (1 hunks)
  • CMakeLists.txt (5 hunks)
  • README.md (2 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • test/CMakeLists.txt (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/msvc-build.yml
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
🔇 Additional comments (22)
.gitignore (1)

49-49: LGTM!

Appropriate addition to ignore the compile commands database in the examples directory, consistent with the existing ignore pattern for the root directory.

examples/CMakeLists.txt (2)

1-10: LGTM!

Clear project setup with appropriate documentation explaining this is a top-level CMake script demonstrating UnoDB integration.


32-34: Consider adding error handling for example execution.

The example targets are executed directly without checking their exit status.

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'
test/CMakeLists.txt (1)

29-30: LGTM! Good modernization of CMake targets.

Excellent update to use modern CMake namespaced targets (GTest::) consistently across all test-related targets.

Also applies to: 36-36, 43-44

.github/workflows/ubuntu-20.04.yml (1)

198-202: Fix package name typo.

The package name contains a typo: 'libmsgsl-dev' should be 'libmsgsl-dev'.

-        run: sudo apt-get install -y libmsgsl-dev libgtest-dev libbenchmark-dev
+        run: sudo apt-get install -y libmsgsl-dev libgtest-dev libbenchmark-dev
.circleci/config.yml (1)

70-118: LGTM! Well-structured example setup.

The example setup is well-organized and consistently implemented for both Linux and macOS builds. The conditional logic for sanitizer checks is clear and maintainable.

Also applies to: 215-241

CMakeLists.txt (5)

348-350: LGTM! Well-structured conditional dependency inclusion.

The conditional check for Microsoft.GSL::GSL target before adding the subdirectory follows CMake best practices for optional dependencies.


384-392: LGTM! Proper handling of Google Test for Windows builds.

Good practice to:

  1. Preserve the Windows-specific setting for shared CRT
  2. Apply sanitizer flags before adding the subdirectory
  3. Restore flags after adding the subdirectory

394-418: LGTM! Comprehensive Google Benchmark configuration.

Well-structured configuration that:

  1. Disables unnecessary features (testing, installation)
  2. Handles LTO appropriately for different build types and compilers
  3. Properly manages compiler flags

512-515: LGTM! Conditional compile definitions for benchmark target.

The compile definitions are now properly guarded to avoid modifying an existing target.


738-738: LGTM! Simplified valgrind dependencies.

Removed valgrind_examples dependency as it's now handled separately in the examples directory.

README.md (3)

39-39: LGTM! Updated minimum CMake version requirement.

The minimum CMake version has been updated to 3.16, which aligns with the features used in the build system.


44-47: LGTM! Clear documentation of optional dependencies.

The documentation now correctly describes GSL, Google Test, and Google Benchmark as optional git submodules that can be provided by the parent project.


70-74: LGTM! Clear standalone build instructions.

The instructions for standalone builds are now clearer about when submodules are required and what features are enabled.

.github/workflows/old-compilers.yml (4)

449-449: LGTM! Disabled initial submodule checkout.

Correctly disables submodule checkout initially to test example builds without vendored dependencies.


488-493: LGTM! Proper dependency setup for examples.

Dependencies are installed only when sanitizers are not enabled, which is correct as examples should be built with system-provided dependencies.


494-520: LGTM! Well-structured CMake configuration for examples.

The configuration properly:

  1. Creates a separate build directory for examples
  2. Sets up compiler-specific flags and tools
  3. Handles both GCC and Clang builds

521-527: LGTM! Clean separation of example and main builds.

Good practice to:

  1. Build examples first without submodules
  2. Then checkout submodules for the main build

Also applies to: 528-530

.github/workflows/build.yml (4)

289-289: LGTM! Disabled initial submodule checkout.

Correctly disables submodule checkout initially to test example builds without vendored dependencies.


343-349: LGTM! Platform-aware dependency setup.

Well-structured platform-specific dependency installation:

  1. Linux uses apt-get for package installation
  2. macOS uses brew for package installation
  3. Both are properly conditioned on sanitizer and analysis flags

Also applies to: 359-365


366-406: LGTM! Comprehensive CMake configuration for examples.

The configuration properly handles:

  1. Platform-specific compiler setup
  2. Build type configuration
  3. LLVM toolchain setup for clang builds
  4. macOS-specific settings

407-414: LGTM! Clean separation of example and main builds.

Good practice to:

  1. Build examples first without submodules
  2. Then checkout submodules for the main build

Also applies to: 415-417

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d86fe48 and 512fc0b.

📒 Files selected for processing (10)
  • .circleci/config.yml (2 hunks)
  • .github/workflows/build.yml (3 hunks)
  • .github/workflows/msvc-build.yml (0 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (1 hunks)
  • .gitignore (1 hunks)
  • CMakeLists.txt (5 hunks)
  • README.md (2 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • test/CMakeLists.txt (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/msvc-build.yml
🔇 Additional comments (22)
.gitignore (1)

49-49: LGTM!

Good addition to ignore the compilation database in the examples directory, consistent with the existing entry for the root directory.

examples/CMakeLists.txt (2)

33-35: 🧹 Nitpick (assertive)

Consider adding error handling for example execution.

The example targets are executed directly without checking their exit status. Consider wrapping them in a script that checks return values.

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'

Likely invalid or redundant comment.


15-18: 🧹 Nitpick (assertive)

Add version constraints for dependencies.

While finding the required packages is good, consider adding version requirements to ensure compatibility.

-find_package(Microsoft.GSL REQUIRED)
-find_package(GTest REQUIRED)
-find_package(benchmark REQUIRED)
+find_package(Microsoft.GSL 4.0 REQUIRED)
+find_package(GTest 1.14 REQUIRED)
+find_package(benchmark 1.8 REQUIRED)

Likely invalid or redundant comment.

test/CMakeLists.txt (1)

29-30: LGTM! Good use of namespaced targets.

The changes correctly update the library linkage to use namespaced targets (GTest::gtest_main and GTest::gmock_main) instead of bare library names. This is a CMake best practice that ensures proper target propagation.

Also applies to: 36-36, 43-44

.github/workflows/ubuntu-20.04.yml (1)

203-204: LGTM! Explicit build directory handling.

Good practice to explicitly create and change to the build directory, making the workflow more reliable and easier to understand.

.circleci/config.yml (2)

70-118: LGTM! Well-structured conditional example builds for Linux.

Good implementation of conditional example builds when sanitizers are disabled. The setup properly handles:

  • Build environment creation
  • Dependency installation
  • CMake configuration with compiler-specific settings

215-241: LGTM! Well-structured conditional example builds for macOS.

Good implementation of conditional example builds for macOS, following the same pattern as Linux. The setup correctly:

  • Creates build environment
  • Installs macOS-specific dependencies using brew
  • Configures CMake appropriately
CMakeLists.txt (5)

348-350: LGTM! Good improvement to GSL dependency handling.

The conditional check ensures GSL is only added as a subdirectory if not already provided by the parent project, improving flexibility when UnoDB is used as a CMake subdirectory.


384-392: LGTM! Well-structured Google Test integration.

The changes properly handle:

  1. Conditional inclusion of Google Test
  2. Windows-specific CRT settings
  3. Compilation flags management

394-418: LGTM! Comprehensive Google Benchmark setup.

The implementation properly handles:

  1. Conditional inclusion of Google Benchmark
  2. Optimization of build by disabling unnecessary features
  3. Careful management of LTO support across different build configurations

512-515: LGTM! Safe handling of benchmark compile definitions.

The conditional check prevents modifying compile definitions of a potentially parent-owned benchmark target.


738-738: LGTM! Appropriate update to valgrind target dependencies.

Removed valgrind_examples dependency to align with the separation of examples into their own CMake project.

.github/workflows/old-compilers.yml (3)

449-449: LGTM! Appropriate update to checkout behavior.

Disabled automatic submodule initialization to support optional dependencies when used as a subdirectory.


488-493: Fix package name typos in apt-get install command.

The package names contain typos:

-sudo apt-get install libmsgsl-dev libgtest-dev libbencmark-dev
+sudo apt-get install libmsgsl-dev libgtest-dev libbenchmark-dev

494-520: LGTM! Well-structured CMake configuration for examples.

The configuration properly handles different compilers and build types while maintaining consistent paths and flags.

.github/workflows/build.yml (4)

289-289: LGTM! Consistent checkout behavior.

Matches the submodule handling in old-compilers.yml.


343-349: Fix package name typos in apt-get install command.

The package names contain typos:

-sudo apt-get install libmsgsl-dev libgtest-dev libbencmark-dev
+sudo apt-get install libmsgsl-dev libgtest-dev libbenchmark-dev

359-365: LGTM! Good cross-platform support for examples.

Properly handles macOS-specific package installation using brew.


366-406: LGTM! Excellent cross-platform CMake configuration.

The configuration comprehensively handles:

  1. Multiple compiler types
  2. Platform-specific settings
  3. Build type variations
README.md (3)

39-39: LGTM! Appropriate CMake version requirement.

The minimum CMake version of 3.16 aligns with the project's needs.


44-47: LGTM! Clear dependency documentation.

The updated section clearly explains the optional nature of the dependencies and their relationship with parent projects.


70-74: LGTM! Clear build instructions.

The documentation clearly explains when and why submodules are required, and the implications of the STANDALONE option.

@laurynas-biveinis laurynas-biveinis force-pushed the parent-deps branch 3 times, most recently from 52ee611 to e6c3056 Compare January 13, 2025 09:50
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
examples/CMakeLists.txt (3)

2-2: 🧹 Nitpick (assertive)

Consider increasing the minimum CMake version requirement.

The current minimum version (3.16) is from December 2019. Consider using a more recent version (e.g., 3.20) to access newer CMake features and improvements.


16-18: 🧹 Nitpick (assertive)

Consider version constraints for dependencies.

While finding the required packages is good, consider adding version requirements to ensure compatibility.


33-35: 🧹 Nitpick (assertive)

Consider adding error handling for example execution.

The example targets are executed directly without checking their exit status. Consider wrapping them in a script that checks return values.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 512fc0b and e6c3056.

📒 Files selected for processing (10)
  • .circleci/config.yml (2 hunks)
  • .github/workflows/build.yml (3 hunks)
  • .github/workflows/msvc-build.yml (0 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (1 hunks)
  • .gitignore (1 hunks)
  • CMakeLists.txt (7 hunks)
  • README.md (2 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • test/CMakeLists.txt (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/msvc-build.yml
🔇 Additional comments (12)
.gitignore (1)

49-49: LGTM!

Appropriate addition to ignore the compile commands database in the examples directory.

test/CMakeLists.txt (1)

29-30: LGTM! Improved CMake target usage.

Good improvement using modern CMake practices with namespaced targets for Google Test dependencies.

Also applies to: 36-36, 43-44

.github/workflows/ubuntu-20.04.yml (1)

203-204: LGTM! Improved workflow organization.

Good consolidation of build directory creation with the CMake configuration step.

.circleci/config.yml (1)

70-118: LGTM! Well-structured example build configuration for Linux.

Good implementation of conditional example builds with proper dependency management and build isolation.

CMakeLists.txt (5)

350-352: LGTM! Well-implemented conditional GSL integration.

The condition correctly checks for the existence of the GSL target before adding the subdirectory, allowing UnoDB to use GSL provided by the parent project.


386-394: LGTM! Well-implemented conditional Google Test integration.

The implementation:

  • Correctly checks for GTest target existence
  • Properly handles Windows CRT settings
  • Maintains consistent build flags

396-420: LGTM! Well-implemented conditional Google Benchmark integration.

The implementation:

  • Correctly checks for benchmark target existence
  • Properly handles testing and installation settings
  • Includes well-conditioned LTO support
  • Maintains consistent build flags

514-517: LGTM! Proper handling of benchmark compile definitions.

The condition correctly prevents modifying the benchmark target when it's provided by the parent project.


757-764: LGTM! Well-implemented conditional test and benchmark directory additions.

The implementation:

  • Correctly conditions subdirectory additions on target existence
  • Provides helpful error messages for standalone builds
  • Includes appropriate informational messages for non-standalone builds

Also applies to: 771-778

.github/workflows/build.yml (1)

343-351: LGTM! Well-structured workflow changes for building examples.

The implementation:

  • Properly sets up dependencies for both Linux and macOS
  • Includes well-conditioned CMake configuration
  • Maintains consistent build flags across platforms

Also applies to: 361-367, 368-408, 409-416

.github/workflows/old-compilers.yml (1)

488-495: LGTM! Consistent workflow changes for building examples.

The implementation maintains consistency with build.yml while properly handling example builds for older compilers.

Also applies to: 496-522, 523-529

README.md (1)

39-39: LGTM! Clear and accurate documentation updates.

The changes properly document:

  • Updated CMake version requirement
  • Optional nature of bundled dependencies
  • Updated standalone build instructions

Also applies to: 44-47, 70-74

@laurynas-biveinis laurynas-biveinis force-pushed the parent-deps branch 3 times, most recently from 26a38a6 to 43c944f Compare January 13, 2025 10:14
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 1

🛑 Comments failed to post (1)
CMakeLists.txt (1)

421-422: ⚠️ Potential issue

Fix invalid generator expression syntax.

The generator expression is malformed and causing build failures. The condition is missing between < and :.

Apply this fix:

-  target_compile_definitions(benchmark PUBLIC
-    "$<${is_gxx_not_release_standalone}:_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC>")
+  target_compile_definitions(benchmark PUBLIC
+    "$<$<BOOL:${is_gxx_not_release_standalone}>:_GLIBCXX_DEBUG;_GLIBCXX_DEBUG_PEDANTIC>")

The fix:

  1. Adds the missing $<BOOL:...> condition
  2. Separates multiple definitions with semicolons
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  target_compile_definitions(benchmark PUBLIC
    "$<$<BOOL:${is_gxx_not_release_standalone}>:_GLIBCXX_DEBUG;_GLIBCXX_DEBUG_PEDANTIC>")
🧰 Tools
🪛 GitHub Actions: sonarcloud

[error] 421-421: Invalid generator expression: $<:_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC>

🪛 GitHub Actions: CodeQL

[error] 421-421: Error evaluating generator expression: $<:_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC>. Expression did not evaluate to a known generator expression


[warning] Manually-specified variables were not used by the project: BUILD_DOCS, BUILD_DOCUMENTATION, CATKIN_ENABLE_TESTING

🪛 GitHub Actions: experimental-build

[error] 421-421: Invalid generator expression: '$<:_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC>' in target_compile_definitions

🪛 GitHub Actions: msvc-build

[error] 421-421: Error evaluating generator expression: $<:_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC>


[error] Building standalone configuration but no Google Test found - have you initialized git submodules?

@laurynas-biveinis laurynas-biveinis force-pushed the parent-deps branch 2 times, most recently from e471de6 to 9eda75e Compare January 13, 2025 10:45
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26a38a6 and 9eda75e.

📒 Files selected for processing (9)
  • .circleci/config.yml (2 hunks)
  • .github/workflows/build.yml (3 hunks)
  • .github/workflows/msvc-build.yml (0 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (1 hunks)
  • CMakeLists.txt (9 hunks)
  • README.md (2 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • test/CMakeLists.txt (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/msvc-build.yml
🔇 Additional comments (27)
examples/CMakeLists.txt (3)

15-18: Consider adding version requirements for dependencies.

While finding the required packages is good, consider adding version requirements to ensure compatibility.

-find_package(Microsoft.GSL REQUIRED)
-find_package(GTest)
-find_package(benchmark)
+find_package(Microsoft.GSL 4.0 REQUIRED)
+find_package(GTest 1.14)
+find_package(benchmark 1.8)

33-35: Consider adding error handling for example execution.

The example targets are executed directly without checking their exit status.

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'

4-7: LGTM: Clear documentation of the file's purpose.

The comment clearly explains that this is a top-level CMake script demonstrating UnoDB integration.

test/CMakeLists.txt (1)

29-30: LGTM: Improved CMake target usage.

The changes properly use modern CMake namespaced targets for GTest dependencies, which is the recommended approach.

Also applies to: 36-36, 43-44

.github/workflows/ubuntu-20.04.yml (1)

203-204: LGTM: Improved build directory handling.

Moving the build directory creation into the Configure CMake step improves organization and reduces script complexity.

.circleci/config.yml (3)

70-118: LGTM: Well-structured example build configuration.

The conditional block properly handles example builds when sanitizers are disabled, with appropriate dependency management and build steps.


215-241: LGTM: Consistent macOS configuration.

The macOS configuration mirrors the Linux setup while accounting for platform-specific package management.


84-85: ⚠️ Potential issue

Fix package name for Microsoft GSL.

The package name should be libmsgsl-dev.

-                  sudo apt-get install -y libmsgsl-dev libgtest-dev \
-                    libgmock-dev
+                  sudo apt-get install -y microsoft-gsl-dev libgtest-dev \
+                    libgmock-dev

Likely invalid or redundant comment.

README.md (2)

44-47: LGTM: Clear documentation of dependency options.

The documentation clearly explains that dependencies can be provided either as git submodules or by the parent project.


70-74: 🧹 Nitpick (assertive)

Consider improving the STANDALONE option documentation.

The explanation of the STANDALONE option and its implications could be clearer.

-  if you work on UnoDB itself. In this case, the vendored development
-  dependencies must be present, i.e. `git submodule update --init --recursive`.
-  It will enable extra global debug checks that require entire programs to be
-  compiled with them. Currently, this consists of the libstdc++ debug mode. The
-  default is `OFF`.
+  if you work on UnoDB itself. When ON:
+  * The vendored development dependencies must be initialized using
+    `git submodule update --init --recursive`
+  * Extra global debug checks are enabled that require entire programs to be
+    compiled with them (currently, this consists of the libstdc++ debug mode)
+  The default is `OFF`.

Likely invalid or redundant comment.

.github/workflows/old-compilers.yml (5)

449-449: LGTM: Disabling initial submodule checkout

The change to disable submodule checkout during the initial checkout is correct, as submodules are checked out later when needed.


488-495: LGTM: Conditional installation of example dependencies

The dependencies for examples are correctly installed only when sanitizers are disabled, which is appropriate as sanitizer builds don't need these dependencies.


496-522: LGTM: Well-structured CMake configuration for examples

The configuration correctly:

  • Creates a separate build directory for examples
  • Sets up compiler variables based on compiler type
  • Configures LLVM toolchain for Clang release builds

523-529: LGTM: Appropriate build configuration for examples

The build step correctly uses parallel builds (-j3) and is properly conditioned on sanitizer flags.


530-532: LGTM: Appropriate timing for submodule checkout

Enabling submodule checkout at this point is correct, as it's needed for the main build.

.github/workflows/build.yml (6)

289-289: LGTM: Consistent submodule checkout configuration

The change to disable initial submodule checkout matches the configuration in old-compilers.yml.


343-351: LGTM: Comprehensive conditional dependency setup for Linux

The dependencies for examples are correctly installed with appropriate conditions for sanitizers, static analysis, and coverage flags.


361-367: LGTM: Appropriate dependency setup for macOS

The dependencies are correctly installed using brew with proper conditions for sanitizers, static analysis, and coverage flags.


409-416: LGTM: Appropriate build configuration for examples

The build step correctly uses parallel builds (-j3) and is properly conditioned on all relevant flags.


417-419: LGTM: Consistent submodule checkout timing

Enabling submodule checkout at this point matches the configuration in old-compilers.yml.


426-427: LGTM: Standard build directory setup

The build directory creation is correctly placed before CMake configuration.

CMakeLists.txt (6)

4-5: LGTM: Added header check capability

Including CheckIncludeFile is appropriate for the header availability checks used later.


350-352: LGTM: Proper handling of GSL dependency

The conditional inclusion of GSL prevents double inclusion when UnoDB is used as a subdirectory.


424-433: LGTM: Proper Google Test integration

The Google Test configuration correctly:

  • Prevents double inclusion
  • Handles Windows-specific settings
  • Manages compiler flags appropriately

491-492: LGTM: Correct DeepState path configuration

The source and binary directory paths are correctly specified relative to the CMake context.


520-526: LGTM: Proper handling of third-party includes

Using SYSTEM for benchmark include directories is the correct approach to suppress warnings from third-party headers.


625-625: LGTM: Appropriate visibility for compile definitions

Changing the compile definitions from PRIVATE to PUBLIC is correct as these definitions need to be available to library consumers.

@laurynas-biveinis laurynas-biveinis force-pushed the parent-deps branch 2 times, most recently from b3558a9 to 43934df Compare January 13, 2025 12:07
@laurynas-biveinis laurynas-biveinis changed the title Make an example of including UnoDB as a CMake subdirectory Create an example of including UnoDB as a CMake subdirectory Jan 13, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🔭 Outside diff range comments (3)
.github/workflows/valgrind.yml (1)

48-48: 🧹 Nitpick (assertive)

Adjust parallel job count for better resource utilization.

Using a fixed -j3 value is suboptimal. Use $(nproc) to scale with available cores.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/experimental-build.yml (1)

36-42: 🛠️ Refactor suggestion

Use a more robust approach for Python binary removal.

The current approach of removing specific Python binaries is brittle. Use brew unlink [email protected] instead.

-          rm '/usr/local/bin/2to3-3.11'
-          rm '/usr/local/bin/idle3.11'
-          rm '/usr/local/bin/pydoc3.11'
-          rm '/usr/local/bin/python3.11'
-          rm '/usr/local/bin/python3.11-config'
+          brew unlink [email protected] || true
           brew update
           brew install boost cppcheck
.github/workflows/ubuntu-20.04.yml (1)

221-225: 🧹 Nitpick (assertive)

Use array for CMake arguments.

The CMake command line is hard to maintain. Use an array to build the command.

-          cmake -B build "$GITHUB_WORKSPACE" -DSTANDALONE=ON \
-              "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \
-              "-DSANITIZE_ADDRESS=${SANITIZE_ADDRESS}" \
-              "-DSANITIZE_THREAD=${SANITIZE_THREAD}" \
-              "-DSANITIZE_UB=${SANITIZE_UB}" "${EXTRA_CMAKE_ARGS[@]}"
+          CMAKE_ARGS=(
+            -B build
+            "$GITHUB_WORKSPACE"
+            -DSTANDALONE=ON
+            "-DCMAKE_BUILD_TYPE=$BUILD_TYPE"
+            "-DSANITIZE_ADDRESS=${SANITIZE_ADDRESS}"
+            "-DSANITIZE_THREAD=${SANITIZE_THREAD}"
+            "-DSANITIZE_UB=${SANITIZE_UB}"
+          )
+          cmake "${CMAKE_ARGS[@]}" "${EXTRA_CMAKE_ARGS[@]}"
♻️ Duplicate comments (8)
.github/workflows/examples.yml (1)

52-52: 🧹 Nitpick (assertive)

Adjust parallel job count for better resource utilization.

Using a fixed -j3 value is suboptimal.

-        run: make -j3 -k examples
+        run: make -j$(($(nproc) / 2)) -k examples
-        run: make -j3 -k valgrind_examples
+        run: make -j$(($(nproc) / 2)) -k valgrind_examples

Also applies to: 56-56

examples/CMakeLists.txt (3)

40-42: 🛠️ Refactor suggestion

Add error handling for example execution.

The example targets are executed without checking their exit status.

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'

2-2: 🧹 Nitpick (assertive)

Increase minimum CMake version requirement.

The current minimum version (3.16) is from December 2019. Use a more recent version (e.g., 3.20) to access newer CMake features and improvements.

-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.20)

17-22: 🧹 Nitpick (assertive)

Add version requirements for dependencies.

The find_package calls should specify minimum version requirements to ensure compatibility.

-  find_package(GTest)
-  find_package(benchmark)
+  find_package(GTest 1.14 REQUIRED)
+  find_package(benchmark 1.8 REQUIRED)
.github/workflows/msvc-build.yml (1)

61-63: 🧹 Nitpick (assertive)

Optimize checkout strategy.

The checkout step with submodules: false followed by later submodule initialization is inefficient.

-      - uses: actions/checkout@v4
-        with:
-          submodules: false
+      - uses: actions/checkout@v4
+      - name: Update submodules
+        run: git submodule update --init
+        if: contains(env.EXAMPLE_PRESETS, matrix.preset)
.circleci/config.yml (2)

198-223: ⚠️ Potential issue

Fix CMake path for macOS examples.

The CMake command uses an incorrect path to the source directory:

-                  cmake ../../examples -DCMAKE_BUILD_TYPE=$BUILD_TYPE
+                  cmake ../../../examples -DCMAKE_BUILD_TYPE=$BUILD_TYPE

70-101: 🧹 Nitpick (assertive)

Extract compiler version setup into variables.

The compiler version setup is duplicated between examples and main build. Extract the versions into variables at the top of the file:

+readonly GCC_VERSION=13
+readonly CLANG_VERSION=19

 if [[ $COMPILER == "gcc" ]]; then
-  V=13
-  export CC=gcc-$V
-  export CXX=g++-$V
+  export CC=gcc-$GCC_VERSION
+  export CXX=g++-$GCC_VERSION
 elif [[ $COMPILER == "clang" ]]; then
-  V=19
-  export CC=clang-$V
-  export CXX=clang++-$V
+  export CC=clang-$CLANG_VERSION
+  export CXX=clang++-$CLANG_VERSION
 fi
CMakeLists.txt (1)

452-463: 🧹 Nitpick (assertive)

Add comment explaining GTest target condition.

The condition for building GTest is not immediately obvious. Add a comment explaining why we check for both STANDALONE and existing target:

+  # Build GTest if we're in standalone mode or if the parent project hasn't already provided it
   if (STANDALONE OR NOT TARGET GTest::gtest_main)
🧰 Tools
🪛 GitHub Actions: experimental-build

[error] 457-457: Unknown CMake command "ADD_CXX_FLAGS_FOR_SUBDIR".

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b89b3b6 and 3b66ddd.

📒 Files selected for processing (14)
  • .circleci/config.yml (4 hunks)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/examples.yml (1 hunks)
  • .github/workflows/experimental-build.yml (2 hunks)
  • .github/workflows/feature-matrix-build.yml (1 hunks)
  • .github/workflows/msvc-build.yml (4 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .github/workflows/valgrind.yml (1 hunks)
  • CMakeLists.txt (5 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • examples/CMakePresets.json (1 hunks)
  • test/CMakeLists.txt (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: experimental-build
examples/CMakeLists.txt

[error] 457-457: Unknown CMake command "ADD_CXX_FLAGS_FOR_SUBDIR".

CMakeLists.txt

[error] 457-457: Unknown CMake command "ADD_CXX_FLAGS_FOR_SUBDIR".

test/CMakeLists.txt

[error] 457-457: Unknown CMake command "ADD_CXX_FLAGS_FOR_SUBDIR".

🔇 Additional comments (9)
.github/workflows/feature-matrix-build.yml (2)

34-34: Smart conditional submodule checkout.

Good use of conditional submodule checkout based on test/benchmark requirements.


51-51: 🧹 Nitpick (assertive)

Adjust parallel job count for better resource utilization.

Using a fixed -j3 value is suboptimal.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/codeql-analysis.yml (1)

52-52: 🧹 Nitpick (assertive)

Adjust parallel job count for better resource utilization.

Using a fixed -j3 value is suboptimal.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/experimental-build.yml (1)

54-54: 🧹 Nitpick (assertive)

Adjust parallel job count for better resource utilization.

Using a fixed -j3 value is suboptimal.

-        run: make -j3 -k
+        run: make -j$(($(sysctl -n hw.ncpu) / 2)) -k
.github/workflows/examples.yml (1)

37-39:

❓ Verification inconclusive

Use version constraints for dependencies.

Installing dependencies without version constraints could lead to unexpected behavior.


🏁 Script executed:

#!/bin/bash
# Check available versions of dependencies
apt-cache policy libgtest-dev libgmock-dev libbenchmark-dev

Length of output: 161


Manual Verification Needed: Add Version Constraints to Dependency Installations

The current workflow at .github/workflows/examples.yml (lines 37-39) installs several dependencies without locking their versions, which might lead to unpredictable behavior when package versions change. Our attempt to verify available versions via apt-cache failed due to the command not being found. Please manually verify on an environment where apt-cache (or a suitable alternative) is available and update the workflow to include explicit version constraints.

  • File: .github/workflows/examples.yml (lines 37-39)
  • Action: Update dependency installation commands to specify exact versions.
  • Note: The absence of apt-cache output necessitates manual verification to determine appropriate version constraints for dependencies like libgtest-dev, libgmock-dev, and libbenchmark-dev.
.circleci/config.yml (1)

31-32: LGTM! Dependencies properly configured for examples.

The added dependencies (Google Test, Google Mock, Google Benchmark) are correctly specified and align with the PR's objective to enhance UnoDB integration.

.github/workflows/build.yml (1)

19-19: LGTM! Secure permissions configuration.

Empty permissions object follows the principle of least privilege, ensuring the workflow only has necessary access.

.github/workflows/old-compilers.yml (1)

17-17: LGTM! Security and build improvements.

  • Empty permissions object follows security best practices
  • Using CMake's -B flag is cleaner than mkdir + cd

Also applies to: 513-513

CMakeLists.txt (1)

767-767:

❓ Verification inconclusive

Verify valgrind coverage after dependency removal.

The valgrind target no longer depends on valgrind_benchmarks and valgrind_examples. Ensure this doesn't miss critical memory leak checks.


🏁 Script executed:

#!/bin/bash
# Description: Check for any valgrind-related targets that might need to be included
echo "=== Searching for valgrind targets ==="
rg "add_.*target.*valgrind" -A 2 -B 2

echo -e "\n=== Checking for memory leak tests ==="
rg "leak.*check|valgrind.*memory" -g "CMakeLists.txt" -A 2 -B 2

Length of output: 2347


Ensure comprehensive memory leak testing despite the simplified valgrind target.

The update in CMakeLists.txt now defines the main target as:

add_custom_target(valgrind)

This change removes its dependencies on valgrind_benchmarks and valgrind_examples. Although our search confirms that memory leak options (e.g., --leak-check=full) are still configured and that dedicated targets (like valgrind_examples, valgrind_benchmarks, valgrind_tests, etc.) exist, you must verify that these specialized targets are invoked as needed within your testing workflows (CI and manual runs). In short, ensure that simplifying the main target doesn’t inadvertently omit critical memory leak checks.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (3)
.github/workflows/valgrind.yml (1)

48-48: 🧹 Nitpick (assertive)

Optimize build parallelism.

Replace hardcoded job count with dynamic CPU core detection.

-        run: make -j3 -k
+        run: make -j$(nproc) -k
.github/workflows/experimental-build.yml (2)

36-40: 🛠️ Refactor suggestion

Replace manual Python symlink removal.

Manual removal of Python symlinks is brittle and may break with Python version updates.

-          rm '/usr/local/bin/2to3-3.11'
-          rm '/usr/local/bin/idle3.11'
-          rm '/usr/local/bin/pydoc3.11'
-          rm '/usr/local/bin/python3.11'
-          rm '/usr/local/bin/python3.11-config'
+          find /usr/local/bin -type l -name '*3.11*' -delete

55-55: ⚠️ Potential issue

Remove continue-on-error.

Using continue-on-error masks build failures and may hide critical issues.

-        continue-on-error: true
♻️ Duplicate comments (5)
.github/workflows/examples.yml (1)

52-52: 🧹 Nitpick (assertive)

Optimize build parallelism.

Replace hardcoded job count with dynamic CPU core detection.

-        run: make -j3 -k examples
+        run: make -j$(nproc) -k examples
-        run: make -j3 -k valgrind_examples
+        run: make -j$(nproc) -k valgrind_examples

Also applies to: 56-56

.circleci/config.yml (2)

219-219: ⚠️ Potential issue

Fix the CMake configuration path for macOS examples.

The CMake command uses a relative path that assumes a specific directory structure. Use the workspace root:

-                  cmake ../../examples -DCMAKE_BUILD_TYPE=$BUILD_TYPE
+                  cmake "$GITHUB_WORKSPACE/examples" -DCMAKE_BUILD_TYPE=$BUILD_TYPE

83-91: 🧹 Nitpick (assertive)

Extract compiler versions into variables.

Hardcoded compiler versions make maintenance harder. Consider extracting them into variables at the top of the file:

+  readonly GCC_VERSION=13
+  readonly CLANG_VERSION=19
   if [[ $COMPILER == "gcc" ]]; then
-    V=13
+    V=$GCC_VERSION
     export CC=gcc-$V
     export CXX=g++-$V
   elif [[ $COMPILER == "clang" ]]; then
-    V=19
+    V=$CLANG_VERSION
     export CC=clang-$V
     export CXX=clang++-$V
   fi
CMakeLists.txt (2)

453-464: 🧹 Nitpick (assertive)

Add a comment explaining the GTest target condition.

The condition for building GTest is not immediately obvious. Add a comment explaining why we check for both STANDALONE and existing target:

+    # Build GTest if we're in standalone mode or if the parent project hasn't already provided it
     if (STANDALONE OR NOT TARGET GTest::gtest_main)

525-553: 🧹 Nitpick (assertive)

Extract LTO configuration into a separate function.

The LTO configuration logic is complex and would be more maintainable as a separate function:

+    function(configure_benchmark_lto)
+      if(NOT IPO_SUPPORTED)
+        return()
+      endif()
+      
+      if(is_debug)
+        message(STATUS "Disabling LTO for Google Benchmark due to debug build")
+        return()
+      endif()
+      
+      if(is_apple_clang)
+        message(STATUS "Disabling LTO for Google Benchmark because Apple clang is not supported")
+        return()
+      endif()
+      
+      set(BENCHMARK_ENABLE_LTO ON CACHE BOOL "Enabling LTO for Google Benchmark" FORCE)
+      message(STATUS "Enabling LTO for Google Benchmark")
+    endfunction()

     if(STANDALONE OR NOT TARGET benchmark::benchmark)
       set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Suppressing Google Benchmark tests" FORCE)
       set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Suppressing Google Benchmark installation" FORCE)

-      if(IPO_SUPPORTED)
-        if(is_debug)
-          message(STATUS "Disabling LTO for Google Benchmark due to debug build")
-        elseif(is_apple_clang)
-          message(STATUS "Disabling LTO for Google Benchmark because Apple clang is not supported")
-        else()
-          set(BENCHMARK_ENABLE_LTO ON CACHE BOOL "Enabling LTO for Google Benchmark" FORCE)
-          message(STATUS "Enabling LTO for Google Benchmark")
-        endif()
-      endif()
+      configure_benchmark_lto()
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b66ddd and d1e0c16.

📒 Files selected for processing (14)
  • .circleci/config.yml (4 hunks)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/examples.yml (1 hunks)
  • .github/workflows/experimental-build.yml (2 hunks)
  • .github/workflows/feature-matrix-build.yml (1 hunks)
  • .github/workflows/msvc-build.yml (4 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .github/workflows/valgrind.yml (1 hunks)
  • CMakeLists.txt (5 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • examples/CMakePresets.json (1 hunks)
  • test/CMakeLists.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (40)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
🔇 Additional comments (19)
.github/workflows/feature-matrix-build.yml (1)

51-51: 🧹 Nitpick (assertive)

Optimize build parallelism.

Replace hardcoded job count with dynamic CPU core detection.

-        run: make -j3 -k
+        run: make -j$(nproc) -k
.github/workflows/codeql-analysis.yml (1)

52-52: 🧹 Nitpick (assertive)

Optimize build parallelism.

Replace hardcoded job count with dynamic CPU core detection.

-        run: make -j3 -k
+        run: make -j$(nproc) -k
examples/CMakeLists.txt (2)

39-43: Add error handling for example execution.

The example targets are still executed directly without checking their exit status.

Apply this diff to add error handling:

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'

45-46: Use list() for Valgrind command arguments.

Define Valgrind command arguments using CMake list() for better maintainability.

Apply this diff:

-set(VALGRIND_COMMAND "valgrind" "--error-exitcode=1" "--leak-check=full"
-  "--trace-children=yes" "-v")
+list(APPEND VALGRIND_COMMAND
+  "valgrind"
+  "--error-exitcode=1"
+  "--leak-check=full"
+  "--trace-children=yes"
+  "-v"
+)
examples/CMakePresets.json (2)

24-27: Add explicit compiler flags for clang-cl.

The clang-cl configuration could benefit from explicit compiler flags.

Apply this diff:

            "cacheVariables": {
                "CMAKE_C_COMPILER": "clang-cl",
-                "CMAKE_CXX_COMPILER": "clang-cl"
+                "CMAKE_CXX_COMPILER": "clang-cl",
+                "CMAKE_C_FLAGS": "-m64",
+                "CMAKE_CXX_FLAGS": "-m64 -fno-delayed-template-parsing"
            },

83-108: LGTM!

The build configurations are well-structured and correctly linked to their configure presets.

test/CMakeLists.txt (3)

29-30: Add version check for GTest.

While the namespace update is good, add a version check to ensure compatibility.

Apply this diff:

+if(NOT TARGET GTest::gtest_main)
+  message(FATAL_ERROR "GTest version 1.14 or higher is required")
+endif()
 target_link_libraries(db_test_utils
   PUBLIC unodb GTest::gtest_main GTest::gmock_main)

36-37: Add version check for GTest.

Add a version check to ensure compatibility.

Apply this diff:

+if(NOT TARGET GTest::gtest_main)
+  message(FATAL_ERROR "GTest version 1.14 or higher is required")
+endif()
 target_link_libraries(qsbr_test_utils PUBLIC GTest::gtest_main)

43-44: Add version check for GTest.

Add a version check to ensure compatibility.

Apply this diff:

+if(NOT TARGET GTest::gtest_main)
+  message(FATAL_ERROR "GTest version 1.14 or higher is required")
+endif()
 target_link_libraries("${TARGET}"
   PRIVATE unodb_qsbr unodb_test GTest::gtest_main)
.github/workflows/msvc-build.yml (3)

17-24: Use JSON arrays for preset lists.

The multiline string format for presets is error-prone.

Apply this diff:

-      EXAMPLE_PRESETS: >-
-        msvc-debug
-        msvc-release
-        msvc-llvm-debug
-        msvc-llvm-release
+      EXAMPLE_PRESETS: '["msvc-debug", "msvc-release", "msvc-llvm-debug", "msvc-llvm-release"]'

61-64: Consider combining checkout steps.

The workflow has two separate checkout steps that could be combined for better efficiency.

Apply this diff:

-      - uses: actions/checkout@v4
-        with:
-          submodules: false
-      # ... example steps ...
-      - uses: actions/checkout@v4
-        with:
-          submodules: true
+      - uses: actions/checkout@v4
+      - name: Update submodules
+        run: git submodule update --init
+        if: contains(env.EXAMPLE_PRESETS, matrix.preset)

79-87: LGTM!

The CMake configuration for examples is well-structured and correctly implemented.

.github/workflows/ubuntu-20.04.yml (1)

221-225: LGTM!

The CMake configuration with build directory is well-structured and correctly implemented.

.circleci/config.yml (2)

31-32: LGTM! Dependencies properly configured.

The addition of Google Test, Google Mock, and Google Benchmark packages aligns with the PR's objective to enhance UnoDB integration within CMake projects.


70-77: LGTM! Well-structured conditional block for examples.

The conditional block properly handles example builds when sanitizers are disabled.

.github/workflows/build.yml (1)

19-19: LGTM! Secure permissions configuration.

Empty permissions object follows the principle of least privilege.

.github/workflows/old-compilers.yml (1)

17-17: LGTM! Consistent permissions configuration.

Empty permissions object matches the configuration in build.yml.

CMakeLists.txt (2)

406-407: LGTM! Well-designed dependency handling.

The condition properly handles both standalone builds and integration scenarios by checking for either STANDALONE mode or missing dependency targets.


768-768: LGTM! Simplified valgrind target.

The valgrind target is now more flexible, allowing individual components to add their own dependencies as needed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (5)
.github/workflows/feature-matrix-build.yml (2)

49-50: 🧹 Nitpick (assertive)

Remove redundant working-directory.

The working-directory is unnecessary since CMake already specifies the build directory with -B build.

-        working-directory: ${{github.workspace}}/build
         run: make -j3 -k

50-50: 🧹 Nitpick (assertive)

Optimize make job count.

Using a fixed number of jobs (-j3) might not be optimal for all environments.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/valgrind.yml (1)

47-52: 🧹 Nitpick (assertive)

Optimize build configuration.

Multiple improvements can be made to the build steps:

  1. Remove redundant working-directory
  2. Optimize make job count
-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/codeql-analysis.yml (1)

51-52: 🧹 Nitpick (assertive)

Optimize build configuration.

For consistency with other workflows:

  1. Remove redundant working-directory
  2. Optimize make job count
-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/experimental-build.yml (1)

53-54: 🧹 Nitpick (assertive)

Optimize build configuration for macOS.

For consistency with other workflows:

  1. Remove redundant working-directory
  2. Optimize make job count using macOS-compatible command
-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$(($(sysctl -n hw.ncpu) / 2)) -k
♻️ Duplicate comments (4)
.github/workflows/valgrind.yml (1)

36-36: 🧹 Nitpick (assertive)

Use apt instead of snap for valgrind.

Snap is unnecessary when valgrind is available in apt repositories.

-          sudo snap install --classic valgrind
+          sudo apt-get install -y valgrind
.github/workflows/examples.yml (1)

37-39: 🧹 Nitpick (assertive)

Consolidate package installation commands.

Multiple apt-get and snap commands can be consolidated into a single apt-get command.

-          sudo apt-get install -y libboost-dev libc6-dev-i386 libc6-dbg \
-              libgtest-dev libgmock-dev libbenchmark-dev
-          sudo snap install --classic valgrind
+          sudo apt-get install -y \
+              libboost-dev \
+              libc6-dev-i386 \
+              libc6-dbg \
+              libgtest-dev \
+              libgmock-dev \
+              libbenchmark-dev \
+              valgrind
.circleci/config.yml (2)

70-101: 🧹 Nitpick (assertive)

Extract compiler version variables.

The compiler version setup is correct but could be more maintainable.

Apply this diff to improve maintainability:

 if [[ $COMPILER == "gcc" ]]; then
-  V=13
+  GCC_VERSION=13
-  export CC=gcc-$V
-  export CXX=g++-$V
+  export CC=gcc-$GCC_VERSION
+  export CXX=g++-$GCC_VERSION
 elif [[ $COMPILER == "clang" ]]; then
-  V=19
+  CLANG_VERSION=19
-  export CC=clang-$V
-  export CXX=clang++-$V
+  export CC=clang-$CLANG_VERSION
+  export CXX=clang++-$CLANG_VERSION
 fi

198-224: ⚠️ Potential issue

Fix the CMake configuration path for macOS examples.

The CMake command uses an incorrect path to the source directory.

Apply this diff to fix the path:

-                  cmake ../../examples -DCMAKE_BUILD_TYPE=$BUILD_TYPE
+                  cmake ../../../examples -DCMAKE_BUILD_TYPE=$BUILD_TYPE
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1e0c16 and 8056a55.

📒 Files selected for processing (14)
  • .circleci/config.yml (4 hunks)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/examples.yml (1 hunks)
  • .github/workflows/experimental-build.yml (2 hunks)
  • .github/workflows/feature-matrix-build.yml (1 hunks)
  • .github/workflows/msvc-build.yml (4 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .github/workflows/valgrind.yml (1 hunks)
  • CMakeLists.txt (5 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • examples/CMakePresets.json (1 hunks)
  • test/CMakeLists.txt (1 hunks)
🔇 Additional comments (10)
examples/CMakeLists.txt (2)

39-43: Add error handling for example execution.

The example targets are executed directly without checking their exit status.

Apply this diff to add error handling:

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'

45-46: Use list() for Valgrind command arguments.

Define Valgrind command arguments using CMake list() for better maintainability.

Apply this diff to use list():

-set(VALGRIND_COMMAND "valgrind" "--error-exitcode=1" "--leak-check=full"
-  "--trace-children=yes" "-v")
+list(APPEND VALGRIND_COMMAND
+  "valgrind"
+  "--error-exitcode=1"
+  "--leak-check=full"
+  "--trace-children=yes"
+  "-v"
+)
examples/CMakePresets.json (1)

21-33: Add explicit compiler flags for clang-cl.

The clang-cl configuration could benefit from explicit compiler flags.

Apply this diff to add explicit flags:

             "cacheVariables": {
                 "CMAKE_C_COMPILER": "clang-cl",
-                "CMAKE_CXX_COMPILER": "clang-cl"
+                "CMAKE_CXX_COMPILER": "clang-cl",
+                "CMAKE_C_FLAGS": "-m64",
+                "CMAKE_CXX_FLAGS": "-m64 -fno-delayed-template-parsing"
             },
test/CMakeLists.txt (1)

29-30: Add version check for GTest.

While the namespace update is good, add a version check to ensure compatibility.

Apply this diff to add version check:

+if(NOT TARGET GTest::gtest_main)
+  message(FATAL_ERROR "GTest version 1.14 or higher is required")
+endif()
 target_link_libraries(db_test_utils
   PUBLIC unodb GTest::gtest_main GTest::gmock_main)
.github/workflows/msvc-build.yml (2)

17-24: Use JSON arrays for preset lists.

The multiline string format for presets is error-prone.

Apply this diff to use JSON arrays:

-      EXAMPLE_PRESETS: >-
-        msvc-debug
-        msvc-release
-        msvc-llvm-debug
-        msvc-llvm-release
+      EXAMPLE_PRESETS: '["msvc-debug", "msvc-release", "msvc-llvm-debug", "msvc-llvm-release"]'

61-64: Combine checkout steps.

The workflow has two separate checkout steps that could be combined for better efficiency.

Apply this diff to combine checkout steps:

-      - uses: actions/checkout@v4
-        with:
-          submodules: false
-      # ... example steps ...
-      - uses: actions/checkout@v4
-        with:
-          submodules: true
+      - uses: actions/checkout@v4
+      - name: Update submodules
+        run: git submodule update --init
+        if: contains(env.EXAMPLE_PRESETS, matrix.preset)

Also applies to: 98-101

.github/workflows/ubuntu-20.04.yml (1)

206-220: Extract compiler versions into variables.

The compiler versions are hardcoded. Extract them into variables at the workflow level for easier maintenance.

Apply this diff to extract compiler versions:

 env:
   DEFAULT_SANITIZE_ADDRESS: OFF
   DEFAULT_SANITIZE_THREAD: OFF
   DEFAULT_SANITIZE_UB: OFF
+  GCC_VERSION: "13"
+  CLANG_VERSION: "19"

 jobs:
   build:
     steps:
       - name: Configure CMake (examples)
         run: |
           if [[ $COMPILER == "gcc" ]]; then
-            export CC="gcc-${VERSION}"
-            export CXX="g++-${VERSION}"
+            export CC="gcc-${GCC_VERSION}"
+            export CXX="g++-${GCC_VERSION}"
           else
-            export CC="clang-${VERSION}"
-            export CXX="clang++-${VERSION}"
+            export CC="clang-${CLANG_VERSION}"
+            export CXX="clang++-${CLANG_VERSION}"
           fi
.circleci/config.yml (1)

31-32: LGTM! Proper dependency setup for examples.

The installation of Google Test, Google Mock, and Google Benchmark system packages aligns with the PR objective of using system-provided dependencies.

.github/workflows/build.yml (1)

19-19: LGTM! Explicit permissions declaration.

Empty permissions object follows security best practices by explicitly declaring no permissions are needed.

.github/workflows/old-compilers.yml (1)

513-519: LGTM! Proper CMake command structure.

The CMake command properly uses the -B flag and maintains consistent argument ordering.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (4)
.github/workflows/feature-matrix-build.yml (2)

48-50: 🧹 Nitpick (assertive)

Remove redundant working-directory specification.

Since you're using cmake -B build, the working-directory specification is unnecessary.

-        working-directory: ${{github.workspace}}/build
         run: make -j3 -k

50-50: 🧹 Nitpick (assertive)

Optimize build parallelism.

Using a fixed job count may not be optimal across different runners.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/experimental-build.yml (1)

36-42: 🧹 Nitpick (assertive)

Consolidate Python cleanup.

The Python binary removal can be simplified using a pattern.

-          rm '/usr/local/bin/2to3-3.11'
-          rm '/usr/local/bin/idle3.11'
-          rm '/usr/local/bin/pydoc3.11'
-          rm '/usr/local/bin/python3.11'
-          rm '/usr/local/bin/python3.11-config'
+          rm /usr/local/bin/*3.11*
CMakeLists.txt (1)

1-11: ⚠️ Potential issue

Fix CMake command order.

Move cmake_minimum_required() before project() to ensure proper CMake initialization and version compatibility.

Apply this diff:

 # Copyright 2019-2025 Laurynas Biveinis
-cmake_minimum_required(VERSION 3.16)
-
 # Set to new once Boost 1.70 is the minimum oldest version
 if(POLICY CMP0167)
   cmake_policy(SET CMP0167 OLD)
 endif()

+cmake_minimum_required(VERSION 3.16)
+
 project(unodb VERSION 0.1
   DESCRIPTION "unodb key-value store library"
   HOMEPAGE_URL "https://github.com/laurynas-biveinis/unodb" LANGUAGES CXX)
♻️ Duplicate comments (12)
.github/workflows/valgrind.yml (1)

36-36: 🧹 Nitpick (assertive)

Use apt instead of snap for valgrind.

Valgrind is available in apt repositories, making snap installation unnecessary.

-          sudo snap install --classic valgrind
+          sudo apt-get install -y valgrind
.github/workflows/examples.yml (2)

37-39: 🧹 Nitpick (assertive)

Consolidate package installation.

Multiple package installation commands can be consolidated.

-          sudo apt-get install -y libboost-dev libc6-dev-i386 libc6-dbg \
-              libgtest-dev libgmock-dev libbenchmark-dev
-          sudo snap install --classic valgrind
+          sudo apt-get install -y \
+              libboost-dev \
+              libc6-dev-i386 \
+              libc6-dbg \
+              libgtest-dev \
+              libgmock-dev \
+              libbenchmark-dev \
+              valgrind

51-56: 🧹 Nitpick (assertive)

Optimize build configuration.

Consistent with other workflows, optimize the build configuration.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k examples
+        run: make -j$(($(nproc) / 2)) -k examples

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k valgrind_examples
+        run: make -j$(($(nproc) / 2)) -k valgrind_examples
examples/CMakeLists.txt (4)

12-14: ⚠️ Potential issue

Default TESTS and BENCHMARKS options to OFF.

These options default to ON which means they'll try to find GTest and benchmark packages by default. This could fail if these packages aren't available in the parent project.

Apply this diff to fix the issue:

-option(TESTS "Find Google Test in the parent project for UnoDB to use" ON)
-option(BENCHMARKS "Find Google Benchmark in the parent project for UnoDB to use"
-  ON)
+option(TESTS "Find Google Test in the parent project for UnoDB to use" OFF)
+option(BENCHMARKS "Find Google Benchmark in the parent project for UnoDB to use"
+  OFF)

40-42: ⚠️ Potential issue

Add error handling for example execution.

The example targets are executed directly without checking their exit status.

Apply this diff to fix the issue:

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'

45-46: 🧹 Nitpick (assertive)

Use list() for Valgrind command arguments.

Define Valgrind command arguments using CMake list() for better maintainability.

Apply this diff to fix the issue:

-set(VALGRIND_COMMAND "valgrind" "--error-exitcode=1" "--leak-check=full"
-  "--trace-children=yes" "-v")
+list(APPEND VALGRIND_COMMAND
+  "valgrind"
+  "--error-exitcode=1"
+  "--leak-check=full"
+  "--trace-children=yes"
+  "-v"
+)

1-10: ⚠️ Potential issue

Add cmake_minimum_required() before project().

The pipeline failures indicate that cmake_minimum_required() should be called before the project() call.

Apply this diff to fix the issue:

 # Copyright 2024-2025 Laurynas Biveinis
+cmake_minimum_required(VERSION 3.20)
 
 # This is a top-level CMake script and not an include of ../CMakeLists.txt. In
 # fact, this one includes the one in the parent directory to show how another
 # project can integrate UnoDB in its build.

 project(unodb-examples VERSION 0.1
   DESCRIPTION "unodb key-value store library examples"
   HOMEPAGE_URL "https://github.com/laurynas-biveinis/unodb" LANGUAGES CXX)
examples/CMakePresets.json (1)

20-22: 🧹 Nitpick (assertive)

Add explicit compiler flags for clang-cl.

The clang-cl configuration could benefit from explicit compiler flags.

Apply this diff to fix the issue:

             "cacheVariables": {
                 "CMAKE_C_COMPILER": "clang-cl",
-                "CMAKE_CXX_COMPILER": "clang-cl"
+                "CMAKE_CXX_COMPILER": "clang-cl",
+                "CMAKE_C_FLAGS": "-m64",
+                "CMAKE_CXX_FLAGS": "-m64 -fno-delayed-template-parsing"
             },
test/CMakeLists.txt (1)

29-30: 🧹 Nitpick (assertive)

Add version check for GTest.

While the namespace update is good, add a version check to ensure compatibility.

Apply this diff to fix the issue:

+if(NOT TARGET GTest::gtest_main)
+  message(FATAL_ERROR "GTest version 1.14 or higher is required")
+endif()
 target_link_libraries(db_test_utils
   PUBLIC unodb GTest::gtest_main GTest::gmock_main)
.github/workflows/msvc-build.yml (2)

17-24: 🧹 Nitpick (assertive)

Use JSON arrays for preset lists.

The multiline string format for presets is error-prone. Use JSON arrays instead.

Apply this diff to fix the issue:

-      EXAMPLE_PRESETS: >-
-        msvc-debug
-        msvc-release
-        msvc-llvm-debug
-        msvc-llvm-release
-      STATIC_ANALYSIS_PRESETS: >-
-        msvc-static-analysis-debug
-        msvc-static-analysis-release
+      EXAMPLE_PRESETS: '["msvc-debug", "msvc-release", "msvc-llvm-debug", "msvc-llvm-release"]'
+      STATIC_ANALYSIS_PRESETS: '["msvc-static-analysis-debug", "msvc-static-analysis-release"]'

61-64: 🧹 Nitpick (assertive)

Consider combining checkout steps.

The workflow has two separate checkout steps that could be combined for better efficiency.

Apply this diff to fix the issue:

-      - uses: actions/checkout@v4
-        with:
-          submodules: false
-      # ... example steps ...
-      - uses: actions/checkout@v4
-        with:
-          submodules: true
+      - uses: actions/checkout@v4
+      - name: Update submodules
+        run: git submodule update --init
+        if: contains(env.EXAMPLE_PRESETS, matrix.preset)
.circleci/config.yml (1)

70-101: 🧹 Nitpick (assertive)

Extract compiler version variables.

The conditional block is well-structured but would be more maintainable with named version variables.

Apply this diff:

   if [[ $COMPILER == "gcc" ]]; then
-    V=13
+    GCC_VERSION=13
-    export CC=gcc-$V
-    export CXX=g++-$V
+    export CC=gcc-$GCC_VERSION
+    export CXX=g++-$GCC_VERSION
   elif [[ $COMPILER == "clang" ]]; then
-    V=19
+    CLANG_VERSION=19
-    export CC=clang-$V
-    export CXX=clang++-$V
+    export CC=clang-$CLANG_VERSION
+    export CXX=clang++-$CLANG_VERSION
   fi
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8056a55 and bc16bbf.

📒 Files selected for processing (14)
  • .circleci/config.yml (4 hunks)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/examples.yml (1 hunks)
  • .github/workflows/experimental-build.yml (2 hunks)
  • .github/workflows/feature-matrix-build.yml (1 hunks)
  • .github/workflows/msvc-build.yml (4 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .github/workflows/valgrind.yml (1 hunks)
  • CMakeLists.txt (6 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • examples/CMakePresets.json (1 hunks)
  • test/CMakeLists.txt (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: CodeQL
CMakeLists.txt

[warning] 15-15: cmake_minimum_required() should be called prior to this top-level project() call.


[warning] 16-16: Compatibility with CMake < 3.10 will be removed from a future version of CMake.

test/CMakeLists.txt

[warning] 15-15: cmake_minimum_required() should be called prior to this top-level project() call.


[warning] 16-16: Compatibility with CMake < 3.10 will be removed from a future version of CMake.

examples/CMakeLists.txt

[warning] 15-15: cmake_minimum_required() should be called prior to this top-level project() call.


[warning] 16-16: Compatibility with CMake < 3.10 will be removed from a future version of CMake.

⏰ Context from checks skipped due to timeout of 90000ms (40)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, OFF, OFF)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, OFF, OFF)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, OFF, OFF)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, OFF, OFF)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
🔇 Additional comments (10)
.github/workflows/valgrind.yml (1)

47-52: 🧹 Nitpick (assertive)

Optimize build configuration.

Similar to other workflows, optimize the build configuration.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/codeql-analysis.yml (1)

51-52: 🧹 Nitpick (assertive)

Optimize build configuration.

Consistent with other workflows, optimize the build configuration.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/experimental-build.yml (1)

53-55: 🧹 Nitpick (assertive)

Optimize build configuration.

Consistent with other workflows, optimize the build configuration.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$(($(sysctl -n hw.ncpu) / 2)) -k
.github/workflows/ubuntu-20.04.yml (1)

10-14: 🧹 Nitpick (assertive)

Consider extracting compiler versions into variables.

The configuration is well-structured, but the compiler versions are hardcoded. Extract them into variables at the workflow level for easier maintenance.

Apply this diff to fix the issue:

 env:
   DEFAULT_SANITIZE_ADDRESS: OFF
   DEFAULT_SANITIZE_THREAD: OFF
   DEFAULT_SANITIZE_UB: OFF
+  GCC_VERSION: "13"
+  CLANG_VERSION: "19"
CMakeLists.txt (4)

406-407: LGTM! Well-structured condition for test and benchmark builds.

The condition properly handles both standalone mode and parent project integration by checking for target existence.


453-464: LGTM! Proper GTest integration.

The configuration correctly handles GTest in both standalone and parent project modes, with proper Windows CRT settings.


525-553: LGTM! Comprehensive Google Benchmark setup.

The configuration properly handles LTO settings and integrates with parent projects.


770-772: LGTM! Improved valgrind target flexibility.

Creating the valgrind target without initial dependencies and adding them conditionally later is a cleaner approach.

.github/workflows/build.yml (1)

19-19: LGTM! Explicit empty permissions.

Setting an empty permissions object is a security best practice, following the principle of least privilege.

.github/workflows/old-compilers.yml (1)

17-17: LGTM! Consistent permissions configuration.

The empty permissions object matches the configuration in other workflow files.

@laurynas-biveinis laurynas-biveinis force-pushed the parent-deps branch 4 times, most recently from 1f3f4fa to cec73b0 Compare February 14, 2025 10:56
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (4)
.github/workflows/feature-matrix-build.yml (2)

34-34: 🧹 Nitpick (assertive)

Optimize submodule checkout.

The submodule checkout condition ${{ matrix.TESTS == 'ON' || matrix.BENCHMARKS == 'ON' }} is inefficient. When neither tests nor benchmarks are enabled, the checkout still occurs but with submodules: false.

-          submodules: ${{ matrix.TESTS == 'ON' || matrix.BENCHMARKS == 'ON' }}
+          fetch-depth: 1
+          submodules: ${{ matrix.TESTS == 'ON' || matrix.BENCHMARKS == 'ON' && 'recursive' || false }}

49-50: 🧹 Nitpick (assertive)

Optimize build performance.

Using a fixed -j3 value for make is suboptimal. The job count should be based on available CPU cores.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/valgrind.yml (1)

49-49: 🧹 Nitpick (assertive)

Optimize build performance and memory usage.

Fixed -j3 for make commands can lead to suboptimal performance and potential memory pressure during Valgrind tests.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k

-        run: make -k valgrind
+        run: make -j1 -k valgrind  # Run serially to avoid memory pressure

Also applies to: 53-53

.github/workflows/experimental-build.yml (1)

36-42: 🛠️ Refactor suggestion

Improve Python cleanup.

Manual removal of Python 3.11 binaries is brittle. Use package management instead.

-          rm '/usr/local/bin/2to3-3.11'
-          rm '/usr/local/bin/idle3.11'
-          rm '/usr/local/bin/pydoc3.11'
-          rm '/usr/local/bin/python3.11'
-          rm '/usr/local/bin/python3.11-config'
+          brew uninstall --ignore-dependencies [email protected]
           brew update
           brew install boost cppcheck
♻️ Duplicate comments (7)
.github/workflows/valgrind.yml (1)

36-37: 🛠️ Refactor suggestion

Use apt package instead of snap.

Installing valgrind via snap is unnecessary when it's available in apt repositories.

-          # Install a newer version than the one in APT
-          sudo snap install --classic valgrind
+          sudo apt-get install -y valgrind
.github/workflows/examples.yml (2)

53-53: 🧹 Nitpick (assertive)

Optimize build and test performance.

Fixed -j3 for make commands and redundant working directory specifications.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k examples
+        run: make -j$(($(nproc) / 2)) -k examples

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k valgrind_examples
+        run: make -j1 -k valgrind_examples  # Run serially to avoid memory pressure

Also applies to: 57-57


37-40: 🧹 Nitpick (assertive)

Consolidate package installation.

Multiple package installation commands can be consolidated for better readability and maintenance.

-          sudo apt-get install -y libboost-dev libc6-dev-i386 libc6-dbg \
-              libgtest-dev libgmock-dev libbenchmark-dev
-          # Install a newer version than the one in APT
-          sudo snap install --classic valgrind
+          sudo apt-get install -y \
+              libboost-dev \
+              libc6-dev-i386 \
+              libc6-dbg \
+              libgtest-dev \
+              libgmock-dev \
+              libbenchmark-dev \
+              valgrind
.circleci/config.yml (2)

224-225: ⚠️ Potential issue

Fix CMake configuration path for macOS examples.

The CMake command uses an incorrect path to the source directory.

Apply this diff:

-                  cmake -S ../../examples -B build/build-examples \
+                  cmake -S examples -B build/build-examples \

83-112: ⚠️ Potential issue

Fix CMake configuration path for examples.

The CMake command uses an incorrect path to the source directory.

Apply this diff:

-                  cmake -S examples -B build-examples \
+                  cmake -S ../../examples -B build-examples \
CMakeLists.txt (2)

773-775: ⚠️ Potential issue

Add dependencies to the valgrind target.

The valgrind target is created without dependencies, which could lead to missing test coverage.

Apply this diff:

-add_custom_target(valgrind)
+add_custom_target(valgrind DEPENDS valgrind_tests valgrind_benchmarks)

409-410: 🧹 Nitpick (assertive)

Add a comment explaining the complex condition.

The condition for building tests and benchmarks is not immediately obvious.

Add this comment above the condition:

+# Build tests and benchmarks if:
+# 1. We're in standalone mode, OR
+# 2. The parent project hasn't provided GTest/Google Benchmark targets, AND
+# 3. Tests or benchmarks are enabled
 if((STANDALONE OR NOT TARGET GTest::gtest_main
     OR NOT TARGET benchmark::benchmark) AND (TESTS OR BENCHMARKS))
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59dee4d and cec73b0.

📒 Files selected for processing (14)
  • .circleci/config.yml (7 hunks)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/examples.yml (1 hunks)
  • .github/workflows/experimental-build.yml (2 hunks)
  • .github/workflows/feature-matrix-build.yml (1 hunks)
  • .github/workflows/msvc-build.yml (4 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .github/workflows/valgrind.yml (1 hunks)
  • CMakeLists.txt (7 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • examples/CMakePresets.json (1 hunks)
  • test/CMakeLists.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (60)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (Debug, OFF, ON, ON)
🔇 Additional comments (17)
.github/workflows/codeql-analysis.yml (1)

52-52: 🧹 Nitpick (assertive)

Optimize build performance.

Using a fixed -j3 value for make is suboptimal.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/experimental-build.yml (1)

54-54: 🧹 Nitpick (assertive)

Optimize build performance.

Using a fixed -j3 value for make is suboptimal.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
examples/CMakeLists.txt (2)

39-43: Add error handling for example execution.

The example targets are executed directly without checking their exit status.

Apply this diff to add error handling:

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'

45-46: Use list() for Valgrind command arguments.

Define Valgrind command arguments using CMake list() for better maintainability.

Apply this diff to use list():

-set(VALGRIND_COMMAND "valgrind" "--error-exitcode=1" "--leak-check=full"
-  "--trace-children=yes" "-v")
+list(APPEND VALGRIND_COMMAND
+  "valgrind"
+  "--error-exitcode=1"
+  "--leak-check=full"
+  "--trace-children=yes"
+  "-v"
+)
examples/CMakePresets.json (2)

23-25: Add explicit compiler flags for clang-cl.

The clang-cl configuration could benefit from explicit compiler flags.

Apply this diff to add compiler flags:

             "cacheVariables": {
                 "CMAKE_C_COMPILER": "clang-cl",
-                "CMAKE_CXX_COMPILER": "clang-cl"
+                "CMAKE_CXX_COMPILER": "clang-cl",
+                "CMAKE_C_FLAGS": "-m64",
+                "CMAKE_CXX_FLAGS": "-m64 -fno-delayed-template-parsing"
             },

75-92: LGTM!

The build presets are correctly linked to their corresponding configure presets.

test/CMakeLists.txt (3)

29-30: Consider adding version check for GTest.

While the namespace update is good, add a version check to ensure compatibility.

Apply this diff to add version check:

+if(NOT TARGET GTest::gtest_main)
+  message(FATAL_ERROR "GTest version 1.14 or higher is required")
+endif()
 target_link_libraries(db_test_utils
   PUBLIC unodb GTest::gtest_main GTest::gmock_main)

36-37: LGTM!

The library dependencies are correctly specified.


43-44: LGTM!

The target dependencies are correctly specified.

.github/workflows/msvc-build.yml (3)

17-24: Use JSON arrays for preset lists.

The multiline string format for presets is error-prone.

Apply this diff to use JSON arrays:

-      EXAMPLE_PRESETS: >-
-        msvc-debug
-        msvc-release
-        msvc-llvm-debug
-        msvc-llvm-release
+      EXAMPLE_PRESETS: '["msvc-debug", "msvc-release", "msvc-llvm-debug", "msvc-llvm-release"]'

61-64: Consider combining checkout steps.

The workflow has two separate checkout steps that could be combined for better efficiency.

Apply this diff to combine checkout steps:

-      - uses: actions/checkout@v4
-        with:
-          submodules: false
-      # ... example steps ...
-      - uses: actions/checkout@v4
-        with:
-          submodules: true
+      - uses: actions/checkout@v4
+      - name: Update submodules
+        run: git submodule update --init
+        if: contains(env.EXAMPLE_PRESETS, matrix.preset)

16-25: Consider extracting compiler versions into variables.

The configuration is well-structured, but the compiler versions are hardcoded.

Apply this diff to extract compiler versions:

 env:
   DEFAULT_SANITIZE_ADDRESS: OFF
   DEFAULT_SANITIZE_THREAD: OFF
   DEFAULT_SANITIZE_UB: OFF
+  GCC_VERSION: "13"
+  CLANG_VERSION: "19"

 jobs:
   build:
     steps:
       - name: Configure CMake (examples)
         run: |
           if [[ $COMPILER == "gcc" ]]; then
-            export CC="gcc-${VERSION}"
-            export CXX="g++-${VERSION}"
+            export CC="gcc-${GCC_VERSION}"
+            export CXX="g++-${GCC_VERSION}"
           else
-            export CC="clang-${VERSION}"
-            export CXX="clang++-${VERSION}"
+            export CC="clang-${CLANG_VERSION}"
+            export CXX="clang++-${CLANG_VERSION}"
           fi
.github/workflows/ubuntu-20.04.yml (2)

15-15: LGTM!

Empty permissions object is correctly specified.


221-225: LGTM!

The CMake configuration is correctly specified with build directory and options.

.circleci/config.yml (1)

4-10: LGTM! Well-structured compiler version parameters.

The addition of pipeline-level parameters for compiler versions improves maintainability by centralizing version configuration.

.github/workflows/build.yml (1)

19-19: LGTM! Modern CMake configuration.

The changes align with modern CMake practices:

  • Empty permissions object improves security
  • Using -B build flag is the preferred way to specify build directory

Also applies to: 406-407

.github/workflows/old-compilers.yml (1)

17-17: LGTM! Consistent workflow configuration.

The changes maintain consistency with the main workflow configuration.

Also applies to: 513-513

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (6)
.github/workflows/feature-matrix-build.yml (2)

49-50: 🧹 Nitpick (assertive)

Remove redundant working directory specification.

Since you're using cmake -B build, the working directory in the build step is unnecessary.

-        working-directory: ${{github.workspace}}/build
         run: make -j3 -k

50-50: 🧹 Nitpick (assertive)

Optimize build parallelism.

Using a fixed -j3 value might not be optimal. Consider using a dynamic value based on available CPU cores.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/valgrind.yml (1)

48-49: 🧹 Nitpick (assertive)

Optimize resource usage in build steps.

Remove redundant working directory and optimize job count.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k

-        working-directory: ${{github.workspace}}/build
-        run: make -k valgrind
+        run: make -j$(($(nproc) / 2)) -k valgrind

Also applies to: 52-53

.github/workflows/codeql-analysis.yml (1)

51-52: 🧹 Nitpick (assertive)

Optimize build configuration.

Remove redundant working directory and optimize job count.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/experimental-build.yml (2)

36-40: 🧹 Nitpick (assertive)

Simplify Python cleanup.

Use a single command to remove multiple Python files.

-          rm '/usr/local/bin/2to3-3.11'
-          rm '/usr/local/bin/idle3.11'
-          rm '/usr/local/bin/pydoc3.11'
-          rm '/usr/local/bin/python3.11'
-          rm '/usr/local/bin/python3.11-config'
+          rm -f /usr/local/bin/{2to3-3.11,idle3.11,pydoc3.11,python3.11,python3.11-config}

53-54: 🧹 Nitpick (assertive)

Optimize build configuration.

Remove redundant working directory and optimize job count.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$((sysctl -n hw.ncpu) / 2)) -k

Note: Using sysctl instead of nproc for macOS.

♻️ Duplicate comments (5)
.github/workflows/valgrind.yml (1)

36-37: 🧹 Nitpick (assertive)

Use apt instead of snap for valgrind.

Installing valgrind via snap is unnecessary when it's available in apt repositories.

-          # Install a newer version than the one in APT
-          sudo snap install --classic valgrind
+          sudo apt-get install -y valgrind
.github/workflows/examples.yml (2)

52-57: 🧹 Nitpick (assertive)

Optimize build configuration.

Remove redundant working directory specifications and optimize job count.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k examples
+        run: make -j$(($(nproc) / 2)) -k examples

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k valgrind_examples
+        run: make -j$(($(nproc) / 2)) -k valgrind_examples

37-40: 🧹 Nitpick (assertive)

Consolidate package installation.

Use a single apt-get command for all dependencies and avoid snap.

-          sudo apt-get install -y libboost-dev libc6-dev-i386 libc6-dbg \
-              libgtest-dev libgmock-dev libbenchmark-dev
-          # Install a newer version than the one in APT
-          sudo snap install --classic valgrind
+          sudo apt-get install -y \
+              libboost-dev \
+              libc6-dev-i386 \
+              libc6-dbg \
+              libgtest-dev \
+              libgmock-dev \
+              libbenchmark-dev \
+              valgrind
.circleci/config.yml (1)

96-102: 🧹 Nitpick (assertive)

Consider using more descriptive variable names.

The compiler setup is correct, but consider using more descriptive variable names for better maintainability:

-  if [[ $COMPILER == "gcc" ]]; then
-    export CC=gcc-$GCC_VERSION
-    export CXX=g++-$GCC_VERSION
-  elif [[ $COMPILER == "clang" ]]; then
-    export CC=clang-$CLANG_VERSION
-    export CXX=clang++-$CLANG_VERSION
-  fi
+  if [[ $COMPILER == "gcc" ]]; then
+    gcc_compiler_version="$GCC_VERSION"
+    export CC="gcc-${gcc_compiler_version}"
+    export CXX="g++-${gcc_compiler_version}"
+  elif [[ $COMPILER == "clang" ]]; then
+    clang_compiler_version="$CLANG_VERSION"
+    export CC="clang-${clang_compiler_version}"
+    export CXX="clang++-${clang_compiler_version}"
+  fi
CMakeLists.txt (1)

308-319: 🧹 Nitpick (assertive)

Add a comment explaining the IPO/LTO conditions.

The conditions for enabling IPO/LTO are complex and would benefit from a comment explaining the rationale.

+# IPO/LTO is enabled only when:
+# 1. Not using MSVC LLVM (which doesn't support it)
+# 2. Not using clang ≥17 with ASan (due to ThinLTO module bug)
+# 3. IPO is supported by the compiler
 if(STANDALONE)
   if(MSVC AND is_clang)
     message(STATUS "Not enabling IPO/LTO due to MSVC LLVM not supporting it")
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cec73b0 and 992d268.

📒 Files selected for processing (14)
  • .circleci/config.yml (7 hunks)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/examples.yml (1 hunks)
  • .github/workflows/experimental-build.yml (2 hunks)
  • .github/workflows/feature-matrix-build.yml (1 hunks)
  • .github/workflows/msvc-build.yml (4 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .github/workflows/valgrind.yml (1 hunks)
  • CMakeLists.txt (7 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • examples/CMakePresets.json (1 hunks)
  • test/CMakeLists.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (48)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with TSan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Apple Silicon), macos-14, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with ASan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with cppcheck (Intel), macos-latest, Debug, macos-clang, ON, OFF)
🔇 Additional comments (19)
examples/CMakeLists.txt (2)

39-43: Add error handling for example execution.

The example targets are executed directly without checking their exit status.

Apply this diff to add error handling:

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'

45-46: Use list() for Valgrind command arguments.

Define Valgrind command arguments using CMake list() for better maintainability.

Apply this diff to use list():

-set(VALGRIND_COMMAND "valgrind" "--error-exitcode=1" "--leak-check=full"
-  "--trace-children=yes" "-v")
+list(APPEND VALGRIND_COMMAND
+  "valgrind"
+  "--error-exitcode=1"
+  "--leak-check=full"
+  "--trace-children=yes"
+  "-v"
+)
examples/CMakePresets.json (2)

22-25: Add explicit compiler flags for clang-cl.

The clang-cl configuration could benefit from explicit compiler flags.

Apply this diff to add explicit flags:

             "cacheVariables": {
                 "CMAKE_C_COMPILER": "clang-cl",
-                "CMAKE_CXX_COMPILER": "clang-cl"
+                "CMAKE_CXX_COMPILER": "clang-cl",
+                "CMAKE_C_FLAGS": "-m64",
+                "CMAKE_CXX_FLAGS": "-m64 -fno-delayed-template-parsing"
             },

75-92: LGTM!

The build presets are correctly configured and properly linked to their corresponding configure presets.

test/CMakeLists.txt (3)

29-30: Add version check for GTest.

While the namespace update is good, add a version check to ensure compatibility.

Apply this diff to add version check:

+if(NOT TARGET GTest::gtest_main)
+  message(FATAL_ERROR "GTest version 1.14 or higher is required")
+endif()
 target_link_libraries(db_test_utils
   PUBLIC unodb GTest::gtest_main GTest::gmock_main)

36-36: LGTM!

The library linkage is correct and uses the proper GTest namespace.


43-44: LGTM!

The target linkage is correct and uses the proper GTest namespace.

.github/workflows/msvc-build.yml (4)

17-24: Use JSON arrays for preset lists.

The multiline string format for presets is error-prone.

Apply this diff to use JSON arrays:

-      EXAMPLE_PRESETS: >-
-        msvc-debug
-        msvc-release
-        msvc-llvm-debug
-        msvc-llvm-release
+      EXAMPLE_PRESETS: '["msvc-debug", "msvc-release", "msvc-llvm-debug", "msvc-llvm-release"]'

61-64: Consider combining checkout steps.

The workflow has two separate checkout steps that could be combined for better efficiency.

Apply this diff to combine steps:

-      - uses: actions/checkout@v4
-        with:
-          submodules: false
-      # ... example steps ...
-      - uses: actions/checkout@v4
-        with:
-          submodules: true
+      - uses: actions/checkout@v4
+      - name: Update submodules
+        run: git submodule update --init
+        if: contains(env.EXAMPLE_PRESETS, matrix.preset)

79-82: LGTM!

The dependencies installation step is correctly configured.


83-90: LGTM!

The CMake configuration for examples is correctly set up.

.github/workflows/ubuntu-20.04.yml (2)

15-15: LGTM!

The permissions are correctly set to an empty object.


221-225: LGTM!

The CMake configuration is correctly set up with the build directory specified using the -B option.

.circleci/config.yml (3)

4-10: LGTM! Well-structured pipeline parameters.

The parameters for GCC and Clang versions are properly defined with sensible defaults.


270-344: LGTM! Consistent job naming convention.

The job names properly use the pipeline parameters for compiler versions, maintaining consistency throughout the configuration.


83-112:

✅ Verification successful

Verify the CMake configuration path for examples.

The CMake command uses a path that might be incorrect. Run this script to verify the path:


🏁 Script executed:

#!/bin/bash
# Description: Verify the examples directory location
echo "=== Checking examples directory location ==="
fd -t d "examples$"

echo -e "\n=== Checking CMakeLists.txt in examples ==="
fd -t f "CMakeLists.txt" -p "examples/"

Length of output: 295


CMake configuration path verified.

The fd script confirmed that the examples/ directory exists and contains a CMakeLists.txt. The CMake command using -S examples is correct as-is, so no changes are needed.

.github/workflows/build.yml (1)

19-19: LGTM! Following security best practices.

The empty permissions object follows the principle of least privilege, ensuring the workflow only has necessary permissions.

.github/workflows/old-compilers.yml (1)

17-17: LGTM! Following security best practices.

The empty permissions object follows the principle of least privilege, ensuring the workflow only has necessary permissions.

CMakeLists.txt (1)

45-47: LGTM! Clear STANDALONE option documentation.

The STANDALONE option is well-documented with a clear description of its purpose and effects.

@laurynas-biveinis
Copy link
Owner Author

@coderabbitai review

Copy link

coderabbitai bot commented Feb 14, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

- No longer configure LTO when building as an included project, leaving it for
  the parent project to configure.
- Update UnoDB CMakeLists.txt to use Google Test & Google Benchmark CMake
  targets if they are already set up by parent CMake in a non-standalone build.
- Convert examples/CMakeLists.txt to be a top-level CMake script, showing an
  example of using UnoDB as a dependency.
- Update CI to build examples from the top-level script.
@laurynas-biveinis
Copy link
Owner Author

@coderabbitai fullreview

Copy link

coderabbitai bot commented Feb 14, 2025

@laurynas-biveinis I'll perform a full review of the PR.

✅ Actions performed

Full review triggered.

@laurynas-biveinis
Copy link
Owner Author

@coderabbitai fullreview

Copy link

coderabbitai bot commented Feb 14, 2025

@laurynas-biveinis I'll perform a full review of the PR.

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (5)
.github/workflows/feature-matrix-build.yml (2)

49-50: 🧹 Nitpick (assertive)

Optimize build performance.

Replace fixed job count with dynamic CPU core calculation.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k

48-50: 🧹 Nitpick (assertive)

Remove redundant working directory.

The working directory is unnecessary since CMake's -B option already specifies the build directory.

-        working-directory: ${{github.workspace}}/build
         run: make -j3 -k
.github/workflows/valgrind.yml (1)

49-53: 🧹 Nitpick (assertive)

Optimize build and test performance.

Use dynamic CPU core calculation for both build and valgrind steps.

-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k

         - name: Valgrind test
         working-directory: ${{github.workspace}}/build
-        run: make -k valgrind
+        run: make -j$(($(nproc) / 2)) -k valgrind
.github/workflows/codeql-analysis.yml (1)

51-52: 🧹 Nitpick (assertive)

Optimize build performance and remove redundancy.

The working directory is redundant and the job count should be dynamic.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$(($(nproc) / 2)) -k
.github/workflows/experimental-build.yml (1)

53-55: 🧹 Nitpick (assertive)

Optimize build performance for macOS.

Use dynamic CPU core calculation and remove redundant working directory.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k
+        run: make -j$((sysctl -n hw.ncpu / 2)) -k
♻️ Duplicate comments (5)
.github/workflows/valgrind.yml (1)

36-37: 🧹 Nitpick (assertive)

Use apt package manager for valgrind.

The comment suggests using snap for a newer version, but the apt version is sufficient for CI purposes.

-          # Install a newer version than the one in APT
-          sudo snap install --classic valgrind
+          sudo apt-get install -y valgrind
.github/workflows/examples.yml (2)

36-40: 🧹 Nitpick (assertive)

Consolidate package installations and use apt for valgrind.

Combine all package installations into a single apt-get command.

          sudo apt-get update
-          sudo apt-get install -y libboost-dev libc6-dev-i386 libc6-dbg \
-              libgtest-dev libgmock-dev libbenchmark-dev
-          # Install a newer version than the one in APT
-          sudo snap install --classic valgrind
+          sudo apt-get install -y \
+              libboost-dev \
+              libc6-dev-i386 \
+              libc6-dbg \
+              libgtest-dev \
+              libgmock-dev \
+              libbenchmark-dev \
+              valgrind

52-57: 🧹 Nitpick (assertive)

Optimize build performance and remove redundancy.

Use dynamic CPU core calculation and remove redundant working directories.

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k examples
+        run: make -j$(($(nproc) / 2)) -k examples

-        working-directory: ${{github.workspace}}/build
-        run: make -j3 -k valgrind_examples
+        run: make -j$(($(nproc) / 2)) -k valgrind_examples
CMakeLists.txt (2)

409-410: 🧹 Nitpick (assertive)

Add a comment explaining the complex condition.

The condition for building tests and benchmarks is not immediately obvious. Add this comment:

+# Build tests and benchmarks if:
+# 1. We're in standalone mode, OR
+# 2. The parent project hasn't provided GTest/Google Benchmark targets, AND
+# 3. Tests or benchmarks are enabled
 if((STANDALONE OR NOT TARGET GTest::gtest_main
     OR NOT TARGET benchmark::benchmark) AND (TESTS OR BENCHMARKS))

773-775: 🧹 Nitpick (assertive)

Add a comment explaining the valgrind target dependencies.

Add this comment to clarify the dependency structure:

+# The valgrind target starts with no dependencies.
+# Dependencies are added later when:
+# 1. Tests are enabled (valgrind_tests)
+# 2. Benchmarks are enabled (valgrind_benchmarks)
+# 3. DeepState is available (valgrind_deepstate)
 add_custom_target(valgrind)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e547c5 and 5273721.

📒 Files selected for processing (14)
  • .circleci/config.yml (7 hunks)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/examples.yml (1 hunks)
  • .github/workflows/experimental-build.yml (2 hunks)
  • .github/workflows/feature-matrix-build.yml (1 hunks)
  • .github/workflows/msvc-build.yml (4 hunks)
  • .github/workflows/old-compilers.yml (2 hunks)
  • .github/workflows/ubuntu-20.04.yml (2 hunks)
  • .github/workflows/valgrind.yml (1 hunks)
  • CMakeLists.txt (7 hunks)
  • examples/CMakeLists.txt (1 hunks)
  • examples/CMakePresets.json (1 hunks)
  • test/CMakeLists.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (80)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
  • GitHub Check: build (XCode Release with ASan (Apple Silicon), macos-14, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Debug with UBSan (Intel), macos-latest, Debug, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release with ASan (Intel), macos-latest, Release, macos-clang, ON, OFF)
  • GitHub Check: build (XCode Release (Intel), macos-latest, Release, macos-clang, OFF)
  • GitHub Check: build (clang 12 Debug with UBSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with TSan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug with ASan, Debug, ON, clang, 12)
  • GitHub Check: build (clang 12 Debug, Debug, clang, 12)
🔇 Additional comments (15)
examples/CMakeLists.txt (3)

12-14: Default values for TESTS and BENCHMARKS options need to be OFF.

These options defaulting to ON will cause build failures if GTest and benchmark packages aren't available in the parent project.

Apply this diff:

-option(TESTS "Find Google Test in the parent project for UnoDB to use" ON)
-option(BENCHMARKS "Find Google Benchmark in the parent project for UnoDB to use"
-  ON)
+option(TESTS "Find Google Test in the parent project for UnoDB to use" OFF)
+option(BENCHMARKS "Find Google Benchmark in the parent project for UnoDB to use"
+  OFF)

40-42: Add error handling for example execution.

Examples are executed without checking their exit status.

Apply this diff:

-  env ./example_art
-  COMMAND env ./example_art_stats
-  COMMAND env ./example_olc_art
+  env bash -c './example_art || exit 1'
+  COMMAND env bash -c './example_art_stats || exit 1'
+  COMMAND env bash -c './example_olc_art || exit 1'

45-46: Use list() for Valgrind command arguments.

Current string format is error-prone and hard to maintain.

Apply this diff:

-set(VALGRIND_COMMAND "valgrind" "--error-exitcode=1" "--leak-check=full"
-  "--trace-children=yes" "-v")
+list(APPEND VALGRIND_COMMAND
+  "valgrind"
+  "--error-exitcode=1"
+  "--leak-check=full"
+  "--trace-children=yes"
+  "-v"
+)
examples/CMakePresets.json (1)

23-25: Add explicit compiler flags for clang-cl.

The clang-cl configuration needs explicit flags for better control.

Apply this diff:

             "cacheVariables": {
                 "CMAKE_C_COMPILER": "clang-cl",
-                "CMAKE_CXX_COMPILER": "clang-cl"
+                "CMAKE_CXX_COMPILER": "clang-cl",
+                "CMAKE_C_FLAGS": "-m64",
+                "CMAKE_CXX_FLAGS": "-m64 -fno-delayed-template-parsing"
             },
test/CMakeLists.txt (1)

29-30: Add version check for GTest.

Ensure compatibility by checking GTest version.

Apply this diff:

+if(NOT TARGET GTest::gtest_main)
+  message(FATAL_ERROR "GTest version 1.14 or higher is required")
+endif()
 target_link_libraries(db_test_utils
   PUBLIC unodb GTest::gtest_main GTest::gmock_main)
.github/workflows/msvc-build.yml (2)

61-64: Combine checkout steps for better efficiency.

Multiple checkout steps are unnecessary.

Apply this diff:

-      - uses: actions/checkout@v4
-        with:
-          submodules: false
-      # ... example steps ...
-      - uses: actions/checkout@v4
-        with:
-          submodules: true
+      - uses: actions/checkout@v4
+      - name: Update submodules
+        run: git submodule update --init
+        if: contains(env.EXAMPLE_PRESETS, matrix.preset)

17-24: Use JSON arrays for preset lists.

Multiline string format is error-prone.

Apply this diff:

-      EXAMPLE_PRESETS: >-
-        msvc-debug
-        msvc-release
-        msvc-llvm-debug
-        msvc-llvm-release
+      EXAMPLE_PRESETS: '["msvc-debug", "msvc-release", "msvc-llvm-debug", "msvc-llvm-release"]'
.github/workflows/ubuntu-20.04.yml (1)

10-14: Extract compiler versions into variables.

Hardcoded compiler versions make maintenance difficult.

Apply this diff:

 env:
   DEFAULT_SANITIZE_ADDRESS: OFF
   DEFAULT_SANITIZE_THREAD: OFF
   DEFAULT_SANITIZE_UB: OFF
+  GCC_VERSION: "13"
+  CLANG_VERSION: "19"
.circleci/config.yml (4)

4-10: LGTM! Well-structured compiler version parameters.

The parameters provide flexibility for compiler version selection with sensible defaults.


266-266: LGTM! Consistent use of compiler version parameters in job names.

The job names are properly parameterized using the pipeline-level compiler version parameters.

Also applies to: 270-270, 275-275, 280-280, 285-285, 289-289, 294-294, 299-299, 304-304, 308-308, 313-313, 318-318, 323-323, 334-334, 339-339


83-112:

✅ Verification successful

Verify the CMake configuration path for examples.

The CMake command uses a relative path to the source directory. Ensure that examples is the correct path relative to the repository root.

Run this script to verify the path:


🏁 Script executed:

#!/bin/bash
# Description: Verify the examples directory exists at the expected path
fd -t d "^examples$"

Length of output: 32


CMake Configuration Path Verified

The script confirmed that the examples directory exists at the expected path. The relative path used in the CMake command is correct.


204-226:

✅ Verification successful

Verify the CMake configuration path for macOS examples.

The CMake command uses a relative path to the source directory. Ensure that examples is the correct path relative to the repository root.

Run this script to verify the path:


🏁 Script executed:

#!/bin/bash
# Description: Verify the examples directory exists at the expected path
fd -t d "^examples$"

Length of output: 32


Verified: The CMake configuration uses the correct relative path.

  • The fd command confirmed that the examples directory exists at the repository root.
  • No issues found with the provided CMake command in configuring macOS examples.
.github/workflows/build.yml (1)

19-19: LGTM! Secure permissions configuration.

The empty permissions object follows the principle of least privilege, improving security.

.github/workflows/old-compilers.yml (1)

17-17: LGTM! Secure permissions configuration.

The empty permissions object follows the principle of least privilege, improving security.

CMakeLists.txt (1)

308-329: LGTM! Well-structured IPO/LTO configuration.

The configuration properly handles:

  1. MSVC LLVM incompatibility
  2. clang ≥17 with ASan ThinLTO module bug
  3. Conditional IPO support check

Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.24%. Comparing base (d051648) to head (5273721).
Report is 78 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #633      +/-   ##
==========================================
- Coverage   98.35%   98.24%   -0.12%     
==========================================
  Files          33       33              
  Lines        7043     7052       +9     
==========================================
+ Hits         6927     6928       +1     
- Misses        116      124       +8     
Flag Coverage Δ
Debug 98.18% <ø> (-0.16%) ⬇️
Release 97.33% <ø> (+0.50%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@laurynas-biveinis laurynas-biveinis merged commit 2e1a458 into master Feb 14, 2025
209 of 210 checks passed
@laurynas-biveinis laurynas-biveinis deleted the parent-deps branch February 14, 2025 15:36
@laurynas-biveinis
Copy link
Owner Author

laurynas-biveinis commented Feb 14, 2025

@thompsonbry , @monejava , changes in this area:

  • Added CMake options TESTS (default ON) & BENCHMARKS (default OFF in !STANDALONE builds). If both disabled, then gtest and gbenchmark dependencies are not used, and the project builds without initialized submodules. (if STATS is also OFF, then Boost is not needed neither, resulting in zero external dependencies).
  • If either or both TESTS or BENCHMARKS are enabled but the build is not standalone, then UnoDB will use the existing gtest and gbenchmark targets before attempting to build its own.
  • examples/CMakeLists.txt now has a working example of how the parent project may integrate this.
  • Several bugfixes pushed for including the project as subproject: not replacing assert implementation, not enabling LTO - allowing the parent project to handle these items as needed - and CMake compilation flags properly set on targets so that the parent project gets them correctly.

One last thing remaining is the INSTALL target. This one can wait until the ART work stabilizes, because it's not clear yet how much of the library will be header-only and compiled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants