Skip to content

fix: resolve getrandom v0.2.16 compilation issues in CI/CD#204

Merged
AnthonyRonning merged 2 commits intomasterfrom
fix-getrandom-build-issue
Aug 19, 2025
Merged

fix: resolve getrandom v0.2.16 compilation issues in CI/CD#204
AnthonyRonning merged 2 commits intomasterfrom
fix-getrandom-build-issue

Conversation

@AnthonyRonning
Copy link
Copy Markdown
Contributor

@AnthonyRonning AnthonyRonning commented Aug 19, 2025

  • Update Rust to 1.85.0 in flake.nix to support edition2024 feature
  • Add CARGO_CFG_TARGET_OS workaround for getrandom compilation:
    • Set to 'darwin' for iOS builds on macOS runners
    • Set to 'linux' for Linux builds
  • Fixes build failures related to getrandom crate platform detection

This addresses the issue where getrandom v0.2.16 fails to correctly detect the target platform, causing multiple module definition errors. See: rust-random/getrandom#641

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Standardized CI build pipelines to set the appropriate target OS during Tauri CLI installation across desktop, mobile, and TestFlight workflows, improving cross‑platform build consistency and reducing install failures.
    • Upgraded the development Rust toolchain to 1.85.0, enhancing stability, performance, and compatibility for local and CI builds.

- Update Rust to 1.85.0 in flake.nix to support edition2024 feature
- Add CARGO_CFG_TARGET_OS workaround for getrandom compilation:
  - Set to 'darwin' for iOS builds on macOS runners
  - Set to 'linux' for Linux builds
- Fixes build failures related to getrandom crate platform detection

This addresses the issue where getrandom v0.2.16 fails to correctly
detect the target platform, causing multiple module definition errors.
See: rust-random/getrandom#641

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Aug 19, 2025

Deploying maple with  Cloudflare Pages  Cloudflare Pages

Latest commit: ac164a6
Status: ✅  Deploy successful!
Preview URL: https://09d68eca.maple-ca8.pages.dev
Branch Preview URL: https://fix-getrandom-build-issue.maple-ca8.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR addresses a critical build failure affecting the project's CI/CD pipelines by resolving compilation issues with the getrandom v0.2.16 crate. The changes include two key components:

Rust Version Update: The Rust toolchain is upgraded from 1.78.0 to 1.85.0 in flake.nix, a significant jump of 7 minor versions that adds support for the edition2024 feature and improves compatibility with problematic dependencies.

Platform Detection Workarounds: The PR systematically adds CARGO_CFG_TARGET_OS environment variables across all CI workflow files that install the Tauri CLI:

  • desktop-build.yml: Sets to 'linux' for Ubuntu runners
  • mobile-build.yml: Sets to 'darwin' for iOS builds on macOS runners
  • testflight-on-comment.yml: Sets to 'darwin' for macOS-based TestFlight deployments
  • claude.yml: Sets to 'linux' for Linux-based builds

The changes target a known upstream issue where getrandom v0.2.16 fails to correctly detect the target platform during cross-compilation scenarios, leading to "multiple module definition errors" that break builds. By explicitly providing platform hints through the CARGO_CFG_TARGET_OS environment variable during cargo installation steps, the workaround helps the getrandom crate understand the target environment.

This fix integrates seamlessly with the existing CI/CD infrastructure without requiring dependency downgrades or major architectural changes. The approach is surgical, only affecting the specific build steps where Tauri CLI installation occurs, and maintains consistency across different target platforms (Darwin for macOS/iOS, Linux for Ubuntu runners).

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it addresses a well-documented upstream issue with a proven workaround
  • Score reflects targeted fixes for a specific known issue with clear upstream documentation and consistent implementation across workflows
  • No files require special attention as the changes are surgical and address a specific compilation problem

5 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 19, 2025

Walkthrough

Adds CARGO_CFG_TARGET_OS environment variables to the "Install Tauri CLI" steps across multiple GitHub Actions workflows (setting linux for Linux runners and macos for macOS runners). Also bumps the flake.nix Rust toolchain from stable 1.78.0 to stable 1.85.0. No other workflow logic or public APIs changed.

Changes

Cohort / File(s) Summary
Workflow env updates: Tauri CLI install
.github/workflows/claude.yml, .github/workflows/desktop-build.yml, .github/workflows/mobile-build.yml, .github/workflows/testflight-on-comment.yml
Add CARGO_CFG_TARGET_OS to the "Install Tauri CLI" step: set to linux for Linux runners (claude.yml, desktop-build.yml) and to macos for macOS runners (mobile-build.yml, testflight-on-comment.yml). Install command itself unchanged.
Rust toolchain bump
flake.nix
Update rustToolchain from stable 1.78.0 to stable 1.85.0; devShell and other settings unchanged.

Sequence Diagram(s)

sequenceDiagram
  actor Runner as GitHub Runner
  participant Step as "Install Tauri CLI" step
  participant Cargo as cargo

  Runner->>Step: start
  Note right of Step: env CARGO_CFG_TARGET_OS=<linux|macos>
  Step->>Cargo: CARGO_CFG_TARGET_OS=... cargo install tauri-cli
  Cargo-->>Step: install result
  Step-->>Runner: step complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Auto updater #42 — Changes the same rustToolchain variable in flake.nix; likely overlaps with the toolchain bump here.

