From 412ffd2e2fec08381ba22a11cf200e83b678a7c8 Mon Sep 17 00:00:00 2001 From: Marlon Date: Fri, 13 Nov 2026 02:19:47 +0100 Subject: [PATCH 1/5] chore: normalize line endings with .gitattributes Without it, a checkout with CRLF line endings showed every file as modified. Text files are now stored with LF and checked out with the platform's line ending. Co-Authored-By: Claude Opus 5.5 --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..09d7c60 --- /dev/null +++ b/.gitattributes @@ -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 From 3101384882ccc43c998f8520a5563155fbe30599 Mon Sep 17 00:00:00 2001 From: Marlon Date: Fri, 13 Nov 2026 02:19:54 +0100 Subject: [PATCH 2/5] build!: target .NET 10 and .NET 11 .NET 8 and 9 are no longer targeted. Since every target now has `allows ref struct`, the NET9_0_OR_GREATER conditionals are gone and GenericSpanReader is always compiled. BREAKING CHANGE: the package no longer contains net8.0 and net9.0 builds. Co-Authored-By: Claude Opus 5.5 --- src/Directory.Build.props | 2 +- src/GenericReader.Tests/Tests.cs | 18 +++--------------- src/GenericReader/GenericSpanReader.cs | 4 +--- src/GenericReader/IGenericReader.cs | 2 -- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index fe3e645..30303ce 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,6 +1,6 @@ - net10.0;net9.0;net8.0 + net10.0;net11.0 enable enable true diff --git a/src/GenericReader.Tests/Tests.cs b/src/GenericReader.Tests/Tests.cs index 0f112f2..dae51bd 100644 --- a/src/GenericReader.Tests/Tests.cs +++ b/src/GenericReader.Tests/Tests.cs @@ -5,7 +5,6 @@ namespace GenericReader.Tests; -#if NET9_0_OR_GREATER public class SpanReaderTests : IClassFixture> { private readonly BinaryDataGenerator _gen; @@ -22,7 +21,6 @@ public void ReadAll() _gen.Test(ref reader); } } -#endif public class BufferReaderTests : IClassFixture> { @@ -91,10 +89,7 @@ public void Dispose() } } -public class BinaryDataGenerator where TReader : IGenericReader -#if NET9_0_OR_GREATER - , allows ref struct -#endif +public class BinaryDataGenerator where TReader : IGenericReader, allows ref struct { public byte[] Data { get; } @@ -129,16 +124,9 @@ public void Test(ref TReader reader) } } -public delegate bool VerifyFunc(ref TReader reader) where TReader : IGenericReader -#if NET9_0_OR_GREATER - , allows ref struct -#endif -; +public delegate bool VerifyFunc(ref TReader reader) where TReader : IGenericReader, allows ref struct; -public class BinaryDataValues where TReader : IGenericReader -#if NET9_0_OR_GREATER - , allows ref struct -#endif +public class BinaryDataValues where TReader : IGenericReader, allows ref struct { public List Values { get; } public List> VerifyOperations { get; } diff --git a/src/GenericReader/GenericSpanReader.cs b/src/GenericReader/GenericSpanReader.cs index f19585e..f554dd2 100644 --- a/src/GenericReader/GenericSpanReader.cs +++ b/src/GenericReader/GenericSpanReader.cs @@ -1,5 +1,4 @@ -#if NET9_0_OR_GREATER -using System.Numerics; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; @@ -442,4 +441,3 @@ public Span ReadSpan(int length) where T : struct public void Dispose() { } } -#endif diff --git a/src/GenericReader/IGenericReader.cs b/src/GenericReader/IGenericReader.cs index 3f84f70..19f3b0f 100644 --- a/src/GenericReader/IGenericReader.cs +++ b/src/GenericReader/IGenericReader.cs @@ -12,10 +12,8 @@ public interface IGenericReader : IDisposable public static GenericBufferReader Create(ReadOnlyMemory memory) => new(memory); public static GenericBufferReader Create(Memory memory) => new(memory); -#if NET9_0_OR_GREATER public static GenericSpanReader Create(ReadOnlySpan span) => new(span); public static GenericSpanReader Create(Span span) => new(span); -#endif public static GenericFileReader Create(string filePath) => new(filePath); public static GenericFileReader Create(SafeFileHandle handle) => new(handle); From 60c35e3aca80ec5543746eb7b64a0011dc0151f2 Mon Sep 17 00:00:00 2001 From: Marlon Date: Fri, 13 Nov 2026 02:19:54 +0100 Subject: [PATCH 3/5] chore: update copyright year to 2026 Co-Authored-By: Claude Opus 5.5 --- LICENSE | 2 +- src/Directory.Build.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index d30311f..7f97c0a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 NotOfficer +Copyright (c) 2026 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 diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 30303ce..facde53 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -14,7 +14,7 @@ en NotOfficer - Copyright (c) 2025 NotOfficer + Copyright (c) 2026 NotOfficer From 0d0eedd724dba9458891dd18ac256176b9ffef7c Mon Sep 17 00:00:00 2001 From: Marlon Date: Fri, 13 Nov 2026 02:19:59 +0100 Subject: [PATCH 4/5] test: run tests with xunit.v3 on Microsoft.Testing.Platform Replaces xunit 2 with xunit.v3 and updates the remaining test packages. global.json selects Microsoft.Testing.Platform as the dotnet test runner, and the package references follow the order used in Utils. Co-Authored-By: Claude Opus 5.5 --- src/Directory.Packages.props | 8 ++++---- src/GenericReader.Tests/GenericReader.Tests.csproj | 2 +- src/global.json | 5 +++++ 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 src/global.json diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 6f88828..795ae2f 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -3,9 +3,9 @@ true - - - - + + + + \ No newline at end of file diff --git a/src/GenericReader.Tests/GenericReader.Tests.csproj b/src/GenericReader.Tests/GenericReader.Tests.csproj index edaf586..383cc7f 100644 --- a/src/GenericReader.Tests/GenericReader.Tests.csproj +++ b/src/GenericReader.Tests/GenericReader.Tests.csproj @@ -6,7 +6,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/global.json b/src/global.json new file mode 100644 index 0000000..3140116 --- /dev/null +++ b/src/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} From 58fdce6da04284cf4f8565b7a3422772ac0031f4 Mon Sep 17 00:00:00 2001 From: Marlon Date: Fri, 13 Nov 2026 02:20:07 +0100 Subject: [PATCH 5/5] ci: publish with nuget trusted publishing The publish job now exchanges a GitHub OIDC token for a short-lived NuGet API key instead of using the NUGET_API_KEY secret. It runs in its own job, so restore, build and tests never get the id-token permission. Pull requests run build and tests in a separate Test workflow, and both workflows install the .NET 10 and 11 SDKs. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/build-test-publish.yml | 48 ++++++++++++++++-------- .github/workflows/test.yml | 34 +++++++++++++++++ 2 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 7ba4c31..12d55e1 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -4,26 +4,24 @@ on: push: branches: - master - pull_request: - 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@v6 + - uses: actions/checkout@v7 - name: Setup .NET - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v6 with: - dotnet-version: | - 8.0.x - 9.0.x + dotnet-version: | 10.0.x + 11.0.x - name: Restore dependencies run: dotnet restore @@ -38,14 +36,34 @@ jobs: run: dotnet pack -c Release --no-restore --no-build --output ~/nuget-packages - name: Upload Build Artifact(s) - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0799d81 --- /dev/null +++ b/.github/workflows/test.yml @@ -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