-
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.
* build yaml tweaks * try quotes * try different quotes * remove primary_branch * Use single quotes * Remove framework * upload v4 * All built in actions to v4 * Support Release Candidate branches * Don't use variable in branch list * Port to xunit and other package updates * Fix bad test * File scoped namespaces * .NET 8 and latest language --------- Co-authored-by: Martin Smith <[email protected]>
- Loading branch information
1 parent
c158f92
commit e8ae6e7
Showing
11 changed files
with
1,149 additions
and
1,051 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
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,23 +1,25 @@ | ||
name: CI Build | ||
run-name: CIBuild_${{ github.event_name }}_${{ github.ref_name }}_${{ github.run_number }}${{ github.run_attempt }} | ||
run-name: CIBuild_${{ github.event_name }}_${{ github.ref_name }}_${{ github.run_number }}.${{ github.run_attempt }} | ||
|
||
env: | ||
PKG_MAJOR_VERSION: '1.1' | ||
PROJECT_NAME: 'DNX.Extensions' | ||
DOTNET_VERSION: 6.0.x | ||
DOTNET_VERSION: 8.0.x | ||
NUGET_VERSION: 5.x | ||
BUILD_CONFIG: Release | ||
BUILD_PLATFORM: Any CPU | ||
PACK_PARAMETERS: '' | ||
NUGET_OUTPUT_FOLDER: nupkgs | ||
BRANCH_RELEASE_CANDIDATE: rc/** | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'feature/**' | ||
- 'task/**' | ||
- 'spike/**' | ||
- rc/** | ||
- feature/** | ||
- task/** | ||
- spike/** | ||
|
||
pull_request: | ||
branches: | ||
|
@@ -26,6 +28,8 @@ on: | |
workflow_dispatch: | ||
|
||
jobs: | ||
########################################################## | ||
## Pipeline Configuration and Setup | ||
setup: | ||
name: Setup Pipeline | ||
|
||
|
@@ -39,7 +43,7 @@ jobs: | |
- name: Set Package Suffix | ||
id: package_suffix | ||
run: | | ||
branch='${{ github.ref }}' | ||
branch="${{ github.ref }}" | ||
package_suffix='' | ||
if [ "$branch" != "refs/heads/main" ] | ||
|
@@ -57,7 +61,10 @@ jobs: | |
if [ "${{ github.event_name }}" == "pull_request" ] | ||
then | ||
should_publish=true | ||
elif [ "${{ github.ref }}" == 'refs/heads/main' ] | ||
elif [ "${{ github.ref }}" == "refs/heads/main" ] | ||
then | ||
should_publish=true | ||
elif [[ "${{ github.ref }}" == ${{ env.BRANCH_RELEASE_CANDIDATE }}* ]] | ||
then | ||
should_publish=true | ||
fi | ||
|
@@ -83,7 +90,7 @@ jobs: | |
should_publish: ${{ env.should_publish }} | ||
|
||
########################################################## | ||
## Bulid DotNet projects | ||
## Build DotNet projects | ||
build: | ||
name: Build .NET | ||
|
||
|
@@ -93,21 +100,21 @@ jobs: | |
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install .NET SDK | ||
uses: actions/setup-dotnet@v3 | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Restore NuGet packages | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --configuration ${{ env.BUILD_CONFIG }} /p:"Platform=${{ env.BUILD_PLATFORM }}" /p:"Version=${{ needs.setup.outputs.product_version }}" /p:"AssemblyVersion=${{ needs.setup.outputs.assembly_version }}" --no-restore | ||
run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIG }} /p:"Platform=${{ env.BUILD_PLATFORM }}" /p:"Version=${{ needs.setup.outputs.product_version }}" /p:"AssemblyVersion=${{ needs.setup.outputs.assembly_version }}" | ||
|
||
- name: Test | ||
run: dotnet test --configuration ${{ env.BUILD_CONFIG }} --no-restore --no-build --verbosity normal --collect:"XPlat Code Coverage" | ||
run: dotnet test --no-restore --no-build --configuration ${{ env.BUILD_CONFIG }} --verbosity normal --collect:"XPlat Code Coverage" | ||
|
||
- name: Code Coverage Report | ||
uses: irongut/[email protected] | ||
|
@@ -133,14 +140,14 @@ jobs: | |
run: dotnet pack --configuration ${{ env.BUILD_CONFIG }} /p:"Platform=${{ env.BUILD_PLATFORM }}" /p:"PackageVersion=${{ needs.setup.outputs.package_version }}" --no-restore --output "${{ env.NUGET_OUTPUT_FOLDER }}" | ||
|
||
- name: Upload Build Artifact | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build_output | ||
path: "**/${{ env.PROJECT_NAME }}/bin/${{ env.BUILD_CONFIG }}/**" | ||
if-no-files-found: error | ||
|
||
- name: Upload NuGet Artifact | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: nuget_output | ||
path: "${{ env.NUGET_OUTPUT_FOLDER }}/**" | ||
|
@@ -152,13 +159,15 @@ jobs: | |
name: Create GitHub Release | ||
if: github.ref == 'refs/heads/main' && success() | ||
|
||
needs: [setup, build] | ||
needs: | ||
- setup | ||
- build | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Changelog | ||
id: build_changelog | ||
|
@@ -172,6 +181,7 @@ jobs: | |
tag: v${{ needs.setup.outputs.assembly_version }} | ||
name: Release ${{ needs.setup.outputs.assembly_version }} | ||
body: ${{ steps.build_changelog.outputs.changelog }} | ||
artifacts: '**/*.nupkg' | ||
|
||
- name: Tag git | ||
uses: pkgdeps/[email protected] | ||
|
@@ -188,7 +198,10 @@ jobs: | |
name: Publish to NuGet | ||
if: needs.setup.outputs.should_publish == 'true' | ||
|
||
needs: [setup, build, release] | ||
needs: | ||
- setup | ||
- build | ||
- release | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
@@ -201,7 +214,7 @@ jobs: | |
|
||
- name: Download NuGet Output | ||
id: download_nuget | ||
uses: actions/download-artifact@v3 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: nuget_output | ||
path: ${{ env.NUGET_OUTPUT_FOLDER }} | ||
|
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
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,2 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">Latest</s:String></wpf:ResourceDictionary> |
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,34 +1,33 @@ | ||
using System; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace DNX.Extensions.Enumerations | ||
namespace DNX.Extensions.Enumerations; | ||
|
||
public static class EnumerableExtensions | ||
{ | ||
public static class EnumerableExtensions | ||
/// <summary> | ||
/// Determines whether the specified enumerable has any elements and is not null | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="enumerable">The enumerable.</param> | ||
/// <returns><c>true</c> if the specified enumerable has any elements; otherwise, <c>false</c>.</returns> | ||
/// <remarks>Also available as an extension method</remarks> | ||
public static bool HasAny<T>(this IEnumerable<T> enumerable) | ||
{ | ||
/// <summary> | ||
/// Determines whether the specified enumerable has any elements and is not null | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="enumerable">The enumerable.</param> | ||
/// <returns><c>true</c> if the specified enumerable has any elements; otherwise, <c>false</c>.</returns> | ||
/// <remarks>Also available as an extension method</remarks> | ||
public static bool HasAny<T>(this IEnumerable<T> enumerable) | ||
{ | ||
return enumerable != null && enumerable.Any(); | ||
} | ||
return enumerable != null && enumerable.Any(); | ||
} | ||
|
||
/// <summary> | ||
/// Determines whether the specified enumerable has any elements that match the predicate and is not null | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="enumerable">The enumerable.</param> | ||
/// <param name="predicate">The predicate.</param> | ||
/// <returns><c>true</c> if the specified predicate has any elements that match the predicate; otherwise, <c>false</c>.</returns> | ||
/// <remarks>Also available as an extension method</remarks> | ||
public static bool HasAny<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate) | ||
{ | ||
return enumerable != null && enumerable.Any(predicate); | ||
} | ||
/// <summary> | ||
/// Determines whether the specified enumerable has any elements that match the predicate and is not null | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="enumerable">The enumerable.</param> | ||
/// <param name="predicate">The predicate.</param> | ||
/// <returns><c>true</c> if the specified predicate has any elements that match the predicate; otherwise, <c>false</c>.</returns> | ||
/// <remarks>Also available as an extension method</remarks> | ||
public static bool HasAny<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate) | ||
{ | ||
return enumerable != null && enumerable.Any(predicate); | ||
} | ||
} |
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,18 +1,17 @@ | ||
namespace DNX.Extensions.Strings | ||
namespace DNX.Extensions.Strings; | ||
|
||
/// <summary> | ||
/// How the delimiter is to be treated when splitting text | ||
/// </summary> | ||
public enum SplitDelimiterType | ||
{ | ||
/// <summary> | ||
/// How the delimiter is to be treated when splitting text | ||
/// Any specified value can be a delimiter | ||
/// </summary> | ||
public enum SplitDelimiterType | ||
{ | ||
/// <summary> | ||
/// Any specified value can be a delimiter | ||
/// </summary> | ||
Any = 0, | ||
Any = 0, | ||
|
||
/// <summary> | ||
/// All specified values are the delimiter | ||
/// </summary> | ||
All | ||
} | ||
} | ||
/// <summary> | ||
/// All specified values are the delimiter | ||
/// </summary> | ||
All | ||
} |
Oops, something went wrong.