Poem

A rabbit taps keys in morning light,
I set the OS flag so builds run right.
Rust hops up to 1.85 with cheer,
CI hums softly, carrots near. 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3ef7163 and ac164a6.

📒 Files selected for processing (2)
  • .github/workflows/mobile-build.yml (1 hunks)
  • .github/workflows/testflight-on-comment.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/mobile-build.yml
  • .github/workflows/testflight-on-comment.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-ios
  • GitHub Check: build-macos (universal-apple-darwin)
  • GitHub Check: build-linux
  • GitHub Check: browseruse-tests
  • GitHub Check: Cloudflare Pages
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-getrandom-build-issue

🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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
Copy Markdown

@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

🧹 Nitpick comments (1)
flake.nix (1)

19-21: LGTM: Rust toolchain bumped to 1.85.0

This aligns with the need for Edition 2024 support.

To avoid drift between devShell (Nix) and CI, consider pinning GitHub Actions to the same Rust version. For example, in your Install Rust steps:

- name: Install Rust
  uses: dtolnay/rust-toolchain@stable
  with:
    toolchain: 1.85.0
    targets: aarch64-apple-ios # or other targets already present in each workflow

If you’d like, I can prepare a follow-up PR to pin these across all workflows.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 15bafcd and 3ef7163.

📒 Files selected for processing (5)
  • .github/workflows/claude.yml (1 hunks)
  • .github/workflows/desktop-build.yml (1 hunks)
  • .github/workflows/mobile-build.yml (1 hunks)
  • .github/workflows/testflight-on-comment.yml (1 hunks)
  • flake.nix (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-ios
  • GitHub Check: build-linux
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
.github/workflows/desktop-build.yml (1)

130-131: LGTM: Correct OS override for Linux host install

Setting CARGO_CFG_TARGET_OS=linux for the cargo install step matches the host OS on ubuntu-latest and aligns with the getrandom workaround.

.github/workflows/testflight-on-comment.yml (1)

104-105: Use ‘macos’ for the host override & verify iOS build

In the “Install Tauri CLI” step, replace the current darwin override with macos (Rust’s target_os for macOS hosts), and include the workaround comment:

         env:
-          CARGO_CFG_TARGET_OS: darwin
+          # Workaround for getrandom v0.2.16 (https://github.com/rust-random/getrandom/issues/641)
+          # cargo install builds for the host; on macOS runners target_os is "macos"
+          CARGO_CFG_TARGET_OS: macos

Note that the “Build Tauri iOS App” job does not set CARGO_CFG_TARGET_OS. If you see failures there, add:

    env:
      CARGO_CFG_TARGET_OS: ios

Please confirm whether the iOS build passes without that additional override.

.github/workflows/claude.yml (1)

113-113: LGTM: Correct Linux override for host install

Using CARGO_CFG_TARGET_OS=linux when installing tauri-cli on ubuntu-latest is appropriate and consistent with the workaround.

Comment thread .github/workflows/mobile-build.yml Outdated
CodeRabbit correctly pointed out that Rust's cfg(target_os) uses 'macos'
for macOS, not 'darwin'. Since cargo install builds tauri-cli for the
host OS (macOS runners), we need to use 'macos'.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

Note: This review covers only the changes made since the last review (commit 3ef7163), not the entire PR.

The recent changes implement the corrections identified in the previous review regarding the CARGO_CFG_TARGET_OS environment variable. The developer has updated two workflow files:

  1. mobile-build.yml: Changed CARGO_CFG_TARGET_OS from 'darwin' to 'macos' in the Tauri CLI installation step
  2. testflight-on-comment.yml: Applied the same correction, changing the value from 'darwin' to 'macos'

Both changes include proper documentation comments explaining this is a workaround for getrandom v0.2.16 compilation issues and clarifying that cargo install builds for the host platform, where macOS runners use 'macos' as the target_os identifier.

These changes are part of the broader effort to resolve build failures caused by the getrandom crate's platform detection issues. The corrections ensure that when Tauri CLI is installed via cargo install on macOS GitHub Actions runners, the getrandom crate and its dependencies can properly identify the platform and compile successfully. The changes maintain consistency with Rust's canonical cfg(target_os) values, where 'macos' is the correct identifier for macOS systems, not 'darwin'.

Confidence score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects straightforward environment variable corrections that address a well-documented upstream issue
  • No files require special attention as the changes are simple and well-documented

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@AnthonyRonning
Copy link
Copy Markdown
Contributor Author

@TestFlight build

@github-actions
Copy link
Copy Markdown
Contributor

🚀 TestFlight deployment triggered! Check the Actions tab for progress.

@github-actions
Copy link
Copy Markdown
Contributor

✅ TestFlight deployment completed successfully!

@AnthonyRonning AnthonyRonning merged commit e46a3a0 into master Aug 19, 2025
7 checks passed
@AnthonyRonning AnthonyRonning deleted the fix-getrandom-build-issue branch August 19, 2025 21:06
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