Skip to content

Update setup-rust action with cross toolchain options#29

Merged
leynos merged 5 commits intomainfrom
codex/add-macos-and-openbsd-toolchain-options
Jul 24, 2025
Merged

Update setup-rust action with cross toolchain options#29
leynos merged 5 commits intomainfrom
codex/add-macos-and-openbsd-toolchain-options

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jul 22, 2025

Summary

  • add with-darwin and with-openbsd inputs
  • install osxcross on Linux when with-darwin is enabled
  • build and install OpenBSD stdlib behind with-openbsd
  • document new options in README
  • record changes in changelog

Testing

  • pytest -q

https://chatgpt.com/codex/tasks/task_e_687f39fefe248322867d8dbe54a81cb9

Summary by Sourcery

Enable macOS and OpenBSD cross-compilation support in the setup-rust action by introducing new inputs and implementing corresponding toolchain installation, build, and caching steps

New Features:

  • Add with-darwin and darwin-sdk-version inputs to enable macOS cross-compilation with osxcross and install Apple targets
  • Add with-openbsd input to build, cache, and add the OpenBSD standard library and x86_64-unknown-openbsd Rust target

Enhancements:

  • Cache OpenBSD standard library builds and only rebuild on cache miss
  • Scope cross-compilation steps to Linux runners
  • Quote boolean defaults in action.yml to prevent type mismatches

Documentation:

  • Document new with-darwin, darwin-sdk-version, and with-openbsd options in the README

Chores:

  • Update changelog with entries for new cross-compilation features and version bumps

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jul 22, 2025

Reviewer's Guide

Extend the composite setup-rust GitHub Action by adding with-darwin and with-openbsd inputs for cross-compilation. On Linux runners, the action now conditionally installs osxcross and Apple Darwin targets for macOS cross builds, and installs a nightly toolchain to build and cache the OpenBSD standard library before adding the OpenBSD target. Documentation and the changelog are updated to reflect these new options.

Class diagram for updated setup-rust action inputs

classDiagram
    class SetupRustAction {
        +install-postgres-deps: bool
        +install-sqlite-deps: bool
        +use-sccache: bool
        +sccache-action-version: string
        +with-darwin: bool
        +darwin-sdk-version: string
        +with-openbsd: bool
        +BUILD_PROFILE: string
    }
Loading

Flow diagram for cross-compilation setup in setup-rust action

flowchart TD
    Start([Start])
    CheckDarwin{with-darwin == true\nand runner.os == Linux}
    SetupOsxCross[Install osxcross]
    AddDarwinTargets[Install Rust macOS targets]
    CheckOpenBSD{with-openbsd == true\nand runner.os == Linux}
    InstallNightly[Install nightly toolchain]
    CacheOpenBSDStdlib[Cache OpenBSD stdlib]
    BuildOpenBSDStdlib[Clone Rust repo & build OpenBSD std]
    AddOpenBSDTarget[Add OpenBSD target]
    End([End])

    Start --> CheckDarwin
    CheckDarwin -- Yes --> SetupOsxCross
    SetupOsxCross --> AddDarwinTargets
    AddDarwinTargets --> CheckOpenBSD
    CheckDarwin -- No --> CheckOpenBSD
    CheckOpenBSD -- Yes --> InstallNightly
    InstallNightly --> CacheOpenBSDStdlib
    CacheOpenBSDStdlib -- Cache Miss --> BuildOpenBSDStdlib
    BuildOpenBSDStdlib --> AddOpenBSDTarget
    CacheOpenBSDStdlib -- Cache Hit --> AddOpenBSDTarget
    AddOpenBSDTarget --> End
    CheckOpenBSD -- No --> End
Loading

File-Level Changes

Change Details Files
Introduce with-darwin inputs and macOS cross-compilation steps
  • Add with-darwin and darwin-sdk-version inputs to action.yml
  • Conditionally set up osxcross with the specified SDK version on Linux
  • Add x86_64-apple-darwin and aarch64-apple-darwin Rust targets when enabled
.github/actions/setup-rust/action.yml
Introduce with-openbsd inputs and OpenBSD std library build
  • Add with-openbsd input and nightly toolchain install step
  • Cache OpenBSD stdlib and clone/build Rust std library on cache miss
  • Install the x86_64-unknown-openbsd target via nightly
.github/actions/setup-rust/action.yml
Update documentation for new cross-compilation options
  • Add with-darwin, darwin-sdk-version, and with-openbsd to README input table
  • Describe macOS osxcross setup and OpenBSD std build usage in README examples
.github/actions/setup-rust/README.md
Record new features in CHANGELOG
  • Add entries for v1.0.5 with darwin and openbsd inputs
  • Update subsequent version headings and notes for caching and SDK configuration
.github/actions/setup-rust/CHANGELOG.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 22, 2025

Warning

Rate limit exceeded

@leynos has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 58 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 40bb32b and 22f2b1e.

📒 Files selected for processing (3)
  • .github/actions/setup-rust/CHANGELOG.md (2 hunks)
  • .github/actions/setup-rust/README.md (4 hunks)
  • .github/actions/setup-rust/action.yml (2 hunks)

Summary by CodeRabbit

  • New Features

    • Added support for cross-compiling Rust projects to macOS and OpenBSD targets on Linux runners.
    • Introduced new inputs to enable macOS toolchain installation and specify macOS SDK version.
    • Added input to build and cache the OpenBSD standard library for cross-compilation.
  • Documentation

    • Updated usage instructions and examples to reflect new cross-compilation options for macOS and OpenBSD.
  • Chores

    • Adjusted default values for some input parameters for consistency.
    • Extended and reorganised the changelog with recent updates.

Walkthrough

Expand the .github/actions/setup-rust GitHub Action to support cross-compilation for macOS and OpenBSD targets on Linux runners. Add two new boolean inputs, with-darwin and with-openbsd, and update the documentation and changelog to reflect these new capabilities.

Changes

File(s) Change Summary
.github/actions/setup-rust/CHANGELOG.md Add changelog entries for v1.0.6 to v1.0.8 covering OpenBSD stdlib caching and build path update, macOS SDK version input, and boolean quoting fixes.
.github/actions/setup-rust/README.md Document new inputs with-darwin, darwin-sdk-version, and with-openbsd with usage examples and expanded explanations.
.github/actions/setup-rust/action.yml Add inputs with-darwin, darwin-sdk-version, and with-openbsd; implement macOS cross build toolchain setup and OpenBSD stdlib build with caching; quote boolean defaults as strings.

Sequence Diagram(s)

sequenceDiagram
    participant UserWorkflow as GitHub Workflow
    participant SetupRust as setup-rust Action
    participant OSXCross as osxcross Action
    participant RustRepo as Rust Source Repo

    UserWorkflow->>SetupRust: Run setup-rust with inputs
    alt with-darwin == true and runner == Linux
        SetupRust->>OSXCross: Setup macOS cross toolchain (osxcross)
    end
    alt with-openbsd == true and runner == Linux
        SetupRust->>RustRepo: Clone Rust repository
        SetupRust->>RustRepo: Build OpenBSD stdlib with x.py
        SetupRust->>SetupRust: Copy stdlib to rustup toolchain
    end
    alt with-openbsd == true
        SetupRust->>SetupRust: rustup target add x86_64-unknown-openbsd
    end
    SetupRust-->>UserWorkflow: Rust toolchain ready for cross-compilation
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

  • Pin nightly toolchain mxd#146: Introduces the initial setup-rust action and pins the Rust nightly toolchain version; this PR is directly extended by the current changes.
  • Pin nightly toolchain mxd#139: Adds initial version of the setup-rust action with Rust toolchain setup and caching, laying groundwork for current cross-compilation enhancements.

Poem

Rust now builds for Mac and BSD,
With flags to cross the OS sea!
Actions enhanced, docs up to date,
Compile with confidence—celebrate!
From Linux hosts, your builds can fly,
To Darwin and OpenBSD in the sky.
🚀🦀

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/add-macos-and-openbsd-toolchain-options

