Skip to content

Resolve differences on computation of CiBuildIndex between C# and PowerShell #25

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

Merged
merged 2 commits into from
Jun 2, 2025

Conversation

smaillet
Copy link
Member

@smaillet smaillet commented Jun 2, 2025

Fixes #24
PowerShell uses different behavior when "casting" from a double to an integer than C# does. Thus the values of the computed "CiBuildIndex" were not matching for the task and version library and scripts. This fixes the issue by making the truncation behavior explicit in the PS scripts so the output of those matches that of the C# task and library.

  • Updated CiBuildInfo to use source generated Regex.
  • Converted Versioning library to use DateTime instead of DateTimeOffset for conversions.
    • .NET uses a different syntax for the ISO-8601 format and that makes it impossible to compare/roundtrip test.
  • Adjusted task GetBuildIndex to help make clearer intent and log same.
  • Updated tests to include detailed validation of generated PS to versioning lib AND PS to generated from task to ensure all 3 agree.

Powershell uses different behavior when "casting" from a double to an integer than C# does. Thus the values of the computed "CiBuildIndex" were not matching for the task and version library and scripts. This fixes the issue by making the truncation behavior explicit in the PS scripts so the output of those matches that of the C# task and library.
Copy link

github-actions bot commented Jun 2, 2025

Test Results

29 tests  +1   29 ✅ +1   5s ⏱️ -1s
 2 suites ±0    0 💤 ±0 
 2 files   ±0    0 ❌ ±0 

Results for commit 73bf220. ± Comparison against base commit 7a40003.

This pull request removes 1 and adds 2 tests. Note that renamed tests count towards both.
Ubiquity.NET.Versioning.UT.DateTimeOffsetExtensionsTests ‑ ToBuildIndexTest
Ubiquity.NET.Versioning.UT.DateTimeExtensionsTests ‑ RoundTrippingProducesExpectedValue
Ubiquity.NET.Versioning.UT.DateTimeExtensionsTests ‑ ToBuildIndexTest

♻️ This comment has been updated with latest results.

@smaillet smaillet merged commit 6f6a779 into UbiquityDotNET:develop Jun 2, 2025
3 checks passed
@smaillet smaillet deleted the CiBuildIndexFix branch June 2, 2025 18:20
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.

[BUG] - CiBuildName is not consistently computed from the scripts
1 participant