From 3027ba2bfe68cbb5723113ebd3649e0c34149da8 Mon Sep 17 00:00:00 2001 From: lumanskiy Date: Sun, 23 Jun 2024 22:14:54 -0700 Subject: [PATCH] Reworked to add unity package support and nuget publishing --- .github/workflows/publish.yml | 49 +++++++++++++++++++ .github/workflows/test.yml | 28 +++++++++++ FixedMath/FixedMath.csproj | 7 --- README.md | 2 +- .../FixedMath.Tests}/Bounding.cs | 0 .../FixedMath.Tests}/FixedMath.Tests.csproj | 2 +- .../FixedMath.Tests}/MatrixTest.cs | 0 .../FixedMath.Tests}/PlaneTest.cs | 0 .../FixedMath.Tests}/PointTest.cs | 0 .../FixedMath.Tests}/QuaternionTest.cs | 0 .../FixedMath.Tests}/RayTest.cs | 0 .../FixedMath.Tests}/RectangleTest.cs | 0 .../FixedMath.Tests}/Usings.cs | 0 .../FixedMath.Tests}/Utility.cs | 0 .../FixedMath.Tests}/Vector2Test.cs | 0 .../FixedMath.Tests}/Vector3Test.cs | 0 .../FixedMath.Tests}/Vector4Test.cs | 0 FixedMath.sln => source/FixedMath.sln | 0 source/FixedMath/FixedMath.csproj | 15 ++++++ .../UnityPackage/Assets/Runtime}/Assembly.cs | 0 .../Assets/Runtime}/ContainmentType.cs | 0 .../Assets/Runtime/Fenrir.FixedMath.asmdef | 14 ++++++ .../UnityPackage/Assets/Runtime}/Fixed.cs | 0 .../Assets/Runtime}/FixedBoundingBox.cs | 0 .../Assets/Runtime}/FixedBoundingFrustum.cs | 0 .../Assets/Runtime}/FixedBoundingSphere.cs | 0 .../Assets/Runtime}/FixedExtensions.cs | 0 .../Assets/Runtime}/FixedMatrix.cs | 0 .../Assets/Runtime}/FixedPlane.cs | 0 .../Runtime}/FixedPlaneIntersectionType.cs | 0 .../Assets/Runtime}/FixedPoint.cs | 0 .../Assets/Runtime}/FixedQuaternion.cs | 0 .../UnityPackage/Assets/Runtime}/FixedRay.cs | 0 .../Assets/Runtime}/FixedRectangle.cs | 0 .../Assets/Runtime}/FixedSinLut.cs | 0 .../Assets/Runtime}/FixedTanLut.cs | 0 .../Assets/Runtime}/FixedVector2.cs | 0 .../Runtime}/FixedVector2TypeConverter.cs | 0 .../Assets/Runtime}/FixedVector3.cs | 0 .../Runtime}/FixedVector3TypeConverter.cs | 0 .../Assets/Runtime}/FixedVector4.cs | 0 .../Runtime}/FixedVector4TypeConverter.cs | 0 .../Assets/Runtime}/FixedVectorConversion.cs | 0 source/UnityPackage/Assets/package.json | 15 ++++++ source/nuget.config | 9 ++++ 45 files changed, 132 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml delete mode 100644 FixedMath/FixedMath.csproj rename {FixedMath.Tests => source/FixedMath.Tests}/Bounding.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/FixedMath.Tests.csproj (92%) rename {FixedMath.Tests => source/FixedMath.Tests}/MatrixTest.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/PlaneTest.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/PointTest.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/QuaternionTest.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/RayTest.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/RectangleTest.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/Usings.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/Utility.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/Vector2Test.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/Vector3Test.cs (100%) rename {FixedMath.Tests => source/FixedMath.Tests}/Vector4Test.cs (100%) rename FixedMath.sln => source/FixedMath.sln (100%) create mode 100644 source/FixedMath/FixedMath.csproj rename {FixedMath => source/UnityPackage/Assets/Runtime}/Assembly.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/ContainmentType.cs (100%) create mode 100644 source/UnityPackage/Assets/Runtime/Fenrir.FixedMath.asmdef rename {FixedMath => source/UnityPackage/Assets/Runtime}/Fixed.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedBoundingBox.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedBoundingFrustum.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedBoundingSphere.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedExtensions.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedMatrix.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedPlane.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedPlaneIntersectionType.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedPoint.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedQuaternion.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedRay.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedRectangle.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedSinLut.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedTanLut.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedVector2.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedVector2TypeConverter.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedVector3.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedVector3TypeConverter.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedVector4.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedVector4TypeConverter.cs (100%) rename {FixedMath => source/UnityPackage/Assets/Runtime}/FixedVectorConversion.cs (100%) create mode 100644 source/UnityPackage/Assets/package.json create mode 100644 source/nuget.config diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c9bfe47 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,49 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + deploy-upm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + registry-url: https://upm.fenrirserver.org/ + + - run: npm publish + working-directory: source/UnityPackage/Assets + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + deploy-nuget: + runs-on: ubuntu-latest + defaults: + run: + working-directory: source + steps: + - uses: actions/checkout@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: | + 8.0.x + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build -c Release --no-restore + + - name: Test + run: dotnet test -c Release --no-build --verbosity normal -p:ParallelizeTestCollections=false + + - name: Build solution and generate NuGet package + run: dotnet pack Fenrir.FixedMath -c Release + + - name: Push generated package to NuGet + run: dotnet nuget push ./Fenrir.FixedMath/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN --skip-duplicate + env: + NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e37ee5e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Test + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: source + steps: + - uses: actions/checkout@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: | + 8.0.x + + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal -p:ParallelizeTestCollections=false diff --git a/FixedMath/FixedMath.csproj b/FixedMath/FixedMath.csproj deleted file mode 100644 index dbc1517..0000000 --- a/FixedMath/FixedMath.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - net6.0 - - - diff --git a/README.md b/README.md index d1f48ec..3157958 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Fixed Math Library +# Fixed Math Library for C# (.NET and Unity) A deterministic fixed-math library based on [FixedMath.Net](https://github.com/asik/FixedMath.Net/) and [MonoGame](https://github.com/MonoGame/MonoGame) Math structures. diff --git a/FixedMath.Tests/Bounding.cs b/source/FixedMath.Tests/Bounding.cs similarity index 100% rename from FixedMath.Tests/Bounding.cs rename to source/FixedMath.Tests/Bounding.cs diff --git a/FixedMath.Tests/FixedMath.Tests.csproj b/source/FixedMath.Tests/FixedMath.Tests.csproj similarity index 92% rename from FixedMath.Tests/FixedMath.Tests.csproj rename to source/FixedMath.Tests/FixedMath.Tests.csproj index 39adc96..974adb9 100644 --- a/FixedMath.Tests/FixedMath.Tests.csproj +++ b/source/FixedMath.Tests/FixedMath.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false diff --git a/FixedMath.Tests/MatrixTest.cs b/source/FixedMath.Tests/MatrixTest.cs similarity index 100% rename from FixedMath.Tests/MatrixTest.cs rename to source/FixedMath.Tests/MatrixTest.cs diff --git a/FixedMath.Tests/PlaneTest.cs b/source/FixedMath.Tests/PlaneTest.cs similarity index 100% rename from FixedMath.Tests/PlaneTest.cs rename to source/FixedMath.Tests/PlaneTest.cs diff --git a/FixedMath.Tests/PointTest.cs b/source/FixedMath.Tests/PointTest.cs similarity index 100% rename from FixedMath.Tests/PointTest.cs rename to source/FixedMath.Tests/PointTest.cs diff --git a/FixedMath.Tests/QuaternionTest.cs b/source/FixedMath.Tests/QuaternionTest.cs similarity index 100% rename from FixedMath.Tests/QuaternionTest.cs rename to source/FixedMath.Tests/QuaternionTest.cs diff --git a/FixedMath.Tests/RayTest.cs b/source/FixedMath.Tests/RayTest.cs similarity index 100% rename from FixedMath.Tests/RayTest.cs rename to source/FixedMath.Tests/RayTest.cs diff --git a/FixedMath.Tests/RectangleTest.cs b/source/FixedMath.Tests/RectangleTest.cs similarity index 100% rename from FixedMath.Tests/RectangleTest.cs rename to source/FixedMath.Tests/RectangleTest.cs diff --git a/FixedMath.Tests/Usings.cs b/source/FixedMath.Tests/Usings.cs similarity index 100% rename from FixedMath.Tests/Usings.cs rename to source/FixedMath.Tests/Usings.cs diff --git a/FixedMath.Tests/Utility.cs b/source/FixedMath.Tests/Utility.cs similarity index 100% rename from FixedMath.Tests/Utility.cs rename to source/FixedMath.Tests/Utility.cs diff --git a/FixedMath.Tests/Vector2Test.cs b/source/FixedMath.Tests/Vector2Test.cs similarity index 100% rename from FixedMath.Tests/Vector2Test.cs rename to source/FixedMath.Tests/Vector2Test.cs diff --git a/FixedMath.Tests/Vector3Test.cs b/source/FixedMath.Tests/Vector3Test.cs similarity index 100% rename from FixedMath.Tests/Vector3Test.cs rename to source/FixedMath.Tests/Vector3Test.cs diff --git a/FixedMath.Tests/Vector4Test.cs b/source/FixedMath.Tests/Vector4Test.cs similarity index 100% rename from FixedMath.Tests/Vector4Test.cs rename to source/FixedMath.Tests/Vector4Test.cs diff --git a/FixedMath.sln b/source/FixedMath.sln similarity index 100% rename from FixedMath.sln rename to source/FixedMath.sln diff --git a/source/FixedMath/FixedMath.csproj b/source/FixedMath/FixedMath.csproj new file mode 100644 index 0000000..631a0fd --- /dev/null +++ b/source/FixedMath/FixedMath.csproj @@ -0,0 +1,15 @@ + + + + net8.0 + true + true + Deterministic fixed-math library based on FixedMath.Net and MonoGame Math structures + 1.0.0 + + + + + + + diff --git a/FixedMath/Assembly.cs b/source/UnityPackage/Assets/Runtime/Assembly.cs similarity index 100% rename from FixedMath/Assembly.cs rename to source/UnityPackage/Assets/Runtime/Assembly.cs diff --git a/FixedMath/ContainmentType.cs b/source/UnityPackage/Assets/Runtime/ContainmentType.cs similarity index 100% rename from FixedMath/ContainmentType.cs rename to source/UnityPackage/Assets/Runtime/ContainmentType.cs diff --git a/source/UnityPackage/Assets/Runtime/Fenrir.FixedMath.asmdef b/source/UnityPackage/Assets/Runtime/Fenrir.FixedMath.asmdef new file mode 100644 index 0000000..d517dd5 --- /dev/null +++ b/source/UnityPackage/Assets/Runtime/Fenrir.FixedMath.asmdef @@ -0,0 +1,14 @@ +{ + "name": "Fenrir.FixedMath", + "rootNamespace": "", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/FixedMath/Fixed.cs b/source/UnityPackage/Assets/Runtime/Fixed.cs similarity index 100% rename from FixedMath/Fixed.cs rename to source/UnityPackage/Assets/Runtime/Fixed.cs diff --git a/FixedMath/FixedBoundingBox.cs b/source/UnityPackage/Assets/Runtime/FixedBoundingBox.cs similarity index 100% rename from FixedMath/FixedBoundingBox.cs rename to source/UnityPackage/Assets/Runtime/FixedBoundingBox.cs diff --git a/FixedMath/FixedBoundingFrustum.cs b/source/UnityPackage/Assets/Runtime/FixedBoundingFrustum.cs similarity index 100% rename from FixedMath/FixedBoundingFrustum.cs rename to source/UnityPackage/Assets/Runtime/FixedBoundingFrustum.cs diff --git a/FixedMath/FixedBoundingSphere.cs b/source/UnityPackage/Assets/Runtime/FixedBoundingSphere.cs similarity index 100% rename from FixedMath/FixedBoundingSphere.cs rename to source/UnityPackage/Assets/Runtime/FixedBoundingSphere.cs diff --git a/FixedMath/FixedExtensions.cs b/source/UnityPackage/Assets/Runtime/FixedExtensions.cs similarity index 100% rename from FixedMath/FixedExtensions.cs rename to source/UnityPackage/Assets/Runtime/FixedExtensions.cs diff --git a/FixedMath/FixedMatrix.cs b/source/UnityPackage/Assets/Runtime/FixedMatrix.cs similarity index 100% rename from FixedMath/FixedMatrix.cs rename to source/UnityPackage/Assets/Runtime/FixedMatrix.cs diff --git a/FixedMath/FixedPlane.cs b/source/UnityPackage/Assets/Runtime/FixedPlane.cs similarity index 100% rename from FixedMath/FixedPlane.cs rename to source/UnityPackage/Assets/Runtime/FixedPlane.cs diff --git a/FixedMath/FixedPlaneIntersectionType.cs b/source/UnityPackage/Assets/Runtime/FixedPlaneIntersectionType.cs similarity index 100% rename from FixedMath/FixedPlaneIntersectionType.cs rename to source/UnityPackage/Assets/Runtime/FixedPlaneIntersectionType.cs diff --git a/FixedMath/FixedPoint.cs b/source/UnityPackage/Assets/Runtime/FixedPoint.cs similarity index 100% rename from FixedMath/FixedPoint.cs rename to source/UnityPackage/Assets/Runtime/FixedPoint.cs diff --git a/FixedMath/FixedQuaternion.cs b/source/UnityPackage/Assets/Runtime/FixedQuaternion.cs similarity index 100% rename from FixedMath/FixedQuaternion.cs rename to source/UnityPackage/Assets/Runtime/FixedQuaternion.cs diff --git a/FixedMath/FixedRay.cs b/source/UnityPackage/Assets/Runtime/FixedRay.cs similarity index 100% rename from FixedMath/FixedRay.cs rename to source/UnityPackage/Assets/Runtime/FixedRay.cs diff --git a/FixedMath/FixedRectangle.cs b/source/UnityPackage/Assets/Runtime/FixedRectangle.cs similarity index 100% rename from FixedMath/FixedRectangle.cs rename to source/UnityPackage/Assets/Runtime/FixedRectangle.cs diff --git a/FixedMath/FixedSinLut.cs b/source/UnityPackage/Assets/Runtime/FixedSinLut.cs similarity index 100% rename from FixedMath/FixedSinLut.cs rename to source/UnityPackage/Assets/Runtime/FixedSinLut.cs diff --git a/FixedMath/FixedTanLut.cs b/source/UnityPackage/Assets/Runtime/FixedTanLut.cs similarity index 100% rename from FixedMath/FixedTanLut.cs rename to source/UnityPackage/Assets/Runtime/FixedTanLut.cs diff --git a/FixedMath/FixedVector2.cs b/source/UnityPackage/Assets/Runtime/FixedVector2.cs similarity index 100% rename from FixedMath/FixedVector2.cs rename to source/UnityPackage/Assets/Runtime/FixedVector2.cs diff --git a/FixedMath/FixedVector2TypeConverter.cs b/source/UnityPackage/Assets/Runtime/FixedVector2TypeConverter.cs similarity index 100% rename from FixedMath/FixedVector2TypeConverter.cs rename to source/UnityPackage/Assets/Runtime/FixedVector2TypeConverter.cs diff --git a/FixedMath/FixedVector3.cs b/source/UnityPackage/Assets/Runtime/FixedVector3.cs similarity index 100% rename from FixedMath/FixedVector3.cs rename to source/UnityPackage/Assets/Runtime/FixedVector3.cs diff --git a/FixedMath/FixedVector3TypeConverter.cs b/source/UnityPackage/Assets/Runtime/FixedVector3TypeConverter.cs similarity index 100% rename from FixedMath/FixedVector3TypeConverter.cs rename to source/UnityPackage/Assets/Runtime/FixedVector3TypeConverter.cs diff --git a/FixedMath/FixedVector4.cs b/source/UnityPackage/Assets/Runtime/FixedVector4.cs similarity index 100% rename from FixedMath/FixedVector4.cs rename to source/UnityPackage/Assets/Runtime/FixedVector4.cs diff --git a/FixedMath/FixedVector4TypeConverter.cs b/source/UnityPackage/Assets/Runtime/FixedVector4TypeConverter.cs similarity index 100% rename from FixedMath/FixedVector4TypeConverter.cs rename to source/UnityPackage/Assets/Runtime/FixedVector4TypeConverter.cs diff --git a/FixedMath/FixedVectorConversion.cs b/source/UnityPackage/Assets/Runtime/FixedVectorConversion.cs similarity index 100% rename from FixedMath/FixedVectorConversion.cs rename to source/UnityPackage/Assets/Runtime/FixedVectorConversion.cs diff --git a/source/UnityPackage/Assets/package.json b/source/UnityPackage/Assets/package.json new file mode 100644 index 0000000..899f839 --- /dev/null +++ b/source/UnityPackage/Assets/package.json @@ -0,0 +1,15 @@ +{ + "name": "org.fenrirserver.fixedmath", + "displayName": "Fenrir Fixed Math", + "description": "A deterministic fixed-math library based on FixedMath.Net and MonoGame Math structures.", + "license": "MIT", + "version": "1.0.0", + "author": { + "name": "Fenrir", + "email": "info@fenrirserver.com", + "url": "https://fenrirserver.com" + }, + "unity": "2018.3", + "dependencies": { + } +} \ No newline at end of file diff --git a/source/nuget.config b/source/nuget.config new file mode 100644 index 0000000..b66793e --- /dev/null +++ b/source/nuget.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file