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

build: Use target_include_directories instead of FILE_SET #48

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

sitaowang1998
Copy link
Collaborator

@sitaowang1998 sitaowang1998 commented Jan 13, 2025

Description

#46 uses FILE_SET to specify the public headers. CMake adds support for FILE_SET in target_sources in version 3.23. The default cmake on ubuntu jammy is still 3.22.1, so we need to replace FILE_SET with good old target_include_directories for backward compatibility.
Change unit test workflow to run on both ubuntu jammy and noble.

Validation performed

  • GitHub workflows pass
  • Unit tests pass in dev container
  • Integration tests pass in dev container

Summary by CodeRabbit

Release Notes

  • Chores

    • Updated GitHub Actions workflow to run unit tests on multiple Ubuntu versions.
    • Simplified CMake configuration for header file management in the Spider project.
  • CI/CD

    • Enhanced test coverage by running tests on Ubuntu 22.04 and 24.04.

These changes improve our testing infrastructure and build configuration, ensuring better compatibility and maintainability of the project.

Copy link

coderabbitai bot commented Jan 13, 2025

Walkthrough

This pull request introduces two primary modifications: an update to the GitHub Actions workflow for unit tests and changes to the CMake configuration in the Spider project. The workflow now supports testing across multiple Ubuntu versions (22.04 and 24.04) using a matrix strategy. In the CMake configuration, the header file inclusion method for spider_core and spider_client libraries has been simplified by removing the FILE_SET specification and directly including header files.

Changes

File Change Summary
.github/workflows/unit-tests.yaml Updated non-storage-unit-tests job to use matrix strategy for Ubuntu versions 22.04 and 24.04
src/spider/CMakeLists.txt Simplified header file inclusion for spider_core and spider_client libraries; removed FILE_SET and added direct header file sourcing

Possibly related PRs


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7926386 and 681c91f.

📒 Files selected for processing (1)
  • src/spider/CMakeLists.txt (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: lint
  • GitHub Check: non-storage-unit-tests (ubuntu-24.04)
  • GitHub Check: non-storage-unit-tests (ubuntu-22.04)
🔇 Additional comments (1)
src/spider/CMakeLists.txt (1)

35-35: Approve the FILE_SET removal approach

The replacement of FILE_SET with direct target_sources improves backward compatibility with older CMake versions, which aligns well with the PR objectives. The approach is consistent across both libraries.

Also applies to: 153-154


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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0c84be and 7926386.

📒 Files selected for processing (2)
  • .github/workflows/unit-tests.yaml (1 hunks)
  • src/spider/CMakeLists.txt (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: non-storage-unit-tests (ubuntu-24.04)
  • GitHub Check: lint
  • GitHub Check: non-storage-unit-tests (ubuntu-22.04)
🔇 Additional comments (2)
.github/workflows/unit-tests.yaml (1)

21-24: Consider Ubuntu Noble's pre-release status

The matrix strategy is a good approach for testing across Ubuntu versions. However, Ubuntu 24.04 (Noble) is currently in development and not officially released. This might lead to potential instability in the CI pipeline.

Consider one of these approaches:

  1. Add a continue-on-error flag for Noble builds until its official release
  2. Wait for Noble's official release before adding it to the matrix
src/spider/CMakeLists.txt (1)

35-35: Verify minimum CMake version requirement

The changes remove FILE_SET for better compatibility with CMake 3.22.1 (Ubuntu Jammy). Let's verify the minimum CMake version requirement in the repository.

Also applies to: 153-154

✅ Verification successful

CMake version requirement verified

The changes align with the repository's minimum CMake version requirement of 3.22.1, as specified in both root and example CMakeLists.txt files.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Find and check minimum CMake version requirement
find . -name CMakeLists.txt -exec grep -l "cmake_minimum_required" {} \; -exec grep "cmake_minimum_required" {} \;

Length of output: 251

BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/..
FILES ${SPIDER_CORE_HEADERS}
)
target_sources(spider_core PUBLIC ${SPIDER_CORE_HEADERS})
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add missing include directories for spider_core

While removing FILE_SET improves CMake compatibility, the header visibility needs to be maintained. The spider_core library is missing the corresponding target_include_directories command that was implicitly provided by FILE_SET.

Add this after line 35:

target_sources(spider_core PUBLIC ${SPIDER_CORE_HEADERS})
+target_include_directories(spider_core PUBLIC ..)
📝 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.

Suggested change
target_sources(spider_core PUBLIC ${SPIDER_CORE_HEADERS})
target_sources(spider_core PUBLIC ${SPIDER_CORE_HEADERS})
target_include_directories(spider_core PUBLIC ..)

Comment on lines 153 to 154
target_sources(spider_client PUBLIC ${SPIDER_CLIENT_SHARED_HEADERS})
target_include_directories(spider_client PUBLIC ..)
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use absolute paths in target_include_directories

Using a relative path ("..") in target_include_directories might cause issues depending on where the CMake configuration is included from. It's better to use CMake variables to construct absolute paths.

Replace the relative path with:

-target_include_directories(spider_client PUBLIC ..)
+target_include_directories(spider_client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)
📝 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.

Suggested change
target_sources(spider_client PUBLIC ${SPIDER_CLIENT_SHARED_HEADERS})
target_include_directories(spider_client PUBLIC ..)
target_sources(spider_client PUBLIC ${SPIDER_CLIENT_SHARED_HEADERS})
target_include_directories(spider_client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..)

@sitaowang1998 sitaowang1998 merged commit 0bc88ce into y-scope:main Jan 13, 2025
5 checks passed
@sitaowang1998 sitaowang1998 deleted the cmake branch January 13, 2025 15:45
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.

1 participant