Skip to content

fix: set MACOS_CMAKE_ARGS for diff clang versions #49

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shenxianpeng
Copy link
Contributor

@shenxianpeng shenxianpeng commented Apr 6, 2025

Summary by CodeRabbit

  • Chores
    • Enhanced build and environment settings for improved macOS compatibility.
    • Introduced a new .gitignore file to prevent tracking of local virtual environment directories.

@shenxianpeng shenxianpeng added the bug Something isn't working label Apr 6, 2025
@shenxianpeng shenxianpeng requested a review from Copilot April 6, 2025 16:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

.github/workflows/build.yml:96

  • The conditional comparison assumes that matrix.clang-version is always numeric. Please ensure that this value is reliably numeric to prevent unexpected failures in the bash condition.
if [ "${{ matrix.clang-version }}" -gt 18 ]; then

Copy link
Contributor

coderabbitai bot commented Apr 6, 2025

Walkthrough

The pull request introduces modifications to the GitHub Actions build workflow by adding commands to the "Update homebrew" step for macOS builds, specifically appending options to the MACOS_CMAKE_ARGS environment variable. Additionally, a new .gitignore file is created to exclude venv and .venv directories from version control.

Changes

File(s) Summary
.github/workflows/build.yml Added commands to append options for dynamic libraries to MACOS_CMAKE_ARGS and output the updated variable to the GitHub environment file.
.gitignore New file created to ignore venv and .venv directories.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as GitHub Actions Runner
    participant Workflow as Build Workflow
    participant Shell as Shell Command Executor

    Runner->>Workflow: Start build process
    Workflow->>Workflow: Read configuration and environment variables
    Workflow->>Shell: Execute "Update homebrew" step
    Shell-->>Workflow: Append options to MACOS_CMAKE_ARGS
    Workflow->>Shell: Output updated MACOS_CMAKE_ARGS
    Shell-->>Workflow: Confirm output to environment file
    Workflow->>Runner: Continue build process
Loading

Possibly related PRs

  • Update build.yml to fix macOs build #46: The changes in the main PR to the .github/workflows/build.yml file, which involve appending options to the MACOS_CMAKE_ARGS environment variable, are related to the modifications in the retrieved PR that also affect the same file regarding build configurations for macOS.

Poem

I’m a little rabbit, clever and bright,
Hopping through YAML in the moonlit night.
With CMake flags and compilers anew,
I dance through workflows with a joyful “boo!”
My code hops high, streamlined and light – a true delight! 🐇✨


📜 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 d6d60c2 and ecb8313.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (1 hunks)
  • .gitignore (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .gitignore
  • .github/workflows/build.yml
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: build (8, windows)
  • GitHub Check: build (9, windows)
  • GitHub Check: build (10, windows)
  • GitHub Check: build (12, linux)
  • GitHub Check: build (11, windows)
  • GitHub Check: build (12, windows)
  • GitHub Check: build (12.0.1, windows)
  • GitHub Check: build (13, windows)
  • GitHub Check: build (16, windows)
  • GitHub Check: build (15, windows)
  • GitHub Check: build (13, macosx)
  • GitHub Check: build (14, windows)
  • GitHub Check: build (15, macosx)
  • GitHub Check: build (18, windows)
  • GitHub Check: build (16, macosx)
  • GitHub Check: build (17, windows)
  • GitHub Check: build (19, windows)
  • GitHub Check: build (19, macosx)
  • GitHub Check: build (20, macosx)
  • GitHub Check: build (20, windows)

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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
Contributor

@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 UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 227e64e and 4349692.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (1 hunks)
  • .gitignore (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: build (9, macosx)
  • GitHub Check: build (12.0.1, macosx)
  • GitHub Check: build (10, windows)
  • GitHub Check: build (12.0.1, windows)
  • GitHub Check: build (12, windows)
  • GitHub Check: build (14, macosx)
  • GitHub Check: build (13, macosx)
  • GitHub Check: build (13, windows)
  • GitHub Check: build (14, windows)
  • GitHub Check: build (15, windows)
  • GitHub Check: build (18, windows)
  • GitHub Check: build (16, windows)
  • GitHub Check: build (19, windows)
  • GitHub Check: build (20, windows)
🔇 Additional comments (3)
.gitignore (1)

1-2: Ensure Virtual Environments Are Ignored

The new .gitignore file correctly specifies both venv and .venv, which will help keep local virtual environment directories out of version control.

.github/workflows/build.yml (2)

83-85: Improved Readability for COMMON_CMAKE_ARGS

The use of YAML’s multiline (>) syntax for COMMON_CMAKE_ARGS improves clarity and maintainability by clearly laying out the CMake arguments.


86-89: Clear Definition for LINUX_CMAKE_ARGS

Defining LINUX_CMAKE_ARGS with the updated compiler versions (g++-10 and gcc-10) is clear and aligns with the updated build configuration. The formatted multiline style enhances readability.

Comment on lines 93 to 100
- name: Set MACOS_CMAKE_ARGS
if: runner.os == 'macOS'
run: |
if [ "${{ matrix.clang-version }}" -gt 18 ]; then
echo "MACOS_CMAKE_ARGS=-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_C_COMPILER=gcc-11 -DZSTD_STATIC_LINKING_ONLY=1 -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DCLANG_LINK_CLANG_DYLIB=ON" >> $GITHUB_ENV
else
echo "MACOS_CMAKE_ARGS=-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_C_COMPILER=gcc-11 -DZSTD_STATIC_LINKING_ONLY=1 -DLLVM_ENABLE_ASSERTIONS=OFF" >> $GITHUB_ENV
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

Verify Numeric Comparison in MACOS_CMAKE_ARGS Step

The new “Set MACOS_CMAKE_ARGS” step is a great addition for customizing macOS builds based on the Clang version. However, the condition:

if [ "${{ matrix.clang-version }}" -gt 18 ]; then

relies on a numeric comparison that might fail if matrix.clang-version contains non-integer values (e.g., "12.0.1"). To avoid potential errors, consider extracting the major version or using a more robust version comparison. For example:

-        if [ "${{ matrix.clang-version }}" -gt 18 ]; then
+        if [ "$(echo ${{ matrix.clang-version }} | cut -d. -f1)" -gt 18 ]; then

This change ensures you are comparing only the major version.


Below is a shell script to verify if the current version of the workflow file already implements the suggested major-version extraction:

#!/bin/bash
echo "Searching for major version extraction (cut -d. -f1) in .github/workflows/build.yml..."
grep "cut -d. -f1" .github/workflows/build.yml || echo "Major version extraction not found"

Once you run this, if the output indicates that the extraction isn’t applied, please update the numeric comparison as follows:

Attention: Update Required for MACOS_CMAKE_ARGS Numeric Comparison!

  • The step currently compares the full matrix.clang-version value using -gt 18, which may fail if that value contains non-integer components (e.g., "12.0.1").
  • Update the condition to extract only the major version before the comparison, for example:
-        if [ "${{ matrix.clang-version }}" -gt 18 ]; then
+        if [ "$(echo ${{ matrix.clang-version }} | cut -d. -f1)" -gt 18 ]; then

This change ensures that only the major version number is compared, avoiding potential numeric errors.

@shenxianpeng shenxianpeng force-pushed the fix-macos-test-failure branch from 4349692 to d6d60c2 Compare April 6, 2025 16:52
@shenxianpeng shenxianpeng force-pushed the fix-macos-test-failure branch from d6d60c2 to e76454b Compare April 6, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant