Skip to content

Testsettings#115

Merged
MichalFrends1 merged 5 commits intomainfrom
testsettings
Apr 10, 2026
Merged

Testsettings#115
MichalFrends1 merged 5 commits intomainfrom
testsettings

Conversation

@MatteoDelOmbra
Copy link
Copy Markdown
Contributor

@MatteoDelOmbra MatteoDelOmbra commented Apr 3, 2026

Summary by CodeRabbit

  • Chores
    • Updated CI build pipelines to apply project-specific test configuration when present, improving flexibility.
    • Standardized test execution across platforms to ensure consistent behavior in automated builds.
    • Added informational logging in pipelines to make it clear which test configuration path was selected during runs.

Update test step to use .runsettings file if available.
Update test step to use .runsettings file if available.
Update test step to use PowerShell and check for settings file.
Updated test step to use PowerShell and check for settings file.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

Walkthrough

Test steps in four GitHub Actions workflows now run under PowerShell and conditionally check for a workspace .runtestsettings file; if present, dotnet test is invoked with --settings .runtestsettings --collect:"XPlat Code Coverage", otherwise it runs with --collect:"XPlat Code Coverage" only. Informational logs were added.

Changes

Cohort / File(s) Summary
Workflows — conditional Test step
.github/workflows/build_main.yml, .github/workflows/build_test.yml, .github/workflows/linux_build_main.yml, .github/workflows/linux_build_test.yml
Test step now uses pwsh and checks Test-Path for .runtestsettings; runs dotnet test --settings .runtestsettings --collect:"XPlat Code Coverage" when present, otherwise dotnet test --collect:"XPlat Code Coverage". Added Write-Host logging to indicate chosen path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • ChargedByte
  • jefim
  • MichalFrends1

Poem

🐇 I hopped through CI with a curious nose,

If settings hide, pwsh softly knows.
Tests will run and coverage shine,
With a tiny check, the path's assigned.
Hooray — the rabbit approves this line! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Testsettings' is vague and generic; it names a feature/component but doesn't clearly convey what was changed or why, making it difficult for reviewers to understand the actual modification from the title alone. Consider revising the title to be more descriptive, such as 'Support conditional .runtestsettings file detection in test workflows' or 'Add conditional test settings configuration across CI workflows'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch testsettings

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (1)
.github/workflows/build_test.yml (1)

281-291: Consider centralizing this test-settings logic to avoid drift

This same block now exists in four workflows. A small reusable workflow/composite action for dotnet test + optional settings would keep behavior consistent and reduce future copy/paste divergence.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_test.yml around lines 281 - 291, The Test step
duplicated across workflows should be extracted into a reusable workflow or
composite action that accepts an optional settings file input (e.g.
settings_file) and runs the same dotnet test invocation with --collect:"XPlat
Code Coverage"; implement a new workflow/action that checks the provided
settings_file (default ".runtestsettings") and runs dotnet test with or without
--settings accordingly, then replace each existing "Test" step (the powershell
block referencing $settingsFile and dotnet test) with a call to this reusable
workflow using the inputs to ensure consistent behavior and avoid drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/linux_build_test.yml:
- Line 285: The fallback log message uses the wrong filename: update the string
"No .runsettings file found. Running with default settings." to reference the
actual file being checked (".runtestsettings") so the message matches the
condition in the workflow; locate the echo/Write-Host statement that prints that
message in the linux_build_test.yml and change the filename text to
".runtestsettings".
- Around line 280-283: The script currently checks a relative $settingsFile
(".runtestsettings") under the current working directory (inputs.workdir) which
can miss a workspace-root file; update the creation and checks to resolve the
workspace-root path: set $settingsFile = Join-Path $env:GITHUB_WORKSPACE
".runtestsettings" (or use Resolve-Path on that Join-Path), then Test-Path
$settingsFile and call dotnet test --settings $settingsFile --collect:"XPlat
Code Coverage", updating the Write-Host to indicate the resolved workspace path;
use the existing $settingsFile variable and existing Test-Path/dotnet test calls
so only the path resolution changes.

---

Nitpick comments:
In @.github/workflows/build_test.yml:
- Around line 281-291: The Test step duplicated across workflows should be
extracted into a reusable workflow or composite action that accepts an optional
settings file input (e.g. settings_file) and runs the same dotnet test
invocation with --collect:"XPlat Code Coverage"; implement a new workflow/action
that checks the provided settings_file (default ".runtestsettings") and runs
dotnet test with or without --settings accordingly, then replace each existing
"Test" step (the powershell block referencing $settingsFile and dotnet test)
with a call to this reusable workflow using the inputs to ensure consistent
behavior and avoid drift.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e9b13b84-fbf6-4b01-9d60-8d5aa15dda13

📥 Commits

Reviewing files that changed from the base of the PR and between 59b41a8 and dae3215.

📒 Files selected for processing (4)
  • .github/workflows/build_main.yml
  • .github/workflows/build_test.yml
  • .github/workflows/linux_build_main.yml
  • .github/workflows/linux_build_test.yml

Comment on lines +280 to +283
$settingsFile = ".runtestsettings"
if (Test-Path $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
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.

⚠️ Potential issue | 🟠 Major

Resolve test settings path from workspace root to avoid silent misses

Line 280 uses a relative .runtestsettings, which is evaluated under ${{ inputs.workdir }} (Line 99). If workdir is not ., root-level settings are ignored and tests run with unintended defaults.

Proposed fix
-          $settingsFile = ".runtestsettings"
-          if (Test-Path $settingsFile) {
+          $settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings"
+          if (Test-Path -LiteralPath $settingsFile) {
             Write-Host "Using $settingsFile found in workspace."
             dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
           } else {
-            Write-Host "No .runsettings file found. Running with default settings."
+            Write-Host "No .runtestsettings file found. Running with default settings."
             dotnet test --collect:"XPlat Code Coverage"
           }
📝 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
$settingsFile = ".runtestsettings"
if (Test-Path $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
$settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings"
if (Test-Path -LiteralPath $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
} else {
Write-Host "No .runtestsettings file found. Running with default settings."
dotnet test --collect:"XPlat Code Coverage"
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/linux_build_test.yml around lines 280 - 283, The script
currently checks a relative $settingsFile (".runtestsettings") under the current
working directory (inputs.workdir) which can miss a workspace-root file; update
the creation and checks to resolve the workspace-root path: set $settingsFile =
Join-Path $env:GITHUB_WORKSPACE ".runtestsettings" (or use Resolve-Path on that
Join-Path), then Test-Path $settingsFile and call dotnet test --settings
$settingsFile --collect:"XPlat Code Coverage", updating the Write-Host to
indicate the resolved workspace path; use the existing $settingsFile variable
and existing Test-Path/dotnet test calls so only the path resolution changes.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/build_main.yml:
- Around line 264-271: The Test step currently sets $settingsFile =
".runtestsettings" which resolves relative to inputs.workdir instead of the
repository root; change the path resolution to target the workspace root (e.g.,
build $settingsFile using the GITHUB_WORKSPACE environment variable or Join-Path
with $Env:GITHUB_WORKSPACE) so Test-Path and the subsequent dotnet test
--settings invocation always check the repo root .runtestsettings; update the
Write-Host messages accordingly to reflect the resolved path and ensure both
branches still run dotnet test with --collect:"XPlat Code Coverage".

In @.github/workflows/build_test.yml:
- Around line 284-291: The workflow currently checks for ".runtestsettings"
using a relative path which resolves against the runner working directory
(inputs.workdir); change the check to resolve against the repository root by
building the absolute path from the workspace root (use $env:GITHUB_WORKSPACE or
the workflow expression github.workspace) — e.g. set $settingsFile = Join-Path
$env:GITHUB_WORKSPACE '.runtestsettings' and then Test-Path $settingsFile; apply
the same change to the other workflow files (linux_build_test.yml,
build_main.yml, linux_build_main.yml) so all checks use the workspace root
instead of inputs.workdir.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a82a6ed-8ed4-4ac2-abe2-4e74abf24c38

📥 Commits

Reviewing files that changed from the base of the PR and between dae3215 and c4ea5d9.

📒 Files selected for processing (4)
  • .github/workflows/build_main.yml
  • .github/workflows/build_test.yml
  • .github/workflows/linux_build_main.yml
  • .github/workflows/linux_build_test.yml
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/linux_build_main.yml

Comment on lines +264 to +271
$settingsFile = ".runtestsettings"
if (Test-Path $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
} else {
Write-Host "No $settingsFile file found. Running with default settings."
dotnet test --collect:"XPlat Code Coverage"
}
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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's check if the file exists and examine the relevant lines
find . -name "build_main.yml" -type f

Repository: FrendsPlatform/FrendsTasks

Length of output: 104


🏁 Script executed:

# Once we have the file, let's examine the context around lines 264-271 and line 80
if [ -f ".github/workflows/build_main.yml" ]; then
  echo "=== Lines 260-280 (context around 264-271) ==="
  sed -n '260,280p' .github/workflows/build_main.yml
  echo ""
  echo "=== Lines 75-85 (context around line 80) ==="
  sed -n '75,85p' .github/workflows/build_main.yml
fi

Repository: FrendsPlatform/FrendsTasks

Length of output: 1235


🏁 Script executed:

# Let's also get the full context of the workflow to understand when workdir is changed
wc -l .github/workflows/build_main.yml

Repository: FrendsPlatform/FrendsTasks

Length of output: 106


🏁 Script executed:

# Search for other uses of relative paths in the workflow
sed -n '1,315p' .github/workflows/build_main.yml | grep -n "\.runtestsettings\|working-directory\|inputs\.workdir" | head -20

Repository: FrendsPlatform/FrendsTasks

Length of output: 321


🏁 Script executed:

# Look at the Build step to see if it has a similar issue or different handling
sed -n '240,265p' .github/workflows/build_main.yml

Repository: FrendsPlatform/FrendsTasks

Length of output: 883


🏁 Script executed:

# Check the Build step to see if it has a similar issue or if this was already fixed
sed -n '200,260p' .github/workflows/build_main.yml

Repository: FrendsPlatform/FrendsTasks

Length of output: 2085


🏁 Script executed:

# Also check if there are any steps that override working-directory
grep -n "working-directory:" .github/workflows/build_main.yml

Repository: FrendsPlatform/FrendsTasks

Length of output: 121


Same path-resolution bug in Test step (.runtestsettings is relative to workdir)

Line 264 resolves .runtestsettings relative to ${{ inputs.workdir }} (defined at line 80), not workspace root. Repos with non-root workdir won't pick up root-level test settings.

Proposed fix
-          $settingsFile = ".runtestsettings"
-          if (Test-Path $settingsFile) {
+          $settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings"
+          if (Test-Path -LiteralPath $settingsFile) {
             Write-Host "Using $settingsFile found in workspace."
             dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
           } else {
             Write-Host "No $settingsFile file found. Running with default settings."
             dotnet test --collect:"XPlat Code Coverage"
           }
📝 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
$settingsFile = ".runtestsettings"
if (Test-Path $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
} else {
Write-Host "No $settingsFile file found. Running with default settings."
dotnet test --collect:"XPlat Code Coverage"
}
$settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings"
if (Test-Path -LiteralPath $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
} else {
Write-Host "No $settingsFile file found. Running with default settings."
dotnet test --collect:"XPlat Code Coverage"
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_main.yml around lines 264 - 271, The Test step
currently sets $settingsFile = ".runtestsettings" which resolves relative to
inputs.workdir instead of the repository root; change the path resolution to
target the workspace root (e.g., build $settingsFile using the GITHUB_WORKSPACE
environment variable or Join-Path with $Env:GITHUB_WORKSPACE) so Test-Path and
the subsequent dotnet test --settings invocation always check the repo root
.runtestsettings; update the Write-Host messages accordingly to reflect the
resolved path and ensure both branches still run dotnet test with
--collect:"XPlat Code Coverage".

Comment on lines +284 to +291
$settingsFile = ".runtestsettings"
if (Test-Path $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
} else {
Write-Host "No $settingsFile file found. Running with default settings."
dotnet test --collect:"XPlat Code Coverage"
}
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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether workflow test steps use relative .runtestsettings while workdir is overridden.
rg -n -C2 'working-directory:\s*\$\{\{\s*inputs\.workdir\s*\}\}|\$settingsFile\s*=\s*"\.runtestsettings"|dotnet test --settings' .github/workflows/*.yml

Repository: FrendsPlatform/FrendsTasks

Length of output: 4365


Resolve .runtestsettings from workspace root, not inputs.workdir

Line 284 uses a relative path, but line 100 sets the runner working directory to ${{ inputs.workdir }}. This causes the code to search for .runtestsettings relative to inputs.workdir instead of the workspace root, potentially missing a workspace-root .runtestsettings and silently running tests with defaults.

Proposed fix
-          $settingsFile = ".runtestsettings"
-          if (Test-Path $settingsFile) {
+          $settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings"
+          if (Test-Path -LiteralPath $settingsFile) {
             Write-Host "Using $settingsFile found in workspace."
             dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
           } else {
             Write-Host "No $settingsFile file found. Running with default settings."
             dotnet test --collect:"XPlat Code Coverage"
           }

Note: The same pattern appears in linux_build_test.yml, build_main.yml, and linux_build_main.yml and should be fixed consistently across all affected workflows.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build_test.yml around lines 284 - 291, The workflow
currently checks for ".runtestsettings" using a relative path which resolves
against the runner working directory (inputs.workdir); change the check to
resolve against the repository root by building the absolute path from the
workspace root (use $env:GITHUB_WORKSPACE or the workflow expression
github.workspace) — e.g. set $settingsFile = Join-Path $env:GITHUB_WORKSPACE
'.runtestsettings' and then Test-Path $settingsFile; apply the same change to
the other workflow files (linux_build_test.yml, build_main.yml,
linux_build_main.yml) so all checks use the workspace root instead of
inputs.workdir.

@MichalFrends1 MichalFrends1 merged commit 3a4cd60 into main Apr 10, 2026
4 checks passed
@MichalFrends1 MichalFrends1 deleted the testsettings branch April 10, 2026 10:38
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