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
38 changes: 19 additions & 19 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
name: Build and analyse with SonarQube
name: .NET

on:
workflow_dispatch:
push:
branches:
- main
branches: [ "main" ]
pull_request:
types: [ opened, synchronize, reopened ]
env:
SONAR_PROJECT: astar-dev-functional-extensions
branches: [ "main" ]

jobs:
build:
name: Build and analyze
runs-on: windows-latest

steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
- name: Set up JDK
uses: actions/setup-java@v4.4.0
with:
java-version: 17
distribution: 'zulu'

- uses: actions/checkout@v4
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0

- name: Cache SonarQube Cloud packages
uses: actions/cache@v4
- name: 🛠 Cache SonarQube Cloud packages
uses: actions/cache@v4.2.3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarQube Cloud scanner
- name: 🛠 Cache SonarQube Cloud scanner
id: cache-sonar-scanner
uses: actions/cache@v4
uses: actions/cache@v4.2.3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarQube Cloud scanner
- name: 🛠 Install SonarQube Cloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner

- name: Build and analyze
- name: 🔍 Restore, 🛠 Build and 🧪 Test with ☁️ SonarCloud / Qube project - ${{ vars.SONAR_PROJECT_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
dotnet tool install --global dotnet-coverage
.\.sonar\scanner\dotnet-sonarscanner begin /k:"astar-development_${{ env.SONAR_PROJECT }}" /o:"astar-development" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.scanner.scanAll=false /d:sonar.scanner.skipJreProvisioning=true
dotnet build
.\.sonar\scanner\dotnet-sonarscanner begin /k:"astar-development_${{ github.event.repository.name }}" /o:"astar-development" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.scanner.scanAll=false /d:sonar.scanner.skipJreProvisioning=true
dotnet build --configuration Release
dotnet-coverage collect 'dotnet test --filter "FullyQualifiedName!~Tests.EndToEnd"' -f xml -o 'coverage.xml'
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
6 changes: 2 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
env:
ProjectName: 'AStar.Dev.Functional.Extensions'

steps:
- name: 🧾 Checkout code
Expand All @@ -26,8 +24,8 @@ jobs:
- name: 🛠 Build solution
run: dotnet build --configuration Release

- name: 📦 Pack NuGet package
run: dotnet pack ./src/${{ env.ProjectName }}/${{ env.ProjectName }}.csproj --configuration Release --output ./nupkg
- name: 📦 Pack NuGet package for ${{ github.event.repository.name }}
run: dotnet pack ./src/**/*.csproj --configuration Release --output ./nupkg

- name: 🚀 Publish to NuGet.org
run: dotnet nuget push ./nupkg/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NuGet_API_Key }} #
Expand Down
59 changes: 0 additions & 59 deletions AStar.Dev.Functional.Extensions.sln

This file was deleted.

28 changes: 28 additions & 0 deletions AStar.Dev.Functional.Extensions.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Solution>
<Folder Name="/.github/"/>
<Folder Name="/.github/workflows/">
<File Path=".github/workflows/dotnet.yml"/>
<File Path=".github/workflows/publish.yml"/>
</Folder>
<Folder Name="/Solution Items/">
<File Path="blog-post.md"/>
<File Path="Readme-option.md"/>
<File Path="Readme-result.md"/>
<File Path="Readme.md"/>
</Folder>
<Folder Name="/Solution Items/Docs/">
<File Path="docs/advanced-usage-option.md"/>
<File Path="docs/advanced-usage.md"/>
<File Path="docs/basic-usage.md"/>
<File Path="docs/core-concepts.md"/>
<File Path="docs/error-handling-patterns.md"/>
<File Path="docs/method-reference.md"/>
<File Path="docs/testing.md"/>
</Folder>
<Folder Name="/src/">
<Project Path="src/AStar.Dev.Functional.Extensions/AStar.Dev.Functional.Extensions.csproj"/>
</Folder>
<Folder Name="/test/">
<Project Path="test/AStar.Dev.Functional.Extensions.Tests.Unit/AStar.Dev.Functional.Extensions.Tests.Unit.csproj"/>
</Folder>
</Solution>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AnalysisLevel>latest-recommended</AnalysisLevel>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
</PropertyGroup>

<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageId>AStar.Dev.Functional.Extensions</PackageId>
<Version>0.4.2</Version>
<Version>0.4.5</Version>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<Authors>AStar Development, Jason Barden</Authors>
<Company>AStar Development</Company>
Expand All @@ -19,9 +27,6 @@
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/astar-development/astar-dev-functional-extensions</PackageProjectUrl>
<RootNamespace>AStar.Dev.Functional.Extensions</RootNamespace>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<Title>AStar.Dev.Functional.Extensions</Title>
Expand All @@ -35,10 +40,10 @@
</ItemGroup>

<ItemGroup>
<None Include="..\..\astar.png" Pack="True" PackagePath="/" Link="astar.png"/>
<None Include="..\..\Readme.md" Pack="True" PackagePath="/" Link="Readme.md"/>
<None Include="..\..\Readme-option.md" Pack="True" PackagePath="/" Link="Readme-option.md"/>
<None Include="..\..\Readme-result.md" Pack="True" PackagePath="/" Link="Readme-result.md"/>
<None Include="..\..\astar.png" Pack="True" PackagePath="/" Link="astar.png"/>
<None Include="..\..\Readme.md" Pack="True" PackagePath="/" Link="Readme.md"/>
<None Include="..\..\Readme-option.md" Pack="True" PackagePath="/" Link="Readme-option.md"/>
<None Include="..\..\Readme-result.md" Pack="True" PackagePath="/" Link="Readme-result.md"/>
</ItemGroup>

</Project>
4 changes: 0 additions & 4 deletions src/AStar.Dev.Functional.Extensions/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace AStar.Dev.Functional.Extensions;

/// <summary>
Expand Down
5 changes: 0 additions & 5 deletions src/AStar.Dev.Functional.Extensions/OptionExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AStar.Dev.Functional.Extensions;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions src/AStar.Dev.Functional.Extensions/OptionLinqExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Threading.Tasks;

namespace AStar.Dev.Functional.Extensions;

/// <summary>
Expand Down
24 changes: 7 additions & 17 deletions src/AStar.Dev.Functional.Extensions/Option{T}.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;

namespace AStar.Dev.Functional.Extensions;

/// <summary>
Expand Down Expand Up @@ -43,20 +40,13 @@ public TResult Match<TResult>(Func<T, TResult> onSome, Func<TResult> onNone) =>
/// <returns>
/// <c>true</c> if the specified object is equal to the current instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object? obj)
{
if(obj is Option<T> other)
{
return this switch
{
Some some => other is Some otherSome && EqualityComparer<T>.Default.Equals(some.Value, otherSome.Value),
None => other is None,
_ => false
};
}

return false;
}
public override bool Equals(object? obj) =>
obj is Option<T> other && this switch
{
Some some => other is Some otherSome && EqualityComparer<T>.Default.Equals(some.Value, otherSome.Value),
None => other is None,
_ => false
};

/// <summary>
/// Returns a hash code for the current instance of the <see cref="Option{T}" />.
Expand Down
2 changes: 0 additions & 2 deletions src/AStar.Dev.Functional.Extensions/Pattern.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace AStar.Dev.Functional.Extensions;

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions src/AStar.Dev.Functional.Extensions/Result.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Threading.Tasks;

namespace AStar.Dev.Functional.Extensions;
namespace AStar.Dev.Functional.Extensions;

/// <summary>
/// Represents a discriminated union of success or failure.
Expand Down
Loading
Loading