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
66 changes: 35 additions & 31 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
name: Publish

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build -c Release --no-restore

- name: Pack
run: dotnet pack -c Release -o ./nuget --no-build

- name: Publish
run: dotnet nuget push ./nuget/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate -s https://api.nuget.org/v3/index.json
name: Publish

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+"

jobs:
publish:
if: github.repository == 'rameel/ramstack.structures'
runs-on: ubuntu-latest
steps:
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x

- name: Checkout
uses: actions/checkout@v4

- name: Build
run: dotnet build -c Release

- name: Create NuGet Packages
run: dotnet pack -c Release -o ./nuget --no-build

- name: Publish NuGet Packages
run: dotnet nuget push ./nuget/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate -s https://api.nuget.org/v3/index.json

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: nuget/*
32 changes: 14 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
name: Build & Test
name: Build & Test

on:
pull_request:
branches: [main]

jobs:
build-and-test:

name: build-and-test-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
name: "Test project"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x

- name: Restore dependencies
run: dotnet restore
dotnet-version: |
6.x
7.x
8.x
9.x

- name: Build
run: dotnet build -c Release --no-restore
- name: Test (Debug)
run: dotnet test -c Debug

- name: Test
run: dotnet test --no-restore --verbosity normal
- name: Test (Release)
run: dotnet test -c Release
10 changes: 5 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
</PropertyGroup>
</Project>
<Project>
<PropertyGroup>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion Ramstack.Structures.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Immutable;
using System.Collections.Immutable;
using System.Runtime.InteropServices;

namespace Ramstack.Collections;
Expand Down
16 changes: 8 additions & 8 deletions Ramstack.Structures/Collections/ReadOnlyArray`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public Enumerator GetEnumerator()
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ReadOnlyArray<T> Slice(int start)
{
var array = Inner!;
_ = array.Length;
var array = Inner;
_ = array!.Length;

return start != 0
? new ReadOnlyArray<T>(array.AsSpan(start))
Expand All @@ -159,8 +159,8 @@ public ReadOnlyArray<T> Slice(int start)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ReadOnlyArray<T> Slice(int start, int length)
{
var array = Inner!;
var count = array.Length;
var array = Inner;
var count = array!.Length;

if (start == 0 && length == count)
return this;
Expand Down Expand Up @@ -266,8 +266,8 @@ public ref readonly T GetPinnableReference() =>
/// <param name="destination">The span to copy items into.</param>
public void CopyTo(Span<T> destination)
{
var array = this;
_ = array.Length;
var array = Inner;
_ = array!.Length;

array.AsSpan().CopyTo(destination);
}
Expand All @@ -282,8 +282,8 @@ public void CopyTo(Span<T> destination)
/// </returns>
public bool TryCopyTo(Span<T> destination)
{
var array = this;
_ = array.Length;
var array = Inner;
_ = array!.Length;

return array.AsSpan().TryCopyTo(destination);
}
Expand Down
64 changes: 32 additions & 32 deletions Ramstack.Structures/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
// ReSharper disable UnusedMember.Global

[module: System.Runtime.CompilerServices.SkipLocalsInit]

#if !NET8_0_OR_GREATER

// ReSharper disable once CheckNamespace
namespace System.Runtime.CompilerServices
{
/// <summary></summary>
/// <param name="builderType">The type of the builder to use to construct the collection.</param>
/// <param name="methodName">The name of the method on the builder to use to construct the collection.</param>
[AttributeUsage(
AttributeTargets.Class
| AttributeTargets.Struct
| AttributeTargets.Interface,
Inherited = false)]
internal sealed class CollectionBuilderAttribute(Type builderType, string methodName) : Attribute
{
/// <summary>
/// Gets the type of the builder to use to construct the collection.
/// </summary>
public Type BuilderType => builderType;

/// <summary>
/// Gets the name of the method on the builder to use to construct the collection.
/// </summary>
public string MethodName => methodName;
}
}

#endif
// ReSharper disable UnusedMember.Global
[module: System.Runtime.CompilerServices.SkipLocalsInit]
#if !NET8_0_OR_GREATER
// ReSharper disable once CheckNamespace
namespace System.Runtime.CompilerServices
{
/// <summary></summary>
/// <param name="builderType">The type of the builder to use to construct the collection.</param>
/// <param name="methodName">The name of the method on the builder to use to construct the collection.</param>
[AttributeUsage(
AttributeTargets.Class
| AttributeTargets.Struct
| AttributeTargets.Interface,
Inherited = false)]
internal sealed class CollectionBuilderAttribute(Type builderType, string methodName) : Attribute
{
/// <summary>
/// Gets the type of the builder to use to construct the collection.
/// </summary>
public Type BuilderType => builderType;
/// <summary>
/// Gets the name of the method on the builder to use to construct the collection.
/// </summary>
public string MethodName => methodName;
}
}
#endif
2 changes: 1 addition & 1 deletion Ramstack.Structures/Ramstack.Structures.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Ramstack.Collections.ReadOnlyArray&lt;T&gt;</Description>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
</ItemGroup>


<ItemGroup>
<None Include="..\README.md" Link="Properties\README.md">
Expand Down