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

Use Zig for Windows and ARM64 Linux #1713

Merged
merged 5 commits into from
Jan 10, 2025
Merged

Use Zig for Windows and ARM64 Linux #1713

merged 5 commits into from
Jan 10, 2025

Conversation

esimkowitz
Copy link
Member

@esimkowitz esimkowitz commented Jan 10, 2025

I'm making steps to simplify our build dependencies, consolidating our C compiler requirements so we only depend on Zig.

Before, we used Zig for x64 but not for arm64. This meant that users using an ARM dev machine would need to install build-essentials and Zig. We also required MinGW-w64 on Windows, which is a pain to install since it can be provided by a bunch of different tools, the smallest of which is like a 2GB install.

Copy link
Contributor

coderabbitai bot commented Jan 10, 2025

Walkthrough

The pull request modifies the Taskfile.yml, specifically updating the GO_ENV_VARS variable within the build:server:linux and build:server:windows tasks. A new GO_ENV_VARS variable is introduced for the build:server:windows task, setting the CC variable to use the zig cc command with architecture-specific targets. The build:server:linux task's GO_ENV_VARS variable is updated to include an "else" clause, allowing it to set the CC variable to zig cc targeting aarch64-linux-gnu.2.28 for non-amd64 architectures. Changes in the .github/workflows/build-helper.yml file simplify the Zig installation process for Linux by removing the --beta flag and introducing a new step for installing Zig using the mlugg/setup-zig@v1 action for all platforms except macOS. The BUILD.md file is updated to specify the requirement for the Zig compiler on Windows and provides installation instructions.


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

🧹 Nitpick comments (1)
Taskfile.yml (1)

165-165: Consider handling other architectures explicitly.

The current implementation assumes all non-AMD64 architectures should use the ARM64 target. While this works for the immediate use case, it might cause issues if other architectures need to be supported in the future.

Consider using explicit architecture checks:

-                      sh: echo "{{if eq "amd64" ARCH}}CC=\"zig cc -target x86_64-linux-gnu.2.28\"{{else}}CC=\"zig cc -target aarch64-linux-gnu.2.28\"{{end}}"
+                      sh: echo "{{if eq "amd64" ARCH}}CC=\"zig cc -target x86_64-linux-gnu.2.28\"{{else if eq "arm64" ARCH}}CC=\"zig cc -target aarch64-linux-gnu.2.28\"{{else}}CC=\"gcc\"{{end}}"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e3809af and e9cb25a.

📒 Files selected for processing (1)
  • Taskfile.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: build-app (windows, windows-latest)
  • GitHub Check: build-app (linux, ubuntu-24.04-arm64-16core)
  • GitHub Check: build-app (linux, ubuntu-latest)
  • GitHub Check: build-app (darwin, macos-latest)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Build Docsite
  • GitHub Check: Build for TestDriver.ai
  • GitHub Check: Analyze (go)
  • GitHub Check: merge-gatekeeper
🔇 Additional comments (1)
Taskfile.yml (1)

165-165: LGTM! Verify ARM64 builds work as expected.

The change correctly extends Zig compiler support to ARM64 Linux builds, maintaining consistency with the existing x64 builds. This simplifies the setup by eliminating the need for build-essentials.

Run the following script to verify ARM64 builds:

✅ Verification successful

Verified: ARM64 Zig target configuration is correct

The aarch64-linux-gnu.2.28 target string follows the correct format and aligns with:

  • Documented platform support for Linux ARM64 in README.md
  • Required glibc-2.28 baseline for Linux builds
  • Existing build system patterns for multi-architecture support
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the Zig compiler is correctly configured for ARM64 builds

# Test 1: Check if Zig supports the target
zig targets | grep 'aarch64-linux-gnu.2.28'

# Test 2: Check if there are any existing ARM64 builds that we can compare against
fd -t f 'wavesrv.*arm64' dist/bin/

Length of output: 271


Script:

#!/bin/bash
# Search for ARM64/aarch64 related configurations and documentation
echo "=== Searching for ARM64/aarch64 configurations ==="
rg -i "aarch64|arm64" --type yaml --type md

echo -e "\n=== Checking for build documentation ==="
fd -e md -e txt . -x grep -l -i "build|zig" {}

echo -e "\n=== Looking for CI configurations ==="
fd -g ".github/workflows/*.yml" .
fd -g "*ci*.yml" .

Length of output: 2086

@esimkowitz esimkowitz changed the title Use Zig for ARM64 Linux builds Use Zig for Windows and ARM64 Linux Jan 10, 2025
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: 0

🧹 Nitpick comments (1)
.github/workflows/build-helper.yml (1)

41-43: Consider adding Zig version input for better control.

The action supports specifying a Zig version, which would be beneficial for ensuring consistent builds across all platforms.

             if: matrix.platform != 'darwin'
-              uses: mlugg/setup-zig@v1
+              uses: mlugg/setup-zig@v1.2.0
+              with:
+                version: 0.11.0
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7d23672 and 4b98662.

📒 Files selected for processing (3)
  • .github/workflows/build-helper.yml (1 hunks)
  • .github/workflows/testdriver-build.yml (1 hunks)
  • BUILD.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • BUILD.md
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Build for TestDriver.ai
  • GitHub Check: Analyze (go)
  • GitHub Check: merge-gatekeeper
  • GitHub Check: Build Docsite
🔇 Additional comments (3)
.github/workflows/testdriver-build.yml (1)

60-61: 🛠️ Refactor suggestion

Pin the Zig setup action version for stability.

While adding Zig installation is good, the action version should be pinned for reproducible builds.

-              uses: mlugg/setup-zig@v1
+              uses: mlugg/setup-zig@v1.2.0

Let's verify if this action supports Windows builds:

✅ Verification successful

Pin the Zig setup action version for stability - Windows compatibility verified

The action supports Windows builds as evidenced by Windows-specific discussions in the project issues. The version pinning recommendation remains valid for build stability.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the action supports Windows
curl -s https://raw.githubusercontent.com/mlugg/setup-zig/v1/action.yml | grep -A 5 "runs-on:"

Length of output: 94


Script:

#!/bin/bash
# Try multiple approaches to verify Windows support

# Check action.yml from main branch
curl -s https://raw.githubusercontent.com/mlugg/setup-zig/main/action.yml

# Search for Windows-related issues or discussions
gh api repos/mlugg/setup-zig/issues?state=all | jq -r '.[] | select(.title | test("(?i)windows")) | "Issue #\(.number): \(.title)"'

# Check if this repository has other Windows workflows using this action
fd -e yml -e yaml . .github/workflows/ --exec grep -l "mlugg/setup-zig"

Length of output: 1121

.github/workflows/build-helper.yml (2)

Line range hint 24-26: Consider enabling Windows ARM64 builds.

Since this PR aims to improve ARM64 support and simplify Windows builds using Zig, it might be worth uncommenting and testing the Windows ARM64 configuration.

Let's check if there are any related discussions or issues:


41-43: 🛠️ Refactor suggestion

Ensure consistent Zig setup across workflows.

The Zig installation step should:

  1. Use a pinned version for stability
  2. Be verified for ARM64 compatibility
-              uses: mlugg/setup-zig@v1
+              uses: mlugg/setup-zig@v1.2.0

Let's verify ARM64 compatibility:

✅ Verification successful

Version pinning recommended, ARM64 compatibility verified

The action fully supports ARM64 platforms. Recommend pinning to v1.2.0 for stability:

-              uses: mlugg/setup-zig@v1
+              uses: mlugg/setup-zig@v1.2.0
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the action supports ARM64
curl -s https://raw.githubusercontent.com/mlugg/setup-zig/v1/action.yml | grep -A 10 "inputs:"

# Verify if there are any known issues with ARM64
gh api graphql -f query='
{
  repository(owner: "mlugg", name: "setup-zig") {
    issues(first: 5, states: OPEN) {
      nodes {
        title
        body
        labels(first: 5) {
          nodes {
            name
          }
        }
      }
    }
  }
}'

Length of output: 7720

@esimkowitz esimkowitz merged commit db3de47 into main Jan 10, 2025
15 checks passed
@esimkowitz esimkowitz deleted the evan/linux-arm-zig branch January 10, 2025 23:23
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