🪧 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 generate unit tests to generate unit tests for 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.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @leynos - I've reviewed your changes and found some issues that need to be addressed.

  • Consider adding caching for the OpenBSD stdlib build artifacts to avoid rebuilding on every run and speed up the action.
  • Make the macOS SDK version configurable via an input instead of hardcoding '12.3' in the osxcross setup step.
  • Scope the "Add OpenBSD target" step to only run on Linux runners (runner.os == 'Linux') to prevent failures on other operating systems.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding caching for the OpenBSD stdlib build artifacts to avoid rebuilding on every run and speed up the action.
- Make the macOS SDK version configurable via an input instead of hardcoding '12.3' in the osxcross setup step.
- Scope the "Add OpenBSD target" step to only run on Linux runners (runner.os == 'Linux') to prevent failures on other operating systems.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
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: 2

🔭 Outside diff range comments (1)
.github/actions/setup-rust/README.md (1)

23-30: Fix YAML indentation in usage example
The snippet is not valid YAML; with: must be nested under the step item.

-uses: ./.github/actions/setup-rust@v1
-  with:
+  - uses: ./.github/actions/setup-rust@v1
+    with:
       install-postgres-deps: true
       install-sqlite-deps: true
       with-darwin: true
       with-openbsd: true
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 688ce00 and 908f66d.

📒 Files selected for processing (3)
  • .github/actions/setup-rust/CHANGELOG.md (1 hunks)
  • .github/actions/setup-rust/README.md (3 hunks)
  • .github/actions/setup-rust/action.yml (2 hunks)
🪛 LanguageTool
.github/actions/setup-rust/README.md

[typographical] ~47-~47: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...t crates can be cross-compiled for macOS. When with-openbsd is enabled, the ac...

(WRB_QUESTION_MARK)


[typographical] ~51-~51: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...nknown-openbsd` target becomes available. ```yaml # Bring in MSYS2 plus th...

(WRB_QUESTION_MARK)

🧰 Additional context used
🪛 LanguageTool
.github/actions/setup-rust/README.md

[typographical] ~47-~47: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...t crates can be cross-compiled for macOS. When with-openbsd is enabled, the ac...

(WRB_QUESTION_MARK)


[typographical] ~51-~51: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...nknown-openbsd` target becomes available. ```yaml # Bring in MSYS2 plus th...

(WRB_QUESTION_MARK)

🔇 Additional comments (1)
.github/actions/setup-rust/CHANGELOG.md (1)

4-8: Add trailing full stop for consistency

Keep bullet lists consistent with previous entries.

- - Install macOS cross build toolchain via `with-darwin`.
- - Build OpenBSD standard library and add target via `with-openbsd`.
+ - Install macOS cross build toolchain via `with-darwin`.
+ - Build OpenBSD standard library and add target via `with-openbsd`.

Likely an incorrect or invalid review comment.

Comment thread .github/actions/setup-rust/action.yml Outdated
Comment thread .github/actions/setup-rust/action.yml Outdated
Copy link
Copy Markdown
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: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 908f66d and 4b17a72.

📒 Files selected for processing (3)
  • .github/actions/setup-rust/CHANGELOG.md (1 hunks)
  • .github/actions/setup-rust/README.md (3 hunks)
  • .github/actions/setup-rust/action.yml (2 hunks)
🧰 Additional context used
🪛 LanguageTool
.github/actions/setup-rust/README.md

[typographical] ~48-~48: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...t crates can be cross-compiled for macOS. The SDK version can be configured via t...

(WRB_QUESTION_MARK)


[typographical] ~53-~53: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...arget is readily available on later runs. ```yaml # Bring in MSYS2 plus th...

(WRB_QUESTION_MARK)

🔇 Additional comments (3)
.github/actions/setup-rust/CHANGELOG.md (1)

4-10: Changelog entry reads clearly – good to go.
All additions follow the existing style and ordering.

.github/actions/setup-rust/README.md (1)

25-31: Example block is up-to-date – no issues spotted.
The example demonstrates the new inputs without breaking existing users.

.github/actions/setup-rust/action.yml (1)

68-72: No change: osx-version is the correct input for setup-osxcross
Official documentation confirms that osx-version is the sole parameter for mbround18/setup-osxcross. Keep the snippet as-is.

• File: .github/actions/setup-rust/action.yml (lines 68–72)

Comment thread .github/actions/setup-rust/action.yml Outdated
Comment thread .github/actions/setup-rust/action.yml
Copy link
Copy Markdown
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: 2

🔭 Outside diff range comments (1)
.github/actions/setup-rust/action.yml (1)

74-93: Ensure nightly toolchain exists before using its path.

Steps below assume ~/.rustup/toolchains/nightly is present, but the composite action never installs nightly.
Cross-compilation will fail on a cache miss.

@@
     - name: Install rust
       uses: actions-rust-lang/setup-rust-toolchain@9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9
       with:
         override: true
         components: rustfmt, clippy, llvm-tools-preview
+
+    - name: Install nightly toolchain (needed for OpenBSD cross-compilation)
+      if: ${{ inputs.with-openbsd == 'true' && runner.os == 'Linux' }}
+      run: rustup toolchain install nightly
♻️ Duplicate comments (1)
.github/actions/setup-rust/action.yml (1)

87-87: Build path still uses deprecated src/libstd.

The Rust source tree moved libstd to library/std; the old symlink may disappear.
Switch to the canonical location.

-        ./x.py build --stage 1 --target x86_64-unknown-openbsd src/libstd
+        ./x.py build --stage 1 --target x86_64-unknown-openbsd library/std
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4b17a72 and 945de96.

📒 Files selected for processing (2)
  • .github/actions/setup-rust/CHANGELOG.md (1 hunks)
  • .github/actions/setup-rust/action.yml (2 hunks)
🔇 Additional comments (1)
.github/actions/setup-rust/action.yml (1)

12-23: Quote boolean defaults – good job.

Quoting the defaults prevents YAML boolean coercion issues. No further action required.

Comment thread .github/actions/setup-rust/action.yml Outdated
Comment thread .github/actions/setup-rust/CHANGELOG.md Outdated
Copy link
Copy Markdown
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: 5

♻️ Duplicate comments (2)
.github/actions/setup-rust/CHANGELOG.md (1)

4-18: Release-date requirement satisfied – good job

The new entries now include ISO-8601 dates, addressing the earlier request.
No further action required.

.github/actions/setup-rust/action.yml (1)

71-78: Darwin targets step added – resolved

The action now installs x86_64-apple-darwin and aarch64-apple-darwin after setting up osxcross, fulfilling the prior request.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7b71b02 and 40bb32b.

📒 Files selected for processing (3)
  • .github/actions/setup-rust/CHANGELOG.md (1 hunks)
  • .github/actions/setup-rust/README.md (3 hunks)
  • .github/actions/setup-rust/action.yml (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
.github/actions/*/CHANGELOG.md

📄 CodeRabbit Inference Engine (AGENTS.md)

Each action must have a CHANGELOG.md that follows SemVer-based changelog for that action only.

Files:

  • .github/actions/setup-rust/CHANGELOG.md
.github/actions/*/README.md

📄 CodeRabbit Inference Engine (AGENTS.md)

.github/actions/*/README.md: Each action must have a README.md containing a one-liner summary, table of inputs, table of outputs, usage example with uses: ./.github/actions/<name>@<major>, and a release history link to CHANGELOG.
Add a DEPRECATED: banner to README and repository description when deprecating an action.

Files:

  • .github/actions/setup-rust/README.md
.github/actions/*/action.yml

📄 CodeRabbit Inference Engine (AGENTS.md)

.github/actions/*/action.yml: Each action must have an action.yml file containing every input and output, with required ones clearly marked.
Composite actions referencing sibling scripts must use ${{ github.action_path }} for portability.

Files:

  • .github/actions/setup-rust/action.yml
🪛 LanguageTool
.github/actions/setup-rust/CHANGELOG.md

[typographical] ~4-~4: To join two clauses or introduce examples, consider using an em dash.
Context: # Changelog ## v1.0.6 - 2025-07-24 - Cache OpenBSD standard lib...

(DASH_RULE)


[typographical] ~11-~11: To join two clauses or introduce examples, consider using an em dash.
Context: ...x README example indentation. ## v1.0.7 - 2025-07-24 - Quote boolean defaults in ...

(DASH_RULE)


[typographical] ~15-~15: To join two clauses or introduce examples, consider using an em dash.
Context: ...ml` to avoid type mismatches. ## v1.0.8 - 2025-07-24 - Build OpenBSD standard lib...

(DASH_RULE)


[typographical] ~19-~19: To join two clauses or introduce examples, consider using an em dash.
Context: ...e updated library/std path. ## v1.0.5 - 2025-07-24 - Install macOS cross build ...

(DASH_RULE)


[typographical] ~24-~24: To join two clauses or introduce examples, consider using an em dash.
Context: ...dd target via with-openbsd. ## v1.0.4 - 2025-06-21 - Optionally install SQLite ...

(DASH_RULE)


[typographical] ~29-~29: To join two clauses or introduce examples, consider using an em dash.
Context: ... install-sqlite-deps input. ## v1.0.3 - 2025-06-20 - Install PostgreSQL client ...

(DASH_RULE)


[typographical] ~33-~33: To join two clauses or introduce examples, consider using an em dash.
Context: ...es on Windows via Chocolatey. ## v1.0.2 - 2025-06-20 - Document BUILD_PROFILE e...

(DASH_RULE)


[typographical] ~37-~37: To join two clauses or introduce examples, consider using an em dash.
Context: ...riable and fix README example ## v1.0.1 - 2025-06-20 - Document caching requireme...

(DASH_RULE)


[typographical] ~41-~41: To join two clauses or introduce examples, consider using an em dash.
Context: ...larify when caches are saved. ## v1.0.0 - 2025-06-20 - Initial version.

(DASH_RULE)

.github/actions/setup-rust/README.md

[typographical] ~48-~48: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...t crates can be cross-compiled for macOS. The SDK version can be configured via t...

(WRB_QUESTION_MARK)


[typographical] ~56-~56: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...arget is readily available on later runs. ```yaml # Bring in MSYS2 plus th...

(WRB_QUESTION_MARK)

🪛 markdownlint-cli2 (0.17.2)
.github/actions/setup-rust/CHANGELOG.md

41-41: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🪛 YAMLlint (1.37.1)
.github/actions/setup-rust/action.yml

[error] 27-27: wrong indentation: expected 4 but found 6

(indentation)

🔇 Additional comments (2)
.github/actions/setup-rust/README.md (2)

3-5: Documentation extension looks sound – no action needed.

The updated one-liner correctly mentions the new cross-compiler capabilities without becoming verbose.


53-57: Pin the nightly toolchain date to avoid sudden breakage.

Nightly Rust changes frequently; an unpinned channel can silently break the OpenBSD std rebuild. Pin a date or auto-update via Renovate.

Comment thread .github/actions/setup-rust/action.yml
Comment on lines +41 to 48
## v1.0.0 - 2025-06-20
- Initial version.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Insert the missing blank line after the v1.0.0 heading

markdownlint (MD022) complains because the bullet list begins immediately after the heading. Add an empty line to keep headings surrounded by blank lines.

 ## v1.0.0 - 2025-06-20
+
 - Initial version.
📝 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
## v1.0.0 - 2025-06-20
- Initial version.
## v1.0.0 - 2025-06-20
- Initial version.
🧰 Tools
🪛 LanguageTool

[typographical] ~41-~41: To join two clauses or introduce examples, consider using an em dash.
Context: ...larify when caches are saved. ## v1.0.0 - 2025-06-20 - Initial version.

(DASH_RULE)

🪛 markdownlint-cli2 (0.17.2)

41-41: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


42-42: Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

🤖 Prompt for AI Agents
In .github/actions/setup-rust/CHANGELOG.md at lines 41 to 42, add a blank line
immediately after the "## v1.0.0 - 2025-06-20" heading to separate it from the
bullet list below. This will satisfy markdownlint MD022 by ensuring the heading
is surrounded by blank lines.

Comment on lines 11 to 18
| install-postgres-deps | Install PostgreSQL system dependencies | no | `false` |
| install-sqlite-deps | Install SQLite development libraries (Windows) | no | `false` |
| with-darwin | Install macOS cross build toolchain | no | `false` |
| darwin-sdk-version | macOS SDK version for osxcross | no | `12.3` |
| with-openbsd | Build OpenBSD std library for cross-compilation | no | `false` |
| BUILD_PROFILE | Build profile used for caching | no | `release` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Alphabetise the inputs table for faster scanning.

Keep the inputs list in lexicographical order to help users locate a flag quickly.

-| install-postgres-deps | Install PostgreSQL system dependencies | no | `false` |
-| install-sqlite-deps | Install SQLite development libraries (Windows) | no | `false` |
-| with-darwin | Install macOS cross build toolchain | no | `false` |
-| darwin-sdk-version | macOS SDK version for osxcross | no | `12.3` |
-| with-openbsd | Build OpenBSD std library for cross-compilation | no | `false` |
-| BUILD_PROFILE | Build profile used for caching | no | `release` |
+| BUILD_PROFILE | Build profile used for caching | no | `release` |
+| darwin-sdk-version | macOS SDK version for osxcross | no | `12.3` |
+| install-postgres-deps | Install PostgreSQL system dependencies | no | `false` |
+| install-sqlite-deps | Install SQLite development libraries (Windows) | no | `false` |
+| with-darwin | Install macOS cross build toolchain | no | `false` |
+| with-openbsd | Build OpenBSD std library for cross-compilation | no | `false` |
📝 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
| install-postgres-deps | Install PostgreSQL system dependencies | no | `false` |
| install-sqlite-deps | Install SQLite development libraries (Windows) | no | `false` |
| with-darwin | Install macOS cross build toolchain | no | `false` |
| darwin-sdk-version | macOS SDK version for osxcross | no | `12.3` |
| with-openbsd | Build OpenBSD std library for cross-compilation | no | `false` |
| BUILD_PROFILE | Build profile used for caching | no | `release` |
| BUILD_PROFILE | Build profile used for caching | no | `release` |
| darwin-sdk-version | macOS SDK version for osxcross | no | `12.3` |
| install-postgres-deps | Install PostgreSQL system dependencies | no | `false` |
| install-sqlite-deps | Install SQLite development libraries (Windows) | no | `false` |
| with-darwin | Install macOS cross build toolchain | no | `false` |
| with-openbsd | Build OpenBSD std library for cross-compilation | no | `false` |
🤖 Prompt for AI Agents
In .github/actions/setup-rust/README.md around lines 11 to 16, the inputs table
is not alphabetized, which makes it harder to scan. Rearrange the rows of the
inputs table so that the input names are in lexicographical order, ensuring the
table remains correctly formatted and aligned.

Comment on lines 24 to 34
```yaml
uses: ./.github/actions/setup-rust@v1
with:
install-postgres-deps: true
install-sqlite-deps: true
- uses: ./.github/actions/setup-rust@v1
with:
install-postgres-deps: true
install-sqlite-deps: true
with-darwin: true
with-openbsd: true
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Show all new inputs in the usage snippet.

Demonstrate darwin-sdk-version so users see how to override the default.

       install-sqlite-deps: true
       with-darwin: true
+      # Override if a different SDK is required
+      darwin-sdk-version: '13.3'
       with-openbsd: true
📝 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
```yaml
uses: ./.github/actions/setup-rust@v1
with:
install-postgres-deps: true
install-sqlite-deps: true
- uses: ./.github/actions/setup-rust@v1
with:
install-postgres-deps: true
install-sqlite-deps: true
with-darwin: true
with-openbsd: true
```
- uses: ./.github/actions/setup-rust@v1
with:
install-postgres-deps: true
install-sqlite-deps: true
with-darwin: true
# Override if a different SDK is required
darwin-sdk-version: '13.3'
with-openbsd: true
🤖 Prompt for AI Agents
In .github/actions/setup-rust/README.md around lines 24 to 31, the usage snippet
does not show all new inputs, specifically the darwin-sdk-version input. Update
the snippet to include darwin-sdk-version with an example value to demonstrate
how users can override the default SDK version on Darwin systems.

Comment on lines +47 to +55
When `with-darwin` is enabled, the action installs the osxcross toolchain on
Linux so that Rust crates can be cross-compiled for macOS. The SDK version can
be configured via the `darwin-sdk-version` input and defaults to `12.3`. The
`x86_64-apple-darwin` and `aarch64-apple-darwin` Rust targets are installed so
that Cargo can produce macOS binaries.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Add a reference link and note Apple SDK licence.

Point readers at the osxcross project page and remind them that Apple’s SDK is subject to licensing terms.

-When `with-darwin` is enabled, the action installs the osxcross toolchain on
-Linux so that Rust crates can be cross-compiled for macOS.
+When `with-darwin` is enabled, the action installs the
+[osxcross](https://github.com/tpoechtrager/osxcross) toolchain on
+Linux so that Rust crates can be cross-compiled for macOS. Ensure your
+use of the Apple SDK complies with Apple’s licensing terms.
📝 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
When `with-darwin` is enabled, the action installs the osxcross toolchain on
Linux so that Rust crates can be cross-compiled for macOS. The SDK version can
be configured via the `darwin-sdk-version` input and defaults to `12.3`. The
`x86_64-apple-darwin` and `aarch64-apple-darwin` Rust targets are installed so
that Cargo can produce macOS binaries.
When `with-darwin` is enabled, the action installs the
[osxcross](https://github.com/tpoechtrager/osxcross) toolchain on
Linux so that Rust crates can be cross-compiled for macOS. Ensure your
use of the Apple SDK complies with Apple’s licensing terms.
The SDK version can be configured via the `darwin-sdk-version` input and defaults to `12.3`. The
`x86_64-apple-darwin` and `aarch64-apple-darwin` Rust targets are installed so
that Cargo can produce macOS binaries.
🧰 Tools
🪛 LanguageTool

[typographical] ~48-~48: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...t crates can be cross-compiled for macOS. The SDK version can be configured via t...

(WRB_QUESTION_MARK)

🤖 Prompt for AI Agents
In .github/actions/setup-rust/README.md around lines 47 to 52, add a reference
link to the osxcross project page to guide readers to the source of the
toolchain. Also include a note reminding users that Apple's SDK is subject to
licensing terms, ensuring they are aware of the legal considerations when using
the SDK.

@leynos leynos force-pushed the codex/add-macos-and-openbsd-toolchain-options branch from 40bb32b to 22f2b1e Compare July 24, 2025 22:23
@leynos leynos merged commit ae45ea1 into main Jul 24, 2025
1 check passed
@leynos leynos deleted the codex/add-macos-and-openbsd-toolchain-options branch July 24, 2025 22:23
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 24, 2025

@sourcery-ai review

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @leynos - I've reviewed your changes and found some issues that need to be addressed.

  • The README mentions a BUILD_PROFILE input that isn’t defined in action.yml; either remove it or add it to the inputs list.
  • The changelog versions are out of order (v1.0.5 appears after v1.0.8); please reorder entries in descending version order.
  • Consider pinning a specific nightly toolchain version for building the OpenBSD stdlib to ensure reproducible builds rather than using the floating “nightly” channel.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The README mentions a BUILD_PROFILE input that isn’t defined in action.yml; either remove it or add it to the inputs list.
- The changelog versions are out of order (v1.0.5 appears after v1.0.8); please reorder entries in descending version order.
- Consider pinning a specific nightly toolchain version for building the OpenBSD stdlib to ensure reproducible builds rather than using the floating “nightly” channel.

## Individual Comments

### Comment 1
<location> `.github/actions/setup-rust/action.yml:95` </location>
<code_context>
+      id: openbsd-stdlib-cache
+      uses: actions/cache@v4
+      with:
+        path: ~/.rustup/toolchains/nightly/lib/rustlib/x86_64-unknown-openbsd
+        key: openbsd-stdlib-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}
+    - name: Clone Rust repo & build OpenBSD std
</code_context>

<issue_to_address>
Hardcoded path to nightly toolchain may not be robust across environments.

This path may not be valid if the nightly toolchain has a date suffix or custom name. Dynamically resolve the nightly toolchain directory to ensure compatibility.
</issue_to_address>

### Comment 2
<location> `.github/actions/setup-rust/action.yml:105` </location>
<code_context>
+        HOST_TRIPLE=$(rustc -vV | grep '^host:' | awk '{print $2}')
+        ./x.py build --stage 1 --target x86_64-unknown-openbsd library/std
+        mkdir -p ~/.rustup/toolchains/nightly/lib/rustlib/x86_64-unknown-openbsd
+        cp -r build/$HOST_TRIPLE/stage1/lib/rustlib/x86_64-unknown-openbsd/* \
+          ~/.rustup/toolchains/nightly/lib/rustlib/x86_64-unknown-openbsd/
+    - name: Add OpenBSD target
</code_context>

<issue_to_address>
No error handling for missing build artifacts during stdlib copy.

Add checks to verify the existence of build artifacts before copying to prevent silent failures if the build fails or directory structure changes.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
        cp -r build/$HOST_TRIPLE/stage1/lib/rustlib/x86_64-unknown-openbsd/* \
          ~/.rustup/toolchains/nightly/lib/rustlib/x86_64-unknown-openbsd/
=======
        ARTIFACT_DIR="build/$HOST_TRIPLE/stage1/lib/rustlib/x86_64-unknown-openbsd"
        if [ ! -d "$ARTIFACT_DIR" ]; then
          echo "Error: Build artifacts not found at $ARTIFACT_DIR"
          exit 1
        fi
        cp -r "$ARTIFACT_DIR"/* \
          ~/.rustup/toolchains/nightly/lib/rustlib/x86_64-unknown-openbsd/
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

id: openbsd-stdlib-cache
uses: actions/cache@v4
with:
path: ~/.rustup/toolchains/nightly/lib/rustlib/x86_64-unknown-openbsd
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue: Hardcoded path to nightly toolchain may not be robust across environments.

This path may not be valid if the nightly toolchain has a date suffix or custom name. Dynamically resolve the nightly toolchain directory to ensure compatibility.

Comment on lines +105 to +106
cp -r build/$HOST_TRIPLE/stage1/lib/rustlib/x86_64-unknown-openbsd/* \
~/.rustup/toolchains/nightly/lib/rustlib/x86_64-unknown-openbsd/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: No error handling for missing build artifacts during stdlib copy.

Add checks to verify the existence of build artifacts before copying to prevent silent failures if the build fails or directory structure changes.

Suggested change
cp -r build/$HOST_TRIPLE/stage1/lib/rustlib/x86_64-unknown-openbsd/* \
~/.rustup/toolchains/nightly/lib/rustlib/x86_64-unknown-openbsd/
ARTIFACT_DIR="build/$HOST_TRIPLE/stage1/lib/rustlib/x86_64-unknown-openbsd"
if [ ! -d "$ARTIFACT_DIR" ]; then
echo "Error: Build artifacts not found at $ARTIFACT_DIR"
exit 1
fi
cp -r "$ARTIFACT_DIR"/* \
~/.rustup/toolchains/nightly/lib/rustlib/x86_64-unknown-openbsd/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant