-
Notifications
You must be signed in to change notification settings - Fork 6
Add Rust unit tests + CI workflow #399
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
Conversation
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow to run Rust unit tests, introduces unit tests for PDF extraction and TTS in the Changes
Sequence Diagram(s)(Skipped — changes are CI/hooks and unit tests without a multi-component runtime control flow that benefits from a sequence diagram.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile OverviewGreptile SummaryThis PR adds comprehensive Rust unit tests for PDF extraction and TTS text processing utilities, and establishes CI infrastructure to run these tests automatically. Changes:
Testing: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Git as Git Hook
participant CI as GitHub Actions
participant Tests as Rust Tests
Dev->>Git: git commit (with Rust files)
Git->>Git: Check staged files
alt Rust files staged
Git->>Tests: cargo test --all-targets
Tests-->>Git: Test results
alt Tests pass
Git->>Dev: Commit allowed
else Tests fail
Git->>Dev: Commit blocked
end
else No Rust files
Git->>Dev: Skip Rust tests
end
Dev->>CI: git push / create PR
CI->>CI: Install Rust & dependencies
CI->>CI: Configure sccache
CI->>Tests: cargo test --all-targets
Tests-->>CI: Test results
CI->>Dev: CI status (pass/fail)
|
Deploying maple with
|
| Latest commit: |
92ecada
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bcbbcbf6.maple-ca8.pages.dev |
| Branch Preview URL: | https://chore-rust-unit-tests.maple-ca8.pages.dev |
There was a problem hiding this 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
🤖 Fix all issues with AI agents
In @.githooks/pre-commit:
- Around line 28-41: The current staged-file pattern (used in the STAGED_FILES
check with grep -Eq) only matches src/*.rs, build.rs and Cargo files and misses
Rust files in tests/, benches/, and examples/; update the grep pattern to match
any Rust-related file under frontend/src-tauri (for example change the regex
used in grep -Eq to match ^frontend/src-tauri/.*\.(rs|toml|lock)$ or explicitly
include directories like tests|benches|examples) so that when STAGED_FILES
contains changes in tests/, benches/, examples/, build.rs, Cargo.toml,
Cargo.lock or any .rs file anywhere under frontend/src-tauri the hook runs cargo
test --all-targets. Ensure the updated pattern is applied where grep -Eq is
invoked so SKIPPED cases are avoided for those directories.
be8ae36 to
8030ec9
Compare
Adds Rust unit tests for src-tauri and runs them in CI (and in pre-commit when relevant files are staged). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
39ac510 to
92ecada
Compare
There was a problem hiding this 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
🤖 Fix all issues with AI agents
In @.github/workflows/rust-tests.yml:
- Around line 48-51: The three environment writes use unquoted $GITHUB_ENV and
separate redirects; change to write all lines in one grouped block redirected to
the quoted variable to avoid SC2086/SC2129. Locate the run step that echoes
RUSTC_WRAPPER, SCCACHE_DIR and SCCACHE_CACHE_SIZE and replace the three
individual echo ... >> $GITHUB_ENV statements with a grouped command (e.g., {
echo "RUSTC_WRAPPER=..."; echo "SCCACHE_DIR=..."; echo "SCCACHE_CACHE_SIZE=...";
} >> "$GITHUB_ENV") so $GITHUB_ENV is quoted and the redirect is only applied
once.
| run: | | ||
| echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
| echo "SCCACHE_DIR=$HOME/.cache/sccache" >> $GITHUB_ENV | ||
| echo "SCCACHE_CACHE_SIZE=2G" >> $GITHUB_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote $GITHUB_ENV and group the redirects.
Avoids shellcheck SC2086/SC2129 and makes the step safer.
🛠 Suggested fix
- run: |
- echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
- echo "SCCACHE_DIR=$HOME/.cache/sccache" >> $GITHUB_ENV
- echo "SCCACHE_CACHE_SIZE=2G" >> $GITHUB_ENV
+ run: |
+ {
+ echo "RUSTC_WRAPPER=sccache"
+ echo "SCCACHE_DIR=$HOME/.cache/sccache"
+ echo "SCCACHE_CACHE_SIZE=2G"
+ } >> "$GITHUB_ENV"📝 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.
| run: | | |
| echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | |
| echo "SCCACHE_DIR=$HOME/.cache/sccache" >> $GITHUB_ENV | |
| echo "SCCACHE_CACHE_SIZE=2G" >> $GITHUB_ENV | |
| run: | | |
| { | |
| echo "RUSTC_WRAPPER=sccache" | |
| echo "SCCACHE_DIR=$HOME/.cache/sccache" | |
| echo "SCCACHE_CACHE_SIZE=2G" | |
| } >> "$GITHUB_ENV" |
🧰 Tools
🪛 actionlint (1.7.10)
48-48: shellcheck reported issue in this script: SC2086:info:1:33: Double quote to prevent globbing and word splitting
(shellcheck)
48-48: shellcheck reported issue in this script: SC2086:info:2:44: Double quote to prevent globbing and word splitting
(shellcheck)
48-48: shellcheck reported issue in this script: SC2086:info:3:33: Double quote to prevent globbing and word splitting
(shellcheck)
48-48: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
🤖 Prompt for AI Agents
In @.github/workflows/rust-tests.yml around lines 48 - 51, The three environment
writes use unquoted $GITHUB_ENV and separate redirects; change to write all
lines in one grouped block redirected to the quoted variable to avoid
SC2086/SC2129. Locate the run step that echoes RUSTC_WRAPPER, SCCACHE_DIR and
SCCACHE_CACHE_SIZE and replace the three individual echo ... >> $GITHUB_ENV
statements with a grouped command (e.g., { echo "RUSTC_WRAPPER=..."; echo
"SCCACHE_DIR=..."; echo "SCCACHE_CACHE_SIZE=..."; } >> "$GITHUB_ENV") so
$GITHUB_ENV is quoted and the redirect is only applied once.
Adds Rust unit tests for pdf extraction + TTS text helpers, and adds a GitHub Actions workflow to run on PRs and master.
Summary by CodeRabbit
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.