Skip to content

Conversation

@leet4tari
Copy link
Contributor

@leet4tari leet4tari commented May 21, 2025

Description
Fix windows build with rust 1.87.0 - linking with advapi32lib.
Add and update CI for native and new target builds for testing

Motivation and Context
Fix windows builds

How Has This Been Tested?
Builds all needed platforms

Summary by CodeRabbit

  • New Features

    • Added support for linking against the "advapi32" system library on Windows targets.
    • Updated build system to use the cmake crate, reducing hard-coded dependencies.
  • Chores

    • Expanded and updated CI build and test environments, including new Windows and Linux configurations and improved cache key scoping.
    • Updated Rust toolchain configuration to include rustfmt and clippy components.
    • Added the thiserror dependency.
  • Documentation

    • Updated changelog with new release entries for recent features and Windows build support.
  • Refactor

    • Bumped version to 1.4.0.

…lib. Add and update CI for native and new target builds for testing
@coderabbitai
Copy link

coderabbitai bot commented May 21, 2025

Walkthrough

The updates adjust CI workflow configurations, cache key scoping, and platform support in build scripts. The changelog and Cargo manifest are updated for a new release and a new dependency. The build script now links an additional system library on Windows, and the Rust toolchain configuration ensures formatting and linting tools are installed.

Changes

File(s) Change Summary
.github/workflows/build_tests.json Updated build/test environments: changed OS and Rust versions, adjusted cross-compilation flags, added new Windows targets, and modified Android riscv64 Rust version.
.github/workflows/build_tests.yml Updated cargo cache key to include runner environment, build target, and build name for more specific cache scoping.
CHANGELOG.md Added entries for versions 1.4.0 and 1.3.2, describing new features and platform support.
Cargo.toml Bumped version to 1.4.0, updated thiserror dependency version, and added [profile.release] section with lto = false.
build.rs Added conditional linking of the "advapi32" system library for Windows targets.
rust-toolchain.toml Specified installation of rustfmt and clippy components with the stable Rust toolchain.

Sequence Diagram(s)

sequenceDiagram
    participant CI as CI Workflow
    participant Runner as Build Runner
    participant Script as build.rs
    participant System as System Libraries

    CI->>Runner: Start build (with matrix: OS, Rust, etc.)
    Runner->>Script: Run build.rs
    Script->>Script: Check target OS
    alt If Windows
        Script->>System: Link advapi32 library
    end
    Script->>System: Link C++ runtime
    Runner->>CI: Report build result
Loading

Poem

In the warren where the builds all run,
New targets hop beneath the sun.
Rustfmt and clippy join the show,
With advapi32 linked below.
A changelog sprout, a version hop—
This bunny’s code just won’t stop!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 6d16d99 and f49cc2e.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • Cargo.toml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

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

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

SWvheerden
SWvheerden previously approved these changes May 21, 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: 4

🧹 Nitpick comments (5)
Cargo.toml (1)

20-21: Consider updating thiserror to a newer version

While adding thiserror is a good choice for error handling, the specified version (1.0.30) is relatively old. The latest version offers improved performance and additional features.

-thiserror = "1.0.30"
+thiserror = "1.0.50"
CHANGELOG.md (3)

5-9: Future date in changelog

The release date for version 1.4.0 is set to 2025-05-21, which is in the future. Consider updating this to the current date or the planned release date.

-## [1.4.0](https://github.com/tari-project/randomx-rs/compare/v1.3.2...v1.4.0) (2025-05-21)
+## [1.4.0](https://github.com/tari-project/randomx-rs/compare/v1.3.2...v1.4.0) (2023-05-21)
🧰 Tools
🪛 LanguageTool

[uncategorized] ~8-~8: This word is normally spelled with a hyphen.
Context: ... switch to cmake crate and support less hard coded build system ## [1.3.2](https://github...

(HARD_CODE_COMPOUND)


8-8: Hyphenate "hard-coded"

For better readability and correct grammar:

-* switch to cmake crate and support less hard coded build system
+* switch to cmake crate and support less hard-coded build system
🧰 Tools
🪛 LanguageTool

[uncategorized] ~8-~8: This word is normally spelled with a hyphen.
Context: ... switch to cmake crate and support less hard coded build system ## [1.3.2](https://github...

(HARD_CODE_COMPOUND)


10-13: Future date in changelog

Similarly, the release date for version 1.3.2 is set to 2024-11-13, which is in the future. Consider updating this to an appropriate date.

-## [1.3.2](https://github.com/tari-project/randomx-rs/compare/v1.3.1...v1.3.2) (2024-11-13)
+## [1.3.2](https://github.com/tari-project/randomx-rs/compare/v1.3.1...v1.3.2) (2023-11-13)
.github/workflows/build_tests.json (1)

128-128: Avoid unpinned nightly toolchain
Using "rust": "nightly" without a date may introduce non-reproducible failures. Consider pinning to a specific nightly version or managing the toolchain via a rust-toolchain file.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between a748f94 and 3e3181b.

📒 Files selected for processing (6)
  • .github/workflows/build_tests.json (3 hunks)
  • .github/workflows/build_tests.yml (1 hunks)
  • CHANGELOG.md (1 hunks)
  • Cargo.toml (2 hunks)
  • build.rs (1 hunks)
  • rust-toolchain.toml (1 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md

[uncategorized] ~8-~8: This word is normally spelled with a hyphen.
Context: ... switch to cmake crate and support less hard coded build system ## [1.3.2](https://github...

(HARD_CODE_COMPOUND)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: machete
🔇 Additional comments (5)
rust-toolchain.toml (1)

5-5: Good addition of required Rust components

Adding rustfmt and clippy components is a good practice to ensure consistent code formatting and linting across all environments. This aligns well with CI improvements mentioned in the PR objectives.

Cargo.toml (1)

9-9: Version update corresponds with changelog

The version bump from 1.3.2 to 1.4.0 aligns with the new release noted in the changelog that introduces the cmake crate build system.

build.rs (1)

41-44: Windows build fix is properly implemented

Adding the advapi32 library link for Windows targets addresses the PR's main objective of fixing Windows builds with Rust 1.87.0. This is a common requirement for Windows cryptography support.

Consider adding a brief comment explaining why advapi32 is specifically needed for Rust 1.87.0 on Windows:

 if cfg!(target_os = "windows") {
+    // Required for Windows cryptography APIs, needed explicitly since Rust 1.87.0
     println!("cargo:rustc-link-lib=advapi32");
 }
.github/workflows/build_tests.yml (1)

156-156: Cache key now scoped by runner, target, and job
Including ${{ matrix.builds.runs-on }} and ${{ matrix.builds.name }} in the cache key isolates caches per OS and build variant, reducing cross-environment collisions.

.github/workflows/build_tests.json (1)

4-5: Upgrade Linux x86_64 environment to Ubuntu 22.04 and stable Rust
Switching from an older image and nightly toolchain to ubuntu-22.04 with rust = stable simplifies maintenance and leverages an LTS release.

@SWvheerden SWvheerden merged commit 8d506ca into tari-project:development May 21, 2025
8 checks passed
@leet4tari leet4tari deleted the build-ci-leet-cmake-crate branch May 21, 2025 14:37
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.

2 participants