Skip to content

Fix/cli#320

Merged
sylvain-guillet merged 2 commits into
mainfrom
fix/cli
May 13, 2026
Merged

Fix/cli#320
sylvain-guillet merged 2 commits into
mainfrom
fix/cli

Conversation

@sylvain-guillet

Copy link
Copy Markdown
Contributor

This pull request refactors the test synchronization mechanism in the CLI test suite and improves the packaging process in the CI/CD workflow. The most important changes are the introduction of a safer, disposable-based locking mechanism for test synchronization, updates to all test files to use this mechanism, and enhancements to the GitHub Actions workflow for packaging and publishing NuGet packages.

Test synchronization improvements

  • Replaced the static objLock object in Configuration.cs with a static SemaphoreSlim-based locking mechanism, providing both synchronous (Lock()) and asynchronous (LockAsync()) disposable lock acquisition methods for safer and more flexible test synchronization.
  • Updated all test files (e.g., BodyInformationTests.cs, EphemerisTests.cs, FrameTests.cs, GeometryFinderTests.cs, OrbitalParametersTests.cs, OrientationTests.cs, PropagateTests.cs, TimeTests.cs) to use the new using (Configuration.Lock()) or using (await Configuration.LockAsync()) pattern instead of lock (Configuration.objLock). This ensures proper lock release and supports async tests. [1] [2] [3] [4] [5] [6] [7] [8] etc.)

CI/CD and packaging workflow enhancements

  • Moved the version-setting step for .csproj files earlier in the workflow to ensure the correct version is set before restoring dependencies.
  • Added packaging for the CLI project (dotnet pack IO.Astrodynamics.CLI/IO.Astrodynamics.CLI.csproj) and a staging step that collects all NuGet packages into a nupkg-staging directory.
  • Updated the artifact upload step to upload all staged NuGet packages, ensuring both framework and CLI packages are available as build artifacts.

These changes improve test reliability, make the test suite safer for parallel execution, and streamline the packaging and publishing process in CI/CD.

Copilot AI left a comment

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.

Pull request overview

This PR improves reliability of the .NET CLI test suite by replacing lock (Configuration.objLock) with a disposable, SemaphoreSlim-based synchronization API that supports both sync and async test flows, and enhances the CD workflow to package and publish both the framework and CLI NuGet artifacts.

Changes:

  • Replaced the shared test synchronization object with Configuration.Lock() / Configuration.LockAsync() disposable acquisition helpers backed by SemaphoreSlim.
  • Updated CLI test suite call sites to use the new locking pattern (including converting one test to async/await).
  • Updated the GitHub Actions CD workflow to set versions earlier and to pack + stage both framework and CLI NuGet packages before uploading artifacts.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
IO.Astrodynamics.Net/IO.Astrodynamics.CLI.Tests/Configuration.cs Introduces SemaphoreSlim-based disposable locking API for tests (sync + async).
IO.Astrodynamics.Net/IO.Astrodynamics.CLI.Tests/TimeTests.cs Migrates test synchronization from lock to using (Configuration.Lock()).
IO.Astrodynamics.Net/IO.Astrodynamics.CLI.Tests/PropagateTests.cs Converts test to async and uses LockAsync() + await for propagation.
IO.Astrodynamics.Net/IO.Astrodynamics.CLI.Tests/OrientationTests.cs Migrates test synchronization to Configuration.Lock().
IO.Astrodynamics.Net/IO.Astrodynamics.CLI.Tests/OrbitalParametersTests.cs Migrates test synchronization to Configuration.Lock().
IO.Astrodynamics.Net/IO.Astrodynamics.CLI.Tests/GeometryFinderTests.cs Migrates test synchronization to Configuration.Lock().
IO.Astrodynamics.Net/IO.Astrodynamics.CLI.Tests/FrameTests.cs Migrates test synchronization to Configuration.Lock().
IO.Astrodynamics.Net/IO.Astrodynamics.CLI.Tests/EphemerisTests.cs Migrates test synchronization to Configuration.Lock().
IO.Astrodynamics.Net/IO.Astrodynamics.CLI.Tests/BodyInformationTests.cs Migrates test synchronization to Configuration.Lock().
.github/workflows/cd.yml Sets csproj version earlier; packs CLI as well; stages and uploads all produced .nupkg artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sylvain-guillet sylvain-guillet merged commit ecb039e into main May 13, 2026
8 checks passed
@sylvain-guillet sylvain-guillet deleted the fix/cli branch May 13, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants