-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates new example solution (project). Lays the groundwork for the repo.
- Loading branch information
Showing
15 changed files
with
271 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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,26 @@ | ||
root = true | ||
|
||
[*] | ||
# Prettier default | ||
charset = utf-8 | ||
insert_final_newline = true | ||
end_of_line = lf | ||
max_line_length = 80 | ||
trim_trailing_whitespace = true | ||
|
||
# Custom | ||
# Use tabs: https://alexandersandberg.com/articles/default-to-tabs-instead-of-spaces-for-an-accessible-first-environment/ | ||
indent_style = tab | ||
|
||
[*.cs] | ||
# CSharpier default is 100 | ||
max_line_length = 100 | ||
|
||
[*.{csproj,esproj,props}] | ||
# Increase line length given .NET XML is whitespace sensitive | ||
max_line_length = 999 | ||
|
||
[*.{yaml,yml}] | ||
# YAML disallows tabs: https://yaml.org/spec/ | ||
indent_size = 2 | ||
indent_style = space |
This file contains 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 @@ | ||
text eol=lf |
This file contains 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,39 @@ | ||
name: Pipeline | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
Build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Full depth (not shallow) for better relevancy of Sonar analysis | ||
|
||
- name: Use .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
global-json-file: global.json | ||
|
||
# Begin ci-build.ps1 | ||
- name: dotnet restore | ||
run: dotnet restore | ||
|
||
- name: dotnet build | ||
run: dotnet build -c release --no-restore | ||
|
||
- name: dotnet test | ||
run: dotnet test -c release --no-build | ||
# End ci-build.ps1 | ||
|
||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains 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,16 @@ | ||
## Solution ## | ||
|
||
# Build | ||
artifacts/ | ||
dist/ | ||
node_modules/ | ||
|
||
# Test | ||
coverage/ | ||
TestResults/ | ||
|
||
## IDE ## | ||
|
||
# Rider/JetBrains | ||
.idea/ | ||
*.user |
This file contains 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,47 @@ | ||
<Project> | ||
<!-- MSBuild properties (general) --> | ||
<!-- https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-properties --> | ||
<PropertyGroup> | ||
<!-- Artifacts --> | ||
<UseArtifactsOutput>true</UseArtifactsOutput> | ||
</PropertyGroup> | ||
|
||
<!-- MSBuild properties (for .NET) --> | ||
<!-- https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props --> | ||
<PropertyGroup> | ||
<!-- Framework properties --> | ||
<TargetFramework>net8.0</TargetFramework> | ||
|
||
<!-- Publish related --> | ||
<IsPublishable>false</IsPublishable> <!-- Private --> | ||
|
||
<!-- Reference --> | ||
<DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences> <!-- Prefer explicit dependencies --> | ||
|
||
<!-- Code generation --> | ||
<ImplicitUsings>disable</ImplicitUsings> <!-- Prefer explicit usings --> | ||
</PropertyGroup> | ||
|
||
<!-- C# compiler options --> | ||
<!-- https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/ --> | ||
<PropertyGroup> | ||
<!-- Language --> | ||
<Nullable>enable</Nullable> | ||
|
||
<!-- Code generation --> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
|
||
<!-- Unit test coverage --> | ||
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('test'))"> | ||
<!-- Recommended to disable if no C++ native code. --> | ||
<EnableStaticNativeInstrumentation>False</EnableStaticNativeInstrumentation> | ||
<EnableDynamicNativeInstrumentation>False</EnableDynamicNativeInstrumentation> | ||
</PropertyGroup> | ||
|
||
<!-- Unit test usings --> | ||
<ItemGroup Condition="$(MSBuildProjectName.EndsWith('test'))"> | ||
<Using Include="FluentAssertions" /> | ||
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" /> | ||
</ItemGroup> | ||
</Project> |
This file contains 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,11 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageVersion Include="FluentAssertions" Version="6.12.0" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<GlobalPackageReference Include="connorjs-analyzers" Version="0.2.3" /> | ||
</ItemGroup> | ||
</Project> |
This file contains 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# dotnet-with-esproj-example | ||
Example repo with C# and JS/TS with build orchestration via `dotnet` (csproj + esproj) | ||
# .NET with `.esproj` Example | ||
|
||
Example repository with C# and JS/TS with build orchestration via `dotnet` (`.csproj` and `.esproj`). |
This file contains 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,8 @@ | ||
try { | ||
$env:CI = true | ||
dotnet restore | ||
dotnet build -c release --no-restore | ||
dotnet test -c release --no-build | ||
} finally { | ||
$env:CI = $null | ||
} |
This file contains 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,49 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hello-cs", "libs\hello-cs\hello-cs.csproj", "{CA70F551-74BE-49DB-B5CC-D64C0D321478}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{7592EEA2-3C6C-4ED0-9EB7-5EC6DBB51DE5}" | ||
ProjectSection(SolutionItems) = preProject | ||
.editorconfig = .editorconfig | ||
.gitattributes = .gitattributes | ||
.gitignore = .gitignore | ||
.github\workflows\pipeline.yaml = .github\workflows\pipeline.yaml | ||
ci-build.ps1 = ci-build.ps1 | ||
Directory.Build.props = Directory.Build.props | ||
Directory.Packages.props = Directory.Packages.props | ||
global.json = global.json | ||
LICENSE = LICENSE | ||
README.md = README.md | ||
sonar-project.properties = sonar-project.properties | ||
EndProjectSection | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{2E75741F-092F-4C2C-A182-AAF9F38CEC58}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hello-cs-test", "libs\hello-cs-test\hello-cs-test.csproj", "{2652DC61-0D21-423D-BF0E-FA67ED4A68F7}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{CA70F551-74BE-49DB-B5CC-D64C0D321478}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{CA70F551-74BE-49DB-B5CC-D64C0D321478}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{CA70F551-74BE-49DB-B5CC-D64C0D321478}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{CA70F551-74BE-49DB-B5CC-D64C0D321478}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{2652DC61-0D21-423D-BF0E-FA67ED4A68F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{2652DC61-0D21-423D-BF0E-FA67ED4A68F7}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{2652DC61-0D21-423D-BF0E-FA67ED4A68F7}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{2652DC61-0D21-423D-BF0E-FA67ED4A68F7}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{CA70F551-74BE-49DB-B5CC-D64C0D321478} = {2E75741F-092F-4C2C-A182-AAF9F38CEC58} | ||
{2652DC61-0D21-423D-BF0E-FA67ED4A68F7} = {2E75741F-092F-4C2C-A182-AAF9F38CEC58} | ||
EndGlobalSection | ||
EndGlobal |
This file contains 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,9 @@ | ||
{ | ||
"msbuild-sdks": { | ||
"MSTest.Sdk": "3.5.0" | ||
}, | ||
"sdk": { | ||
"rollForward": "latestFeature", | ||
"version": "8.0.300" | ||
} | ||
} |
This file contains 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,15 @@ | ||
namespace Connorjs.DotNetWithEsprojExample.Hello; | ||
|
||
[TestClass] | ||
public class HelloUtilityTest | ||
{ | ||
[DataTestMethod] | ||
[DataRow(null, "Hello, world!")] | ||
[DataRow("", "Hello, world!")] | ||
[DataRow(" ", "Hello, !")] | ||
[DataRow("Nx", "Hello, Nx!")] | ||
public void Hello(string? name, string expected) | ||
{ | ||
HelloUtility.Hello(name).Should().Be(expected); | ||
} | ||
} |
This file contains 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,13 @@ | ||
<Project Sdk="MSTest.Sdk"> | ||
<PropertyGroup> | ||
<RootNamespace>Connorjs.DotNetWithEsprojExample.Hello</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\hello-cs\hello-cs.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains 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,15 @@ | ||
namespace Connorjs.DotNetWithEsprojExample.Hello; | ||
|
||
public static class HelloUtility | ||
{ | ||
/// <summary> | ||
/// Returns a hello string. | ||
/// </summary> | ||
/// <param name="name">The name to include. Optional.</param> | ||
/// <returns>A hello string.</returns> | ||
public static string Hello(string? name) | ||
{ | ||
var nameToReturn = string.IsNullOrEmpty(name) ? "world" : name; | ||
return $"Hello, {nameToReturn}!"; | ||
} | ||
} |
This file contains 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,5 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<RootNamespace>Connorjs.DotNetWithEsprojExample.Hello</RootNamespace> | ||
</PropertyGroup> | ||
</Project> |
This file contains 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,14 @@ | ||
sonar.projectKey=connorjs_dotnet-with-esproj-example | ||
sonar.organization=connorjs | ||
|
||
## Analysis scope - https://docs.sonarsource.com/sonarcloud/advanced-setup/analysis-scope/ | ||
|
||
# Define the same root directory for sources and tests | ||
sonar.sources=libs | ||
sonar.tests=libs | ||
|
||
# Include test subdirectories and file patterns in test scope | ||
sonar.test.inclusions=**/-test/**/*,**/*.test.* | ||
|
||
# Exclude test subdirectories and file patterns from source scope | ||
sonar.exclusions=**/-test/**/*,**/*.test.* |