Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 9.0.101
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.101
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 9.0.101
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.101
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion CodeQuality.sln
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Global
GlobalSection(NestedProjects) = preSolution
{9785BB59-DC3D-46CF-B45C-DF4DBE6F0B2F} = {5B172423-1455-41CB-8D81-7DCFCFF8855D}
{46DE472E-6200-47A1-9874-3B54952DFF81} = {5B172423-1455-41CB-8D81-7DCFCFF8855D}
{B4ED680E-2B7B-4DFE-87E6-A3CBEE75C3DD} = {5B172423-1455-41CB-8D81-7DCFCFF8855D}
{B4ED680E-2B7B-4DFE-87E6-A3CBEE75C3DD} = {57F5BB2E-CD03-470B-BF16-31FE02A386B1}
{6FB11F33-250F-4DE8-934A-F63CDC8976D6} = {B1962CF8-DE8C-42AA-BC4E-99E99D722E26}
{E4FAC4E6-2853-4464-B78F-6BAB619EEF8D} = {B1962CF8-DE8C-42AA-BC4E-99E99D722E26}
{4D9D7FB7-CB50-4F61-92E7-A2CD669B15A7} = {1D5021C0-2423-494A-98F6-71AB937CDF8B}
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ You can checkout this Github repository or you can use the NuGet package:

**Install using the command line from the Package Manager:**
```bash
Install-Package SoloX.CodeQuality.Prod -version 2.3.5
Install-Package SoloX.CodeQuality.Prod -version 2.3.6
or
Install-Package SoloX.CodeQuality.Test -version 2.3.5
Install-Package SoloX.CodeQuality.Test -version 2.3.6
```

**Install using the .Net CLI:**
```bash
dotnet add package SoloX.CodeQuality.Prod --version 2.3.5
dotnet add package SoloX.CodeQuality.Prod --version 2.3.6
or
dotnet add package SoloX.CodeQuality.Test --version 2.3.5
dotnet add package SoloX.CodeQuality.Test --version 2.3.6
```

**Install editing your project file (csproj):**
```xml
<PackageReference Include="SoloX.CodeQuality.Prod" Version="2.3.5">
<PackageReference Include="SoloX.CodeQuality.Prod" Version="2.3.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
or
<PackageReference Include="SoloX.CodeQuality.Test" Version="2.3.5">
<PackageReference Include="SoloX.CodeQuality.Test" Version="2.3.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down Expand Up @@ -218,17 +218,17 @@ You can checkout this Github repository or use the NuGet package:

**Install using the command line from the Package Manager:**
```bash
Install-Package SoloX.CodeQuality.Playwright -version 2.3.5
Install-Package SoloX.CodeQuality.Playwright -version 2.3.6
```

**Install using the .Net CLI:**
```bash
dotnet add package SoloX.CodeQuality.Playwright --version 2.3.5
dotnet add package SoloX.CodeQuality.Playwright --version 2.3.6
```

**Install editing your project file (csproj):**
```xml
<PackageReference Include="SoloX.CodeQuality.Playwright" Version="2.3.5" />
<PackageReference Include="SoloX.CodeQuality.Playwright" Version="2.3.6" />
```

* * *
Expand Down Expand Up @@ -424,29 +424,29 @@ You can checkout this Github repository or you can use the NuGet package:

**Install using the command line from the Package Manager:**
```bash
Install-Package SoloX.CodeQuality.Test.Helpers -version 2.3.5
Install-Package SoloX.CodeQuality.Test.Helpers -version 2.3.6

Install-Package SoloX.CodeQuality.Test.Helpers.XUnit -version 2.3.5
Install-Package SoloX.CodeQuality.Test.Helpers.XUnit -version 2.3.6

Install-Package SoloX.CodeQuality.Test.Helpers.NUnit -version 2.3.5
Install-Package SoloX.CodeQuality.Test.Helpers.NUnit -version 2.3.6
```

**Install using the .Net CLI:**
```bash
dotnet add package SoloX.CodeQuality.Test.Helpers --version 2.3.5
dotnet add package SoloX.CodeQuality.Test.Helpers --version 2.3.6

dotnet add package SoloX.CodeQuality.Test.Helpers.XUnit --version 2.3.5
dotnet add package SoloX.CodeQuality.Test.Helpers.XUnit --version 2.3.6

dotnet add package SoloX.CodeQuality.Test.Helpers.NUnit --version 2.3.5
dotnet add package SoloX.CodeQuality.Test.Helpers.NUnit --version 2.3.6
```

**Install editing your project file (csproj):**
```xml
<PackageReference Include="SoloX.CodeQuality.Test.Helpers" Version="2.3.5" />
<PackageReference Include="SoloX.CodeQuality.Test.Helpers" Version="2.3.6" />

<PackageReference Include="SoloX.CodeQuality.Test.Helpers.XUnit" Version="2.3.5" />
<PackageReference Include="SoloX.CodeQuality.Test.Helpers.XUnit" Version="2.3.6" />

<PackageReference Include="SoloX.CodeQuality.Test.Helpers.NUnit" Version="2.3.5" />
<PackageReference Include="SoloX.CodeQuality.Test.Helpers.NUnit" Version="2.3.6" />
```

* * *
Expand Down
4 changes: 2 additions & 2 deletions src/SharedProperties.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<Version>2.3.5</Version>
<Version>2.3.6</Version>
<Authors>Xavier Solau</Authors>
<Copyright>Copyright © 2021 Xavier Solau</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand All @@ -14,7 +14,7 @@
<CodeQualityHeaderLicense>$(PackageLicenseExpression)</CodeQualityHeaderLicense>
<CodeQualityHeaderLicenseFile>LICENSE</CodeQualityHeaderLicenseFile>

<AssemblyVersion>2.3.5.0</AssemblyVersion>
<AssemblyVersion>2.3.6.0</AssemblyVersion>
<LangVersion>12</LangVersion>

</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/libs/SoloX.CodeQuality.Playwright/PlaywrightDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private static void InstallPlaywright()

var lockFile = Path.Combine(localApplicationData, "PlaywrightInstallLock");

var timeout = 60;
var timeout = 60 * 3;

while (!TryWriteLockFile(lockFile))
{
Expand Down
36 changes: 26 additions & 10 deletions src/libs/SoloX.CodeQuality.Test.Helpers/DotnetHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,41 @@ public static bool Restore(string projectPath, out ProcessResult processResult,
}

public static bool Build(string projectPath, out ProcessResult processResult,
Action<StringDictionary>? environmentVariablesHandler = null)
Action<StringDictionary>? environmentVariablesHandler = null, string? configuration = null)
{
return Dotnet(projectPath, BUILD, out processResult, environmentVariablesHandler);
var configurationArg = string.IsNullOrEmpty(configuration) ? string.Empty : $" --configuration {configuration}";

return Dotnet(projectPath, $"{BUILD}{configurationArg}", out processResult, environmentVariablesHandler);
}

public static bool Test(string projectPath, out ProcessResult processResult,
Action<StringDictionary>? environmentVariablesHandler = null)
Action<StringDictionary>? environmentVariablesHandler = null, string? configuration = null)
{
return Dotnet(projectPath, TEST, out processResult, environmentVariablesHandler);
var configurationArg = string.IsNullOrEmpty(configuration) ? string.Empty : $" --configuration {configuration}";

return Dotnet(projectPath, $"{TEST}{configurationArg}", out processResult, environmentVariablesHandler);
}

public static bool Publish(string projectPath, out ProcessResult processResult,
Action<StringDictionary>? environmentVariablesHandler = null, string? configuration = null)
{
var configurationArg = string.IsNullOrEmpty(configuration) ? string.Empty : $" --configuration {configuration}";

return Dotnet(projectPath, $"{PUBLISH}{configurationArg}", out processResult, environmentVariablesHandler);
}

public static bool New(string path, string template, string? framework, string output, out ProcessResult processResult,
Action<StringDictionary>? environmentVariablesHandler = null)
{
return Dotnet(projectPath, PUBLISH, out processResult, environmentVariablesHandler);
return string.IsNullOrEmpty(framework)
? Dotnet(path, $"{NEW} {template} --output {output}", out processResult, environmentVariablesHandler)
: Dotnet(path, $"{NEW} {template} --output {output} --framework {framework}", out processResult, environmentVariablesHandler);
}

public static bool New(string path, string template, string output, out ProcessResult processResult,
Action<StringDictionary>? environmentVariablesHandler = null)
{
return Dotnet(path, $"{NEW} {template} --output {output}", out processResult, environmentVariablesHandler);
return New(path, template, null, output, out processResult, environmentVariablesHandler);
}

public static bool NewSln(string path, string solutionName, out ProcessResult processResult,
Expand Down Expand Up @@ -87,15 +101,17 @@ public static bool AddReference(string path, string projectFilePath, string proj
}

public static bool Run(string projectPath, out ProcessResult processResult,
Action<StringDictionary>? environmentVariablesHandler = null)
Action<StringDictionary>? environmentVariablesHandler = null, string? configuration = null)
{
return Run(projectPath, string.Empty, out processResult, environmentVariablesHandler);
return Run(projectPath, string.Empty, out processResult, environmentVariablesHandler, configuration);
}

public static bool Run(string projectPath, string args, out ProcessResult processResult,
Action<StringDictionary>? environmentVariablesHandler = null)
Action<StringDictionary>? environmentVariablesHandler = null, string? configuration = null)
{
return Dotnet(projectPath, $"{RUN} {args}", out processResult, environmentVariablesHandler);
var configurationArg = string.IsNullOrEmpty(configuration) ? string.Empty : $" --configuration {configuration}";

return Dotnet(projectPath, $"{RUN}{configurationArg} {args}", out processResult, environmentVariablesHandler);
}

internal static bool NewToolManifest(string path, out ProcessResult processResult,
Expand Down
39 changes: 36 additions & 3 deletions src/libs/SoloX.CodeQuality.Test.Helpers/Solution/ISolution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,44 @@ namespace SoloX.CodeQuality.Test.Helpers.Solution
/// </summary>
public interface ISolution
{
/// <summary>
/// Name of the solution to build.
/// </summary>
string SolutionName { get; }

/// <summary>
/// Path of the solution to build.
/// </summary>
string SolutionPath { get; }

/// <summary>
/// Default configuration.
/// </summary>
string DefaultConfiguration { get; }

/// <summary>
/// Build solution.
/// </summary>
/// <param name="project">Project to build or null to build all solution.</param>
/// <param name="configuration">Configuration to use.</param>
/// <returns>Process result.</returns>
ProcessResult Build(string? project = null);
ProcessResult Build(string? project = null, string? configuration = null);

/// <summary>
/// Test solution.
/// </summary>
/// <param name="project">Project to run.</param>
/// <param name="configuration">Configuration to use.</param>
/// <returns>Process result.</returns>
ProcessResult Run(string? project = null);
ProcessResult Run(string? project = null, string? configuration = null);

/// <summary>
/// Test solution.
/// </summary>
/// <param name="project">Project to test or null to run all solution tests.</param>
/// <param name="configuration">Configuration to use.</param>
/// <returns>Process result.</returns>
ProcessResult Test(string? project = null);
ProcessResult Test(string? project = null, string? configuration = null);

/// <summary>
/// Run a Dotnet tool.
Expand All @@ -42,5 +60,20 @@ public interface ISolution
/// <param name="project">Project where to run the tool or null to run from solution folder.</param>
/// <returns>Process result.</returns>
ProcessResult RunTool(string toolName, string? toolArgs = null, string? project = null);

/// <summary>
/// Get the project path.
/// </summary>
/// <param name="project">Project name.</param>
/// <returns>The project path.</returns>
string GetProjectPath(string project);

/// <summary>
/// Get the project binary path.
/// </summary>
/// <param name="project">Project name.</param>
/// <param name="configuration">Configuration to use.</param>
/// <returns>The project binary path.</returns>
string GetProjectBinaryPath(string project, string? configuration = null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ public ProjectConfiguration(
SolutionBuilder solutionBuilder,
string projectName,
string template,
string? framework,
Action<IProjectConfiguration> configuration)
{
this.solutionBuilder = solutionBuilder;
ProjectName = projectName;
Template = template;

Framework = framework;
ProjectFilePath = Path.Combine(projectName, $"{projectName}.csproj");
ProjectPath = projectName;

Expand All @@ -55,10 +56,15 @@ public ProjectConfiguration(
/// </summary>
public string Template { get; }

/// <summary>
/// Project Target Framework (default if null).
/// </summary>
public string? Framework { get; }

public void Build()
{
SolutionBuilder.DotnetCall<ProjectError>((out ProcessResult processResult) =>
DotnetHelper.New(this.solutionBuilder.SolutionPath, Template, ProjectName, out processResult)
DotnetHelper.New(this.solutionBuilder.SolutionPath, Template, Framework, ProjectName, out processResult)
);

this.configuration(this);
Expand Down
Loading
Loading