Skip to content

Update rust cache paths#162

Merged
leynos merged 1 commit intomainfrom
codex/update-cache-paths-for-cross-compilation-targets
Jun 18, 2025
Merged

Update rust cache paths#162
leynos merged 1 commit intomainfrom
codex/update-cache-paths-for-cross-compilation-targets

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jun 18, 2025

Summary

  • cache compiled artifacts for any Rust target
  • run build steps on Windows runners
  • clarify mermaid validator docs

Testing

  • cargo fmt --all
  • cargo clippy -- -D warnings
  • RUSTFLAGS="-D warnings" cargo test
  • markdownlint '**/*.md'
  • nixie '**/*.md'

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

Summary by Sourcery

Expand Rust CI caching to cover all targets, introduce a Windows build workflow, and refine the mermaid validation documentation

Enhancements:

  • Unify cache paths in setup-rust action to cache compiled artifacts for any target and build profile

CI:

  • Add a Windows build job to run formatting, linting, and building on windows-latest runners

Documentation:

  • Clarify the mermaid validator guide to better describe code block rendering and error reporting

Summary by CodeRabbit

  • New Features

    • Added a new Windows build job to the continuous integration workflow, enabling automated builds for the Windows GNU platform with the sqlite feature.
  • Chores

    • Improved caching strategy for Rust build artefacts to enhance build efficiency across different target directories.
  • Documentation

    • Refined wording in the Mermaid validation documentation for greater clarity and readability.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 18, 2025

Reviewer's Guide

This PR enhances the GitHub Actions pipeline by introducing a dedicated Windows build job and generalizing Rust cache directories with glob patterns in the custom setup-rust action, alongside improving the Mermaid validator documentation for clarity.

File-Level Changes

Change Details Files
Add Windows build job in CI pipeline
  • Introduce a new windows-build job on windows-latest
  • Configure matrix feature testing (sqlite) with fail-fast disabled
  • Run rustup target add, cargo fmt, clippy and build for the Windows GNU target
  • Leverage existing checkout and setup-rust steps
.github/workflows/ci.yml
Generalize Rust cache paths with glob patterns
  • Replace explicit target/${BUILD_PROFILE} paths with target/**/${BUILD_PROFILE}
  • Preserve registry and git cache entries
  • Simplify restore key to cover all targets
.github/actions/setup-rust/action.yml
Clarify Mermaid validator documentation
  • Rewrap mermaid code block description into a single sentence
  • Remove unnecessary hyphenation and align phrasing
  • Ensure consistent line breaks for readability
docs/mermaid-validation.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 Jun 18, 2025

Walkthrough

The changes consolidate Cargo cache paths in the custom Rust setup GitHub Action, update CI workflow by adding a Windows build job with feature matrix, and clarify wording in the Mermaid validation documentation. There are no modifications to exported or public entities.

Changes

File(s) Change Summary
.github/actions/setup-rust/action.yml Consolidated multiple specific Cargo cache paths into a single glob pattern for broader caching coverage.
.github/workflows/ci.yml Added a new windows-build job for Windows GNU target with a feature matrix, including formatting, linting, build.
docs/mermaid-validation.md Improved clarity and conciseness in documentation wording; no technical content changes.

Sequence Diagram(s)

sequenceDiagram
    participant CI as GitHub Actions CI
    participant Setup as setup-rust Action
    participant Cargo as Cargo Toolchain

    CI->>Setup: Run setup-rust (with cache paths target/**/${{ env.BUILD_PROFILE }})
    Setup->>Cargo: Restore/build cache for all target subdirs
    CI->>Cargo: Add Windows GNU target (x86_64-pc-windows-gnu)
    CI->>Cargo: Run cargo fmt (check)
    CI->>Cargo: Run cargo clippy (lint)
    CI->>Cargo: Build for Windows GNU with sqlite feature
Loading

Possibly related PRs

  • Add caching for cross targets #159: Generalised and consolidated cache paths for cargo build artifacts, directly modifying the same caching configuration.
  • Pin nightly toolchain #139: Both PRs update .github/actions/setup-rust/action.yml and .github/workflows/ci.yml to enhance Rust toolchain setup and caching.
  • Pin nightly toolchain #146: Introduced the initial setup-rust action and Rust nightly pinning, which is further modified in this PR for cache and CI improvements.

Suggested reviewers

  • codescene-delta-analysis

Poem

In the CI garden, caches bloom anew,
With globs that catch more than a chosen few.
Windows builds hop in with a shiny stride,
While docs get a polish, clear and wide.
A bunny’s delight—so neat and spry,
These changes make the pipelines fly!
🐇✨

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch codex/update-cache-paths-for-cross-compilation-targets

🪧 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 auto-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

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Choose a reason for hiding this comment

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

Gates Passed
6 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Pay Down Tech Debt
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.

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 they look great!


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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4183d41 and 7943afb.

📒 Files selected for processing (3)
  • .github/actions/setup-rust/action.yml (1 hunks)
  • .github/workflows/ci.yml (1 hunks)
  • docs/mermaid-validation.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/mermaid-validation.md

[style] ~39-~39: Consider using a different verb for a more formal wording.
Context: ... error location are printed to help you fix the issue. If nixie is not found on ...

(FIX_RESOLVE)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: coverage
  • GitHub Check: build-test (postgres)
  • GitHub Check: windows-build (sqlite)
  • GitHub Check: build-test (sqlite)
🔇 Additional comments (2)
.github/actions/setup-rust/action.yml (1)

22-22: Consolidated cache path for all Rust targets
The new glob target/**/${{ env.BUILD_PROFILE }} correctly captures build artifacts across any target triple, including Windows. Please verify that it doesn’t inadvertently cache large or transient directories (e.g., incremental or test output folders) that could bloat your cache.

.github/workflows/ci.yml (1)

48-50: New Windows build job added
The windows-build job on windows-latest ensures coverage for the x86_64-pc-windows-gnu target. Nice work extending the CI matrix.

Comment on lines +36 to +39
The script extracts each `mermaid` code block and attempts to render it using an
embedded Mermaid renderer. Any syntax errors cause `nixie` to exit with a
non-zero status. The failing diagram's line and a pointer to the error location
are printed to help you fix the issue.
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)

Nitpick: Smooth out the sentence flow
Consider merging these two sentences for brevity and clarity. For example:
“This script extracts every mermaid code block and attempts to render it using an embedded Mermaid renderer, exiting with a non-zero status on syntax errors and printing the failing diagram’s line with an error pointer.”

🧰 Tools
🪛 LanguageTool

[style] ~39-~39: Consider using a different verb for a more formal wording.
Context: ... error location are printed to help you fix the issue. If nixie is not found on ...

(FIX_RESOLVE)

🤖 Prompt for AI Agents
In docs/mermaid-validation.md around lines 36 to 39, the explanation is split
into two sentences that can be merged for smoother flow and brevity. Combine the
sentences into one that clearly states the script extracts each mermaid code
block, attempts rendering, exits with a non-zero status on syntax errors, and
prints the failing diagram's line with an error pointer, improving readability
and conciseness.

Comment thread .github/workflows/ci.yml
Comment on lines +58 to +67
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- name: Add Windows GNU target
run: rustup target add x86_64-pc-windows-gnu
- name: Format
run: cargo fmt --all -- --check
- name: Lint
run: cargo clippy --no-default-features --features ${{ matrix.feature }} -- -D warnings
- name: Build for Windows GNU
run: cargo build --target x86_64-pc-windows-gnu --no-default-features --features ${{ matrix.feature }}
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)

Align Windows job with build-test
Currently this job formats, lints and builds. For parity, consider adding a cargo test --target x86_64-pc-windows-gnu --no-default-features --features ${{ matrix.feature }} step after the build to validate tests on Windows as well.

🤖 Prompt for AI Agents
In .github/workflows/ci.yml around lines 58 to 67, the Windows GNU job runs
format, lint, and build steps but lacks a test step. Add a new step after the
build step that runs `cargo test` with the same target and feature flags: `cargo
test --target x86_64-pc-windows-gnu --no-default-features --features ${{
matrix.feature }}` to ensure tests are validated on Windows as well.

@leynos leynos merged commit 0fc872a into main Jun 18, 2025
5 of 8 checks passed
@leynos leynos deleted the codex/update-cache-paths-for-cross-compilation-targets branch June 18, 2025 11:49
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