From 8d01ce04b6cb7842ffbcb68e9a2e929113970c88 Mon Sep 17 00:00:00 2001 From: Raju Prasai Date: Thu, 3 Apr 2025 09:35:55 +0545 Subject: [PATCH 1/8] chore: workflow setup --- .github/workflows/publish.yml | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ README.md | 1 + 3 files changed, 64 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2428447 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Build and Publish NuGet Package + +on: + push: + tags: + - "v*" # Only triggers when a version tag (e.g., v1.0.0) is pushed + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: "7.0.x" # Use a single version for publishing + + - name: Restore dependencies + run: dotnet restore NepDate.sln + + - name: Build + run: dotnet build NepDate.sln --configuration Release --no-restore + + - name: Test + run: dotnet test NepDate.sln --configuration Release --no-build --verbosity normal + + - name: Pack + run: dotnet pack src/NepDate/NepDate.csproj --configuration Release --no-build --output nupkgs + + - name: Extract Version from Tag + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - name: Push to NuGet + run: dotnet nuget push nupkgs/NepDate.${VERSION}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2d4a4dc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Run Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: "7.0.x" + + - name: Restore dependencies + run: dotnet restore NepDate.sln + + - name: Build + run: dotnet build NepDate.sln --no-restore + + - name: Test + run: dotnet test NepDate.sln --no-build --verbosity normal diff --git a/README.md b/README.md index 08c219b..b155106 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ [![GitHub Stars](https://img.shields.io/github/stars/TheCrossLegCoder/NepDate)](https://github.com/TheCrossLegCoder/NepDate) [![NuGet Version](https://img.shields.io/nuget/v/NepDate.svg)](https://www.nuget.org/packages/NepDate/) [![NuGet Downloads](https://img.shields.io/nuget/dt/NepDate)](https://www.nuget.org/packages/NepDate/) +[![Tests: Passing](https://img.shields.io/badge/Tests-Passing-brightgreen.svg)](https://github.com/TheCrossLegCoder/NepDate/actions) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) From a4f2bd124a35164fa834434907a9add1fbf7a393 Mon Sep 17 00:00:00 2001 From: Raju Prasai Date: Thu, 3 Apr 2025 15:22:57 +0545 Subject: [PATCH 2/8] chore: workflow fix --- NepDate.sln | 9 --------- tatus -s | 16 ---------------- 2 files changed, 25 deletions(-) delete mode 100644 tatus -s diff --git a/NepDate.sln b/NepDate.sln index 9cd619b..cba8777 100644 --- a/NepDate.sln +++ b/NepDate.sln @@ -17,10 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NepDate.Benchmarks", "bench EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NepDate.DotNetFrameworkBench", "benchmarks\NepDate.DotNetFrameworkBench\NepDate.DotNetFrameworkBench.csproj", "{70FD9D60-2D73-44B5-A1A3-025CB8A86CEC}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Private", "Private", "{AC51FF99-31A3-46CE-B2CF-8EAC970006E7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Scrapper", "Private\Scrapper.csproj", "{CE37A77A-2771-48E1-8E60-894EBBA74607}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NepDate.MemoryBenchmark", "benchmarks\NepDate.MemoryBenchmark\NepDate.MemoryBenchmark.csproj", "{B29A45AB-3D42-49A7-8474-8AF28354024A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NepDateExamples", "src\Examples\NepDateExamples.csproj", "{AD24F79A-0810-4A42-A072-E1BA2857BDC3}" @@ -47,10 +43,6 @@ Global {70FD9D60-2D73-44B5-A1A3-025CB8A86CEC}.Debug|Any CPU.Build.0 = Debug|Any CPU {70FD9D60-2D73-44B5-A1A3-025CB8A86CEC}.Release|Any CPU.ActiveCfg = Release|Any CPU {70FD9D60-2D73-44B5-A1A3-025CB8A86CEC}.Release|Any CPU.Build.0 = Release|Any CPU - {CE37A77A-2771-48E1-8E60-894EBBA74607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CE37A77A-2771-48E1-8E60-894EBBA74607}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CE37A77A-2771-48E1-8E60-894EBBA74607}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CE37A77A-2771-48E1-8E60-894EBBA74607}.Release|Any CPU.Build.0 = Release|Any CPU {B29A45AB-3D42-49A7-8474-8AF28354024A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B29A45AB-3D42-49A7-8474-8AF28354024A}.Debug|Any CPU.Build.0 = Debug|Any CPU {B29A45AB-3D42-49A7-8474-8AF28354024A}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -68,7 +60,6 @@ Global {4089BEE0-2B8D-4DFD-923D-57251972416E} = {2CEBE9E7-F0A8-47E8-8320-82EB088B1381} {98560507-293F-4282-A3E9-83D4A7848B7C} = {F3024C3C-D686-4F00-BA9B-7C9D5E032791} {70FD9D60-2D73-44B5-A1A3-025CB8A86CEC} = {F3024C3C-D686-4F00-BA9B-7C9D5E032791} - {CE37A77A-2771-48E1-8E60-894EBBA74607} = {AC51FF99-31A3-46CE-B2CF-8EAC970006E7} {B29A45AB-3D42-49A7-8474-8AF28354024A} = {F3024C3C-D686-4F00-BA9B-7C9D5E032791} {AD24F79A-0810-4A42-A072-E1BA2857BDC3} = {47E267F0-90BD-4F5B-8905-BF866D593638} EndGlobalSection diff --git a/tatus -s b/tatus -s deleted file mode 100644 index 6edd542..0000000 --- a/tatus -s +++ /dev/null @@ -1,16 +0,0 @@ - src/NepDate/Abilities/Formattable.cs | 4 +- - src/NepDate/Core/Dictionaries/DictionaryBridge.cs | 8 +- - src/NepDate/Exceptions/NepDateException.cs | 5 - - src/NepDate/Extensions/Extensions.cs | 10 +- - src/NepDate/FiscalYear.cs | 4 +- - src/NepDate/NepaliDate.cs | 41 +- - src/NepDate/SmartDateParser.cs | 46 +- - tests/NepDate.Tests/MemoryOptimizationBenchmark.cs | 165 ------ - tests/NepDate.Tests/MemoryUsageTests.cs | 199 -------- - tests/NepDate.Tests/NepDateComprehensiveTests.cs | 556 --------------------- - tests/NepDate.Tests/NepaliDateRangeTests.cs | 438 ---------------- - tests/NepDate.Tests/NepaliDateTests.cs | 97 ---- - tests/NepDate.Tests/SerializationTests.cs | 256 ---------- - tests/NepDate.Tests/SmartDateParserTests.cs | 178 ------- - tests/NepDate.Tests/Usings.cs | 3 + - 15 files changed, 72 insertions(+), 1938 deletions(-) From 79641474fefb8f8d19d75be2117e655fa6dc4b36 Mon Sep 17 00:00:00 2001 From: Raju Prasai Date: Thu, 3 Apr 2025 15:28:12 +0545 Subject: [PATCH 3/8] fix: workflow issue --- .github/workflows/publish.yml | 19 +++++++++++++------ .github/workflows/test.yml | 13 +++++++++---- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2428447..17b9993 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,29 +7,36 @@ on: jobs: build-and-publish: - runs-on: ubuntu-latest + runs-on: windows-latest # Changed to Windows for broader compatibility + + strategy: + matrix: + configuration: [Release] + framework: [net7.0, net9.0, .NETFramework4.8] # Target all frameworks + steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: "7.0.x" # Use a single version for publishing + dotnet-version: ${{ matrix.framework }} # Use matrix value - name: Restore dependencies run: dotnet restore NepDate.sln - name: Build - run: dotnet build NepDate.sln --configuration Release --no-restore + run: dotnet build NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-restore - name: Test - run: dotnet test NepDate.sln --configuration Release --no-build --verbosity normal + run: dotnet test NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-build --verbosity normal - name: Pack - run: dotnet pack src/NepDate/NepDate.csproj --configuration Release --no-build --output nupkgs + run: dotnet pack src/NepDate/NepDate.csproj --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-build --output nupkgs - name: Extract Version from Tag run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - name: Push to NuGet - run: dotnet nuget push nupkgs/NepDate.${VERSION}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + if: matrix.framework == 'net7.0' # Only push once + run: dotnet nuget push nupkgs/NepDate.${VERSION}.${{ matrix.framework }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d4a4dc..7066c6d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,12 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: windows-latest # Changed to Windows + + strategy: + matrix: + configuration: [Debug, Release] + framework: [.NETFramework4.8, net7.0, net9.0] # Include .NET Framework and .NET versions steps: - uses: actions/checkout@v3 @@ -16,13 +21,13 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: "7.0.x" + dotnet-version: ${{ matrix.framework }} # Use matrix to specify .NET version - name: Restore dependencies run: dotnet restore NepDate.sln - name: Build - run: dotnet build NepDate.sln --no-restore + run: dotnet build NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-restore - name: Test - run: dotnet test NepDate.sln --no-build --verbosity normal + run: dotnet test NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-build --verbosity normal From 1ea140e87384cb90fc36df028f3b15476e7411f8 Mon Sep 17 00:00:00 2001 From: Raju Prasai Date: Thu, 3 Apr 2025 15:31:24 +0545 Subject: [PATCH 4/8] chore: extra stuff --- .github/workflows/publish.yml | 6 +++--- .github/workflows/test.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 17b9993..e234b9e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,13 +12,13 @@ jobs: strategy: matrix: configuration: [Release] - framework: [net7.0, net9.0, .NETFramework4.8] # Target all frameworks + framework: [net7.0, net9.0, .NETFramework4.7] # Target all frameworks steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.framework }} # Use matrix value diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7066c6d..4cb6b71 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,13 +13,13 @@ jobs: strategy: matrix: configuration: [Debug, Release] - framework: [.NETFramework4.8, net7.0, net9.0] # Include .NET Framework and .NET versions + framework: [.NETFramework4.7, net7.0, net9.0] # Include .NET Framework and .NET versions steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.framework }} # Use matrix to specify .NET version From 96cd03f2380d40ed5b492d5c299222a976d5fe1c Mon Sep 17 00:00:00 2001 From: Raju Prasai Date: Thu, 3 Apr 2025 15:35:31 +0545 Subject: [PATCH 5/8] chore: fix --- .github/workflows/publish.yml | 6 +++++- .github/workflows/test.yml | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e234b9e..c25b130 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,7 +12,11 @@ jobs: strategy: matrix: configuration: [Release] - framework: [net7.0, net9.0, .NETFramework4.7] # Target all frameworks + framework: [ + net472, # .NET Framework 4.7.2 + 7.0.x, # .NET 7.0 - gets latest patch + 9.0.x, # .NET 9.0 - gets latest patch + ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4cb6b71..a375de5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,12 @@ jobs: strategy: matrix: configuration: [Debug, Release] - framework: [.NETFramework4.7, net7.0, net9.0] # Include .NET Framework and .NET versions + # Use specific versions. For .NET Core/5+, use A.B.x syntax to get the latest patch. + framework: [ + net472, # .NET Framework 4.7.2 + 7.0.x, # .NET 7.0 - gets latest patch + 9.0.x, # .NET 9.0 - gets latest patch + ] steps: - uses: actions/checkout@v4 @@ -27,7 +32,15 @@ jobs: run: dotnet restore NepDate.sln - name: Build - run: dotnet build NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-restore + run: | + dotnet build NepDate.sln \ + --configuration ${{ matrix.configuration }} \ + --framework ${{ matrix.framework }} \ + --no-restore - name: Test - run: dotnet test NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-build --verbosity normal + run: | + dotnet test NepDate.sln \ + --configuration ${{ matrix.configuration }} \ + --framework ${{ matrix.framework }} \ + --no-build --verbosity normal From ab56dcfa2c8ccbd9fcb834c5458934266273a489 Mon Sep 17 00:00:00 2001 From: Raju Prasai Date: Thu, 3 Apr 2025 15:36:38 +0545 Subject: [PATCH 6/8] chore: fix --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c25b130..e8fba45 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,7 +13,7 @@ jobs: matrix: configuration: [Release] framework: [ - net472, # .NET Framework 4.7.2 + 4.7.2, # .NET Framework 4.7.2 7.0.x, # .NET 7.0 - gets latest patch 9.0.x, # .NET 9.0 - gets latest patch ] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a375de5..7326562 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: configuration: [Debug, Release] # Use specific versions. For .NET Core/5+, use A.B.x syntax to get the latest patch. framework: [ - net472, # .NET Framework 4.7.2 + 4.7.2, # .NET Framework 4.7.2 7.0.x, # .NET 7.0 - gets latest patch 9.0.x, # .NET 9.0 - gets latest patch ] From 1b93f3ac68256632707a96266b095f2fdd093b80 Mon Sep 17 00:00:00 2001 From: Raju Prasai Date: Thu, 3 Apr 2025 15:52:19 +0545 Subject: [PATCH 7/8] Update test.yml --- .github/workflows/test.yml | 57 +++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7326562..7f00ec5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Run Tests +name: .NET Tests on: push: @@ -8,39 +8,50 @@ on: jobs: test: - runs-on: windows-latest # Changed to Windows - + name: Test (${{ matrix.os }}, ${{ matrix.dotnet }}) + runs-on: ${{ matrix.os }} strategy: matrix: - configuration: [Debug, Release] - # Use specific versions. For .NET Core/5+, use A.B.x syntax to get the latest patch. - framework: [ - 4.7.2, # .NET Framework 4.7.2 - 7.0.x, # .NET 7.0 - gets latest patch - 9.0.x, # .NET 9.0 - gets latest patch - ] - + include: + - os: ubuntu-latest + dotnet: "7.0.x" + - os: windows-latest + dotnet: "9.0.x" + - os: windows-latest + dotnet: "4.7.2" steps: - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 + - name: Setup .NET ${{ matrix.dotnet }} + if: matrix.dotnet != '4.7.2' + uses: actions/setup-dotnet@v3 with: - dotnet-version: ${{ matrix.framework }} # Use matrix to specify .NET version + dotnet-version: ${{ matrix.dotnet }} + + - name: Install VS Build Tools + if: matrix.dotnet == '4.7.2' + uses: microsoft/setup-msbuild@v1 - name: Restore dependencies - run: dotnet restore NepDate.sln + run: | + if [ "${{ matrix.dotnet }}" = "4.7.2" ]; then + msbuild NepDate.sln /t:Restore /p:RestorePackagesConfig=true + else + dotnet restore NepDate.sln + fi - name: Build run: | - dotnet build NepDate.sln \ - --configuration ${{ matrix.configuration }} \ - --framework ${{ matrix.framework }} \ - --no-restore + if [ "${{ matrix.dotnet }}" = "4.7.2" ]; then + msbuild NepDate.sln /p:Configuration=Release + else + dotnet build NepDate.sln --configuration Release --no-restore + fi - name: Test run: | - dotnet test NepDate.sln \ - --configuration ${{ matrix.configuration }} \ - --framework ${{ matrix.framework }} \ - --no-build --verbosity normal + if [ "${{ matrix.dotnet }}" = "4.7.2" ]; then + msbuild /t:VSTest /p:Configuration=Release /p:VSTestTestCaseFilter="TestCategory!=Integration" NepDate.sln + else + dotnet test NepDate.sln --configuration Release --no-build --verbosity normal + fi From 68f194338bf862ab4b09c66c869afe1987e9df6f Mon Sep 17 00:00:00 2001 From: Sanam <31341013+sanamhub@users.noreply.github.com> Date: Mon, 14 Apr 2025 17:07:12 +0545 Subject: [PATCH 8/8] Update .github/workflows/publish.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e8fba45..27369e6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,5 +42,5 @@ jobs: run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - name: Push to NuGet - if: matrix.framework == 'net7.0' # Only push once + if: matrix.framework == '7.0.x' # Only push once run: dotnet nuget push nupkgs/NepDate.${VERSION}.${{ matrix.framework }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate