Skip to content

Commit 8953bf4

Browse files
authored
Merge pull request #7 from rameel/cleanup
Clean up and formatting
2 parents 3839884 + b1bcef4 commit 8953bf4

8 files changed

Lines changed: 97 additions & 97 deletions

File tree

.github/workflows/publish.yml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
1-
name: Publish
2-
3-
on:
4-
push:
5-
tags:
6-
- "[0-9]+.[0-9]+.[0-9]+"
7-
8-
jobs:
9-
publish:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v4
13-
with:
14-
fetch-depth: 2
15-
16-
- name: Setup .NET
17-
uses: actions/setup-dotnet@v3
18-
with:
19-
dotnet-version: 9.0.x
20-
21-
- name: Restore
22-
run: dotnet restore
23-
24-
- name: Build
25-
run: dotnet build -c Release --no-restore
26-
27-
- name: Pack
28-
run: dotnet pack -c Release -o ./nuget --no-build
29-
30-
- name: Publish
31-
run: dotnet nuget push ./nuget/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate -s https://api.nuget.org/v3/index.json
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
- "[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+"
8+
9+
jobs:
10+
publish:
11+
if: github.repository == 'rameel/ramstack.structures'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Install .NET
15+
uses: actions/setup-dotnet@v3
16+
with:
17+
dotnet-version: 9.0.x
18+
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Build
23+
run: dotnet build -c Release
24+
25+
- name: Create NuGet Packages
26+
run: dotnet pack -c Release -o ./nuget --no-build
27+
28+
- name: Publish NuGet Packages
29+
run: dotnet nuget push ./nuget/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate -s https://api.nuget.org/v3/index.json
30+
31+
- name: Create GitHub Release
32+
uses: softprops/action-gh-release@v2
33+
with:
34+
draft: true
35+
files: nuget/*

.github/workflows/test.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
name: Build & Test
1+
name: Build & Test
22

33
on:
44
pull_request:
55
branches: [main]
66

77
jobs:
88
build-and-test:
9-
10-
name: build-and-test-${{ matrix.os }}
11-
runs-on: ${{ matrix.os }}
12-
strategy:
13-
matrix:
14-
os: [ubuntu-latest]
9+
name: "Test project"
10+
runs-on: ubuntu-latest
1511

1612
steps:
17-
- uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 2
13+
- name: Checkout
14+
uses: actions/checkout@v4
2015

2116
- name: Setup .NET
2217
uses: actions/setup-dotnet@v3
2318
with:
24-
dotnet-version: 9.0.x
25-
26-
- name: Restore dependencies
27-
run: dotnet restore
19+
dotnet-version: |
20+
6.x
21+
7.x
22+
8.x
23+
9.x
2824
29-
- name: Build
30-
run: dotnet build -c Release --no-restore
25+
- name: Test (Debug)
26+
run: dotnet test -c Debug
3127

32-
- name: Test
33-
run: dotnet test --no-restore --verbosity normal
28+
- name: Test (Release)
29+
run: dotnet test -c Release

Directory.Build.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<Project>
2-
<PropertyGroup>
3-
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
4-
</PropertyGroup>
5-
</Project>
1+
<Project>
2+
<PropertyGroup>
3+
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
4+
</PropertyGroup>
5+
</Project>

Ramstack.Structures.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31903.59

Ramstack.Structures/Collections/ImmutableArrayExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Immutable;
1+
using System.Collections.Immutable;
22
using System.Runtime.InteropServices;
33

44
namespace Ramstack.Collections;

Ramstack.Structures/Collections/ReadOnlyArray`1.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public Enumerator GetEnumerator()
140140
[MethodImpl(MethodImplOptions.AggressiveInlining)]
141141
public ReadOnlyArray<T> Slice(int start)
142142
{
143-
var array = Inner!;
144-
_ = array.Length;
143+
var array = Inner;
144+
_ = array!.Length;
145145

146146
return start != 0
147147
? new ReadOnlyArray<T>(array.AsSpan(start))
@@ -159,8 +159,8 @@ public ReadOnlyArray<T> Slice(int start)
159159
[MethodImpl(MethodImplOptions.AggressiveInlining)]
160160
public ReadOnlyArray<T> Slice(int start, int length)
161161
{
162-
var array = Inner!;
163-
var count = array.Length;
162+
var array = Inner;
163+
var count = array!.Length;
164164

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

272272
array.AsSpan().CopyTo(destination);
273273
}
@@ -282,8 +282,8 @@ public void CopyTo(Span<T> destination)
282282
/// </returns>
283283
public bool TryCopyTo(Span<T> destination)
284284
{
285-
var array = this;
286-
_ = array.Length;
285+
var array = Inner;
286+
_ = array!.Length;
287287

288288
return array.AsSpan().TryCopyTo(destination);
289289
}
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
// ReSharper disable UnusedMember.Global
2-
3-
[module: System.Runtime.CompilerServices.SkipLocalsInit]
4-
5-
#if !NET8_0_OR_GREATER
6-
7-
// ReSharper disable once CheckNamespace
8-
namespace System.Runtime.CompilerServices
9-
{
10-
/// <summary></summary>
11-
/// <param name="builderType">The type of the builder to use to construct the collection.</param>
12-
/// <param name="methodName">The name of the method on the builder to use to construct the collection.</param>
13-
[AttributeUsage(
14-
AttributeTargets.Class
15-
| AttributeTargets.Struct
16-
| AttributeTargets.Interface,
17-
Inherited = false)]
18-
internal sealed class CollectionBuilderAttribute(Type builderType, string methodName) : Attribute
19-
{
20-
/// <summary>
21-
/// Gets the type of the builder to use to construct the collection.
22-
/// </summary>
23-
public Type BuilderType => builderType;
24-
25-
/// <summary>
26-
/// Gets the name of the method on the builder to use to construct the collection.
27-
/// </summary>
28-
public string MethodName => methodName;
29-
}
30-
}
31-
32-
#endif
1+
// ReSharper disable UnusedMember.Global
2+
3+
[module: System.Runtime.CompilerServices.SkipLocalsInit]
4+
5+
#if !NET8_0_OR_GREATER
6+
7+
// ReSharper disable once CheckNamespace
8+
namespace System.Runtime.CompilerServices
9+
{
10+
/// <summary></summary>
11+
/// <param name="builderType">The type of the builder to use to construct the collection.</param>
12+
/// <param name="methodName">The name of the method on the builder to use to construct the collection.</param>
13+
[AttributeUsage(
14+
AttributeTargets.Class
15+
| AttributeTargets.Struct
16+
| AttributeTargets.Interface,
17+
Inherited = false)]
18+
internal sealed class CollectionBuilderAttribute(Type builderType, string methodName) : Attribute
19+
{
20+
/// <summary>
21+
/// Gets the type of the builder to use to construct the collection.
22+
/// </summary>
23+
public Type BuilderType => builderType;
24+
25+
/// <summary>
26+
/// Gets the name of the method on the builder to use to construct the collection.
27+
/// </summary>
28+
public string MethodName => methodName;
29+
}
30+
}
31+
32+
#endif

Ramstack.Structures/Ramstack.Structures.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Ramstack.Collections.ReadOnlyArray&lt;T&gt;</Description>
5353
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
5454
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
5555
</ItemGroup>
56-
56+
5757

5858
<ItemGroup>
5959
<None Include="..\README.md" Link="Properties\README.md">

0 commit comments

Comments
 (0)