Skip to content

Commit

Permalink
.net8 + nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
NotOfficer committed Mar 31, 2024
1 parent 1166c1a commit ca26010
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 14 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/nuget_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: NuGet Push

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore ./src

- name: Build
run: dotnet build ./src --no-restore --configuration Release

- name: Pack NuGet Package(s)
run: dotnet pack ./src --no-restore --no-build --configuration Release --output ./nuget-packages

- name: Upload Build Artifact(s)
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./nuget-packages

- name: Push NuGet Package(s)
run: dotnet nuget push ./nuget-packages/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Marlon
Copyright (c) 2024 NotOfficer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div align="center">

# Utils

Utils for .NET

[![GitHub release](https://img.shields.io/github/v/release/NotOfficer/Utils?logo=github)](https://github.com/NotOfficer/Utils/releases/latest) [![Nuget](https://img.shields.io/nuget/v/OffiUtils?logo=nuget)](https://www.nuget.org/packages/OffiUtils) ![Nuget DLs](https://img.shields.io/nuget/dt/OffiUtils?logo=nuget) [![GitHub issues](https://img.shields.io/github/issues/NotOfficer/Utils?logo=github)](https://github.com/NotOfficer/Utils/issues) [![GitHub License](https://img.shields.io/github/license/NotOfficer/Utils)](https://github.com/NotOfficer/Utils/blob/master/LICENSE)

</div>

### NuGet

```md
Install-Package OffiUtils
```
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/OffiUtils.Tests/JsonUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public void TryUnescape()
var result = JsonUtils.GetUnescapedString(escapedBytes);
Assert.Equal(unescaped.Replace("\r", ""), result);
}
}
}
2 changes: 1 addition & 1 deletion src/OffiUtils.Tests/MemoryUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ public void AsSpan()
span.Fill(0x69_240);
Assert.All(array, x => Assert.Equal(0x69_240, x));
}
}
}
10 changes: 5 additions & 5 deletions src/OffiUtils.Tests/OffiUtils.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,13 +10,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/OffiUtils.Tests/StringUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ public void ToUpper()
StringUtils.ToUpperAsciiInvariant(str);
Assert.Equal("ABC", str);
}
}
}
2 changes: 1 addition & 1 deletion src/OffiUtils/Delegates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

internal delegate string FastAllocateStringDelegate(int length);
internal delegate ref char GetRawStringDataDelegate(string instance);
internal delegate bool TryUnescapeDelegate(ReadOnlySpan<byte> source, Span<byte> destination, out int written);
internal delegate bool TryUnescapeDelegate(ReadOnlySpan<byte> source, Span<byte> destination, out int written);
2 changes: 1 addition & 1 deletion src/OffiUtils/JsonUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public static string GetUnescapedString(ReadOnlySpan<byte> utf8Source)

return utf8String;
}
}
}
2 changes: 1 addition & 1 deletion src/OffiUtils/MemoryUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public static Span<T> AsSpan<T>(ReadOnlySpan<T> readonlySpan)
ref var reference = ref MemoryMarshal.GetReference(readonlySpan);
return MemoryMarshal.CreateSpan(ref reference, readonlySpan.Length);
}
}
}
29 changes: 28 additions & 1 deletion src/OffiUtils/OffiUtils.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Authors>NotOfficer</Authors>
<Company>NotOfficer</Company>
<Description>Utils for .NET</Description>
<Copyright>Copyright (c) 2024 NotOfficer</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/NotOfficer/Utils</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/NotOfficer/Utils</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>utils</PackageTags>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<Version>1.0.0</Version>
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/OffiUtils/StringUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ public static string RealClone(string value)
value.AsSpan().CopyTo(GetSpan(clone));
return clone;
}
}
}

0 comments on commit ca26010

Please sign in to comment.