-
Notifications
You must be signed in to change notification settings - Fork 655
Add tests for the cli Source Generator #4617
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
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
7c59034
Add test project for GitVersion.Cli.Generator
arturcic 15b401d
Refactor module naming and improve code consistency
arturcic 8e69d19
Add unit tests for CommandImplGenerator functionality`Add tests for C…
arturcic b6bebbc
Refactor and rename command generators for clarity
arturcic d5cea5a
Adds global usings to generated code
arturcic 36a4920
Make output-file option required and enable nullable contexts
arturcic 3dde520
Refactor property requirement check in CommandBaseGenerator
arturcic ec1a617
Refactor namespace constants into `Content` class
arturcic c3cee98
Add CLI module and refactor app initialization
arturcic cb3d56e
Moves CliModule to SystemCommandline namespace
arturcic 6a8c6ca
adds test command
arturcic 66f823f
Refactors container registration to use `IServiceCollection`
arturcic 48913f9
uses microsoft logging
arturcic 4f61da0
refactors: use readonly backing fields
arturcic 2d242d3
Refactors logger injection in command classes
arturcic fc3c3da
improves command registration in IoC container
arturcic 8a00c7e
Renames Content class to SystemCommandlineContent
arturcic 36cb36c
implements cli application infrastructure
arturcic 263ef09
Adds extensions namespace to code generator
arturcic ed9f37a
adds support for command options
arturcic 33174aa
Qualifies commands module
arturcic 8b99fde
adds LoggingEnricher and updates IoC and tests
arturcic 47f00e1
Refactors `RegisterTypes` method to return `IServiceCollection`
arturcic 144a291
Updates `GitVersionApp` to implement `ICliApp`
arturcic 95ec97d
separates format and build workflows
arturcic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Build (new-cli) | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'fix/*' | ||
- 'feature/*' | ||
- 'poc/*' | ||
- 'support/*' | ||
paths: | ||
- '**' | ||
- '!docs/**' | ||
- '!.github/**' | ||
- .github/workflows/new-cli.yml | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
- 'support/*' | ||
paths: | ||
- '**' | ||
- '!docs/**' | ||
- '!.github/**' | ||
- .github/workflows/new-cli.yml | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
DOTNET_ROLL_FORWARD: "Major" | ||
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | ||
DOTNET_NOLOGO: 1 | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-24.04 | ||
name: Build & Test (new-cli) | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Setup .NET SDK | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
global-json-file: global.json | ||
- | ||
name: Build 'new-cli' solution | ||
run: dotnet build ./new-cli | ||
- | ||
name: Run Format 'new-cli' solution | ||
run: dotnet format ./new-cli --exclude ~/.nuget/packages --verify-no-changes | ||
- | ||
name: Test 'new-cli' solution | ||
run: dotnet test ./new-cli --no-build --verbosity normal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="TestCommand" type="DotNetProject" factoryName=".NET Project"> | ||
<option name="EXE_PATH" value="$PROJECT_DIR$/GitVersion.Cli/bin/Debug/net9.0/gitversion" /> | ||
<option name="PROGRAM_PARAMETERS" value="test -i test.txt" /> | ||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | ||
<option name="PASS_PARENT_ENVS" value="1" /> | ||
<option name="USE_EXTERNAL_CONSOLE" value="0" /> | ||
<option name="ENV_FILE_PATHS" value="" /> | ||
<option name="REDIRECT_INPUT_PATH" value="" /> | ||
<option name="PTY_MODE" value="Auto" /> | ||
<option name="USE_MONO" value="0" /> | ||
<option name="RUNTIME_ARGUMENTS" value="" /> | ||
<option name="AUTO_ATTACH_CHILDREN" value="0" /> | ||
<option name="MIXED_MODE_DEBUG" value="0" /> | ||
<option name="PROJECT_PATH" value="$PROJECT_DIR$/GitVersion.Cli/GitVersion.Cli.csproj" /> | ||
<option name="PROJECT_EXE_PATH_TRACKING" value="1" /> | ||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" /> | ||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" /> | ||
<option name="PROJECT_KIND" value="DotNetCore" /> | ||
<option name="PROJECT_TFM" value="net9.0" /> | ||
<method v="2"> | ||
<option name="Build" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
new-cli/GitVersion.Cli.Generator.Tests/GitVersion.Cli.Generator.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<RootNamespace>GitVersion.Cli.Generator.Tests</RootNamespace> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" /> | ||
<PackageReference Include="System.CommandLine" /> | ||
|
||
<PackageReference Include="Microsoft.CSharp" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
<PackageReference Include="NUnit" /> | ||
<PackageReference Include="NUnit.Analyzers"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="NUnit3TestAdapter" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="NUnit.Framework" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\GitVersion.Cli.Generator\GitVersion.Cli.Generator.csproj" /> | ||
<ProjectReference Include="..\GitVersion.Common.Command\GitVersion.Common.Command.csproj" /> | ||
<ProjectReference Include="..\GitVersion.Core\GitVersion.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Have we started prefixing fields with
_
?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.
not sure yet, I guess this used the configurations I had at my current work. That is still much a wip, so whenever it's at a more advanced stage we can get back to the conventions