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
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Store text files with LF in the repository and check them out with the platform's line ending (CRLF on Windows).
* text=auto

*.png binary
40 changes: 31 additions & 9 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ on:
branches:
- master

defaults:
run:
working-directory: src
permissions:
contents: read

jobs:
build-test-publish:
build-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: src
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
dotnet-version: |
10.0.x
11.0.x

- name: Restore dependencies
run: dotnet restore
Expand All @@ -27,8 +30,7 @@ jobs:
run: dotnet build -c Release --no-restore

- name: Run Tests
working-directory: src/Usmap.NET.Tests
run: dotnet run -c Release --no-restore --no-build
run: dotnet test -c Release --no-restore --no-build -v normal

- name: Pack NuGet Package(s)
run: dotnet pack -c Release --no-restore --no-build --output ~/nuget-packages
Expand All @@ -39,9 +41,29 @@ jobs:
name: nuget-packages
path: ~/nuget-packages

# A separate job, so restore, build and tests never run with the OIDC token permission.
publish:
needs: build-test
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download Build Artifact(s)
uses: actions/download-artifact@v8
with:
name: nuget-packages
path: nuget-packages

# Exchanges the GitHub OIDC token for an API key that is valid for one hour.
- name: NuGet Login
id: login
uses: NuGet/login@v1
with:
user: Fortnite-API

- name: Push NuGet Package(s)
run: |
dotnet nuget push ~/nuget-packages/*.nupkg \
dotnet nuget push nuget-packages/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key ${{ secrets.NUGET_API_KEY }} \
--api-key ${{ steps.login.outputs.NUGET_API_KEY }} \
--skip-duplicate
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test

on:
pull_request:
branches:
- master

permissions:
contents: read

defaults:
run:
working-directory: src

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
10.0.x
11.0.x

- name: Restore dependencies
run: dotnet restore

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

- name: Run Tests
run: dotnet test -c Release --no-restore --no-build -v normal
3 changes: 1 addition & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<PublishAot>true</PublishAot>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

Expand Down
12 changes: 6 additions & 6 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="GenericReader" Version="2.3.0" />
<PackageVersion Include="OffiUtils" Version="3.2.0" />
<PackageVersion Include="GenericReader" Version="3.0.0" />
<PackageVersion Include="OffiUtils" Version="4.0.0" />
<PackageVersion Include="OodleSharp" Version="0.0.1" />
<PackageVersion Include="NetEscapades.EnumGenerators" Version="1.0.0-beta21" />
<PackageVersion Include="ZstdSharp.Port" Version="0.8.8" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.10.1" />
<PackageVersion Include="xunit.v3" Version="4.0.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.0" />
<PackageVersion Include="coverlet.collector" Version="10.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
<PackageVersion Include="xunit.v3" Version="4.0.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.1" />
<PackageVersion Include="coverlet.collector" Version="10.1.0" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/Usmap.NET.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace UsmapDotNet.Tests;

public static class Constants
{
#if !NET11_0_OR_GREATER
public static bool TryDecompressZstd(
ReadOnlySpan<byte> source,
Span<byte> destination,
Expand All @@ -16,12 +17,15 @@ public static bool TryDecompressZstd(
using var decompressor = new Decompressor();
return decompressor.TryUnwrap(source, destination, out bytesWritten);
}
#endif

public static UsmapOptions UsmapOptions { get; } = new()
{
Decompressor = DecompressorBuilder.Default
.Add(CompressionAlgorithm.Oodle, OodleDecompressor.TryDecompress)
#if !NET11_0_OR_GREATER
.Add(CompressionAlgorithm.Zstd, TryDecompressZstd)
#endif
.Build()
};

Expand Down
2 changes: 1 addition & 1 deletion src/Usmap.NET/Usmap.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<Description>A .NET parser for .usmap files</Description>
<PackageTags>usmap</PackageTags>
<Version>3.3.0</Version>
<Version>3.4.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
5 changes: 5 additions & 0 deletions src/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
Loading