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
48 changes: 33 additions & 15 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
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
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) 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
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -14,7 +14,7 @@
<PropertyGroup>
<NeutralLanguage>en</NeutralLanguage>
<Authors>NotOfficer</Authors>
<Copyright>Copyright (c) 2025 NotOfficer</Copyright>
<Copyright>Copyright (c) 2026 NotOfficer</Copyright>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<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>
2 changes: 1 addition & 1 deletion src/GenericReader.Tests/GenericReader.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.v3" />
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
18 changes: 3 additions & 15 deletions src/GenericReader.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace GenericReader.Tests;

#if NET9_0_OR_GREATER
public class SpanReaderTests : IClassFixture<BinaryDataGenerator<GenericSpanReader>>
{
private readonly BinaryDataGenerator<GenericSpanReader> _gen;
Expand All @@ -22,7 +21,6 @@ public void ReadAll()
_gen.Test(ref reader);
}
}
#endif

public class BufferReaderTests : IClassFixture<BinaryDataGenerator<GenericBufferReader>>
{
Expand Down Expand Up @@ -91,10 +89,7 @@ public void Dispose()
}
}

public class BinaryDataGenerator<TReader> where TReader : IGenericReader
#if NET9_0_OR_GREATER
, allows ref struct
#endif
public class BinaryDataGenerator<TReader> where TReader : IGenericReader, allows ref struct
{
public byte[] Data { get; }

Expand Down Expand Up @@ -129,16 +124,9 @@ public void Test(ref TReader reader)
}
}

public delegate bool VerifyFunc<TReader>(ref TReader reader) where TReader : IGenericReader
#if NET9_0_OR_GREATER
, allows ref struct
#endif
;
public delegate bool VerifyFunc<TReader>(ref TReader reader) where TReader : IGenericReader, allows ref struct;

public class BinaryDataValues<TReader> where TReader : IGenericReader
#if NET9_0_OR_GREATER
, allows ref struct
#endif
public class BinaryDataValues<TReader> where TReader : IGenericReader, allows ref struct
{
public List<object> Values { get; }
public List<VerifyFunc<TReader>> VerifyOperations { get; }
Expand Down
4 changes: 1 addition & 3 deletions src/GenericReader/GenericSpanReader.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -442,4 +441,3 @@ public Span<T> ReadSpan<T>(int length) where T : struct

public void Dispose() { }
}
#endif
2 changes: 0 additions & 2 deletions src/GenericReader/IGenericReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ public interface IGenericReader : IDisposable
public static GenericBufferReader Create(ReadOnlyMemory<byte> memory) => new(memory);
public static GenericBufferReader Create(Memory<byte> memory) => new(memory);

#if NET9_0_OR_GREATER
public static GenericSpanReader Create(ReadOnlySpan<byte> span) => new(span);
public static GenericSpanReader Create(Span<byte> span) => new(span);
#endif

public static GenericFileReader Create(string filePath) => new(filePath);
public static GenericFileReader Create(SafeFileHandle handle) => new(handle);
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