From 36e98dd14c06f8fdfa9f06f3bdca24f5d74682a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:55:33 +0000 Subject: [PATCH 01/17] Initial plan From f3b6af6849f078a08ae587d435dd1cc7aed7782d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 17:13:34 +0000 Subject: [PATCH 02/17] Remove AutoMapper dependency, replace with manual property mapping Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@users.noreply.github.com> Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/4f8a1d14-bc20-46dc-974c-386441953c2d --- .../FastText.NetWrapper.csproj | 1 - FastText.NetWrapper/FastTextArgs.cs | 55 ++++++++----- FastText.NetWrapper/FastTextWrapper.cs | 82 ++++++++++++------- 3 files changed, 90 insertions(+), 48 deletions(-) diff --git a/FastText.NetWrapper/FastText.NetWrapper.csproj b/FastText.NetWrapper/FastText.NetWrapper.csproj index 5fadc90..2432584 100644 --- a/FastText.NetWrapper/FastText.NetWrapper.csproj +++ b/FastText.NetWrapper/FastText.NetWrapper.csproj @@ -13,7 +13,6 @@ - diff --git a/FastText.NetWrapper/FastTextArgs.cs b/FastText.NetWrapper/FastTextArgs.cs index 5bf9c3e..2301bd0 100644 --- a/FastText.NetWrapper/FastTextArgs.cs +++ b/FastText.NetWrapper/FastTextArgs.cs @@ -1,5 +1,4 @@ using System.Runtime.InteropServices; -using AutoMapper; namespace FastText.NetWrapper; @@ -40,8 +39,8 @@ public unsafe QuantizedSupervisedArgs() FastTextWrapper.FastTextArgsStruct* argsPtr; GetDefaultSupervisedArgs(new IntPtr(&argsPtr)); - - Mapper.Map(*argsPtr, this); + + MapFromStruct(*argsPtr); DestroyArgs(new IntPtr(argsPtr)); } @@ -87,7 +86,7 @@ public unsafe SupervisedArgs() GetDefaultSupervisedArgs(new IntPtr(&argsPtr)); - Mapper.Map(*argsPtr, this); + MapFromStruct(*argsPtr); DestroyArgs(new IntPtr(argsPtr)); } @@ -120,20 +119,6 @@ public abstract class FastTextArgs #endregion - protected static readonly IMapper Mapper; - - static FastTextArgs() - { - Mapper = new MapperConfiguration(config => - { - config.ShouldMapProperty = prop => prop.GetMethod.IsPublic || prop.GetMethod.IsAssembly; - config.CreateMap(); - config.CreateMap(); - config.CreateMap(); - config.CreateMap(); - }).CreateMapper(); - } - /// /// This constructor gets values from /// https://github.com/olegtarasov/fastText/blob/b0a32d744f4d16d8f9834649f6f178ff79b5a4ce/src/fasttext_api.cc#L12 @@ -146,11 +131,43 @@ protected unsafe FastTextArgs() GetDefaultArgs(new IntPtr(&argsPtr)); - Mapper.Map(*argsPtr, this); + MapFromStruct(*argsPtr); DestroyArgs(new IntPtr(argsPtr)); } + protected void MapFromStruct(FastTextWrapper.FastTextArgsStruct argsStruct) + { + lr = argsStruct.lr; + lrUpdateRate = argsStruct.lrUpdateRate; + dim = argsStruct.dim; + ws = argsStruct.ws; + epoch = argsStruct.epoch; + minCount = argsStruct.minCount; + minCountLabel = argsStruct.minCountLabel; + neg = argsStruct.neg; + wordNgrams = argsStruct.wordNgrams; + loss = (LossName)argsStruct.loss; + model = (ModelName)argsStruct.model; + bucket = argsStruct.bucket; + minn = argsStruct.minn; + maxn = argsStruct.maxn; + thread = argsStruct.thread; + t = argsStruct.t; + verbose = argsStruct.verbose; + saveOutput = argsStruct.saveOutput; + seed = argsStruct.seed; + + if (this is QuantizedSupervisedArgs quantized) + { + quantized.qout = argsStruct.qout; + quantized.retrain = argsStruct.retrain; + quantized.qnorm = argsStruct.qnorm; + quantized.cutoff = argsStruct.cutoff; + quantized.dsub = argsStruct.dsub; + } + } + /// /// learning rate [0.1] /// diff --git a/FastText.NetWrapper/FastTextWrapper.cs b/FastText.NetWrapper/FastTextWrapper.cs index 7067a1e..5992a14 100644 --- a/FastText.NetWrapper/FastTextWrapper.cs +++ b/FastText.NetWrapper/FastTextWrapper.cs @@ -1,6 +1,5 @@ using System.Runtime.InteropServices; using System.Text; -using AutoMapper; using Microsoft.Extensions.Logging; namespace FastText.NetWrapper; @@ -12,7 +11,6 @@ public partial class FastTextWrapper : IDisposable { private static readonly Encoding _utf8 = Encoding.UTF8; - private readonly IMapper _mapper; private readonly ILogger _logger; private IntPtr _fastText; @@ -25,17 +23,6 @@ public partial class FastTextWrapper : IDisposable public FastTextWrapper(ILoggerFactory loggerFactory = null) { _logger = loggerFactory?.CreateLogger(); - - _mapper = new MapperConfiguration(config => - { - config.ShouldMapProperty = prop => prop.GetMethod.IsPublic || prop.GetMethod.IsAssembly; - config.CreateMap(); - config.CreateMap(); - config.CreateMap(); - config.CreateMap(); - }) - .CreateMapper(); - _fastText = CreateFastText(); } @@ -54,17 +41,6 @@ public FastTextWrapper(ILoggerFactory loggerFactory = null) public FastTextWrapper(bool useBundledLibrary, ILoggerFactory loggerFactory = null) { _logger = loggerFactory?.CreateLogger(); - - _mapper = new MapperConfiguration(config => - { - config.ShouldMapProperty = prop => prop.GetMethod.IsPublic || prop.GetMethod.IsAssembly; - config.CreateMap(); - config.CreateMap(); - config.CreateMap(); - config.CreateMap(); - }) - .CreateMapper(); - _fastText = CreateFastText(); } @@ -220,10 +196,10 @@ internal void Supervised(string inputPath, string outputPath, SupervisedArgs arg bool quantizeWithNoQuantTune = quantizedArgs != null && string.IsNullOrEmpty(autotuneArgs.ModelSize); - var argsStruct = _mapper.Map(args); + var argsStruct = ToArgsStruct(args); argsStruct.model = model_name.sup; - var autotuneStruct = _mapper.Map(autotuneArgs); + var autotuneStruct = ToAutotuneArgsStruct(autotuneArgs); CheckForErrors(Train( _fastText, inputPath, @@ -273,7 +249,7 @@ public void Unsupervised(UnsupervisedModel model, string inputPath, string outpu args.model = (ModelName)model; - var argsStruct = _mapper.Map(args); + var argsStruct = ToArgsStruct(args); CheckForErrors(Train( _fastText, inputPath, @@ -305,7 +281,7 @@ public void Quantize(QuantizedSupervisedArgs args, string output = null) if (string.IsNullOrEmpty(ModelPath) && string.IsNullOrEmpty(output)) throw new InvalidOperationException("Model was loaded from memory. You need to specify output path."); - var argsStruct = _mapper.Map(args); + var argsStruct = ToArgsStruct(args); string outPath = AdjustPath(string.IsNullOrEmpty(output) ? ModelPath : output, true); if ((Path.IsPathRooted(output) && !Directory.Exists(Path.GetDirectoryName(outPath)))) @@ -502,6 +478,56 @@ public void Dispose() _fastText = IntPtr.Zero; } + private static FastTextArgsStruct ToArgsStruct(FastTextArgs args) + { + var result = new FastTextArgsStruct + { + lr = args.lr, + lrUpdateRate = args.lrUpdateRate, + dim = args.dim, + ws = args.ws, + epoch = args.epoch, + minCount = args.minCount, + minCountLabel = args.minCountLabel, + neg = args.neg, + wordNgrams = args.wordNgrams, + loss = (loss_name)args.loss, + model = (model_name)args.model, + bucket = args.bucket, + minn = args.minn, + maxn = args.maxn, + thread = args.thread, + t = args.t, + verbose = args.verbose, + saveOutput = args.saveOutput, + seed = args.seed + }; + + if (args is QuantizedSupervisedArgs quantized) + { + result.qout = quantized.qout; + result.retrain = quantized.retrain; + result.qnorm = quantized.qnorm; + result.cutoff = quantized.cutoff; + result.dsub = quantized.dsub; + } + + return result; + } + + private static AutotuneArgsStruct ToAutotuneArgsStruct(AutotuneArgs args) + { + return new AutotuneArgsStruct + { + ValidationFile = args.ValidationFile, + Metric = args.Metric, + Predictions = args.Predictions, + Duration = args.Duration, + ModelSize = args.ModelSize, + Verbose = args.Verbose + }; + } + private string AdjustPath(string path, bool isQuantized) { string result = Path.HasExtension(path) ? Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)) : path; From 7290ad68f2d19dab3d163fa61cd3bce3b5248de1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 09:28:33 +0000 Subject: [PATCH 03/17] Initial plan From 75cb70d17200d89cf3b7f8ee9bcb3940937dcd0d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 09:30:52 +0000 Subject: [PATCH 04/17] Initial plan From 3d6f17b630d99e9f0ab26636fe0dd3a312aeecc2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 09:32:15 +0000 Subject: [PATCH 05/17] Remove AutoMapper dependency from nuspec file Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/1b48ca3f-b1f8-4149-8de3-35cd1f5c4feb Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@users.noreply.github.com> --- FastText.NetWrapper/FastText.NetWrapper.nuspec | 1 - 1 file changed, 1 deletion(-) diff --git a/FastText.NetWrapper/FastText.NetWrapper.nuspec b/FastText.NetWrapper/FastText.NetWrapper.nuspec index 9b04b20..834a57e 100644 --- a/FastText.NetWrapper/FastText.NetWrapper.nuspec +++ b/FastText.NetWrapper/FastText.NetWrapper.nuspec @@ -13,7 +13,6 @@ - From 215dc180945c70184f4f7ffa86cf3becd421ec96 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 09:33:17 +0000 Subject: [PATCH 06/17] Initial plan From 1a6e9b3ea5cf626702e9ae63458f6d81b3c7750a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 09:35:59 +0000 Subject: [PATCH 07/17] Remove AutoMapper dependency from nuspec Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/3ab7d767-3d26-4149-bdf7-0a60df5a755d Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@users.noreply.github.com> --- FastText.NetWrapper/FastText.NetWrapper.nuspec | 1 - 1 file changed, 1 deletion(-) diff --git a/FastText.NetWrapper/FastText.NetWrapper.nuspec b/FastText.NetWrapper/FastText.NetWrapper.nuspec index 9b04b20..834a57e 100644 --- a/FastText.NetWrapper/FastText.NetWrapper.nuspec +++ b/FastText.NetWrapper/FastText.NetWrapper.nuspec @@ -13,7 +13,6 @@ - From 0253a3d5d28cd1a197a3242bc8fd9d7ad16908b5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 09:43:31 +0000 Subject: [PATCH 08/17] Add ci.yml skeleton Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/3b911b56-bca6-4835-8de4-1efb167fab6c Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@users.noreply.github.com> --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..57d17b4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + workflow_call: + inputs: + version: + type: string + required: false + description: Package version to use for NuGet pack + +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_NOLOGO: 1 + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Run tests + run: dotnet test + + - name: Pack + if: ${{ matrix.os == 'ubuntu-latest' }} + run: dotnet pack FastText.NetWrapper --configuration Release ${{ inputs.version && format('-p:PackageVersion={0}', inputs.version) || '' }} -o Artifacts + + - name: Upload NuGet packages + if: ${{ matrix.os == 'ubuntu-latest' }} + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: Artifacts/*.nupkg From 340da68a6f22e07cdd8f2bb2f494694dd07b626c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 09:47:17 +0000 Subject: [PATCH 09/17] Switch to 2-stage CI/Publish workflow with MinVer and CrispThinking package name Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/3b911b56-bca6-4835-8de4-1efb167fab6c Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@users.noreply.github.com> --- .github/workflows/BuildAndPublish.yml | 44 ------------------- .github/workflows/ci.yml | 40 ++++++++++++----- .github/workflows/publish.yml | 36 +++++++++++++++ .../FastText.NetWrapper.csproj | 6 +++ .../FastText.NetWrapper.nuspec | 14 +++--- 5 files changed, 78 insertions(+), 62 deletions(-) delete mode 100644 .github/workflows/BuildAndPublish.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/BuildAndPublish.yml b/.github/workflows/BuildAndPublish.yml deleted file mode 100644 index a06a3f3..0000000 --- a/.github/workflows/BuildAndPublish.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Build and publish - -on: - push: - tags: - - "*" - -jobs: - test: - if: ${{ !contains(github.event.head_commit.message, 'skip ci') }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 8.0.402 - - - name: Run tests - run: dotnet test - build: - needs: test - if: ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, 'skip ci') }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: olegtarasov/get-tag@v2.1.3 - - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 8.0.402 - - - name: Create the package - run: dotnet pack FastText.NetWrapper --configuration Release -p:PackageVersion=$GIT_TAG_NAME -o . - - - name: Push the package - env: - APIKEY: ${{ secrets.NugetKey }} - run: dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k $APIKEY diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57d17b4..a1cb8cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,6 @@ name: CI +# Trigger on pushes and pull requests to the main branch. on: push: branches: @@ -8,12 +9,14 @@ on: branches: - main workflow_dispatch: - workflow_call: - inputs: - version: - type: string - required: false - description: Package version to use for NuGet pack + workflow_call: # Allows the workflow to be called by other workflows + +# Set permissions for the workflow. +permissions: + contents: write + pull-requests: write + checks: write + packages: read env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 @@ -24,23 +27,38 @@ jobs: build: runs-on: ${{ matrix.os }} strategy: - fail-fast: false + fail-fast: false # This allows the matrix jobs to run independently. matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, windows-latest, macos-latest] + steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup .NET Core uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - - name: Run tests - run: dotnet test + - name: Restore dependencies + run: dotnet restore FastText.NetWrapper.sln + + - name: Build + run: dotnet build FastText.NetWrapper.sln --configuration Release --no-restore + + - name: Test + run: dotnet test FastText.NetWrapper.sln --configuration Release --no-build --logger "trx" --logger "console;verbosity=normal" + + - name: Upload test results + uses: actions/upload-artifact@v4 + with: + name: test-results-${{ matrix.os }} + path: "**/*.trx" - name: Pack if: ${{ matrix.os == 'ubuntu-latest' }} - run: dotnet pack FastText.NetWrapper --configuration Release ${{ inputs.version && format('-p:PackageVersion={0}', inputs.version) || '' }} -o Artifacts + run: dotnet pack FastText.NetWrapper --configuration Release --no-build --output Artifacts - name: Upload NuGet packages if: ${{ matrix.os == 'ubuntu-latest' }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ffa131e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,36 @@ +name: Publish FastText.NetWrapper + +on: + release: + types: + - published # Run the workflow when a new GitHub release is published + workflow_dispatch: # Allow manual triggering from the GitHub UI + +# Set permissions for the workflow. +permissions: + contents: write + packages: write + checks: write + pull-requests: write + +jobs: + build: + uses: ./.github/workflows/ci.yml + + publish: + runs-on: ubuntu-latest + needs: build + steps: + - name: Download Package + uses: actions/download-artifact@v4 + with: + name: artifacts + path: bin/artifacts/ + + - name: Publish NuGet Packages to GitHub Packages + run: dotnet nuget push bin/artifacts/**/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate + + - name: Publish NuGet package + if: github.event_name == 'release' + run: | + dotnet nuget push bin/artifacts/**/*.nupkg --api-key "${{ secrets.NUGET_APIKEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate diff --git a/FastText.NetWrapper/FastText.NetWrapper.csproj b/FastText.NetWrapper/FastText.NetWrapper.csproj index 2432584..5c014ed 100644 --- a/FastText.NetWrapper/FastText.NetWrapper.csproj +++ b/FastText.NetWrapper/FastText.NetWrapper.csproj @@ -6,6 +6,7 @@ latest true $(MSBuildThisFileDirectory)$(MSBuildProjectName).nuspec + CrispThinking.FastText.NetWrapper @@ -17,10 +18,15 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + $(NuspecProperties);packageId=$(PackageId) $(NuspecProperties);assemblyName=$(AssemblyName) $(NuspecProperties);config=$(Configuration) $(NuspecProperties);version=$(PackageVersion) diff --git a/FastText.NetWrapper/FastText.NetWrapper.nuspec b/FastText.NetWrapper/FastText.NetWrapper.nuspec index 9b04b20..b1d4a56 100644 --- a/FastText.NetWrapper/FastText.NetWrapper.nuspec +++ b/FastText.NetWrapper/FastText.NetWrapper.nuspec @@ -1,16 +1,16 @@  - FastText.NetWrapper + $packageId$ $version$ - FastText.NetWrapper - Oleg Tarasov - https://raw.githubusercontent.com/olegtarasov/FastText.NetWrapper/master/LICENSE - https://github.com/olegtarasov/FastText.NetWrapper + CrispThinking.FastText.NetWrapper + Crisp Thinking + https://raw.githubusercontent.com/crispthinking/FastText.NetWrapper/main/LICENSE + https://github.com/crispthinking/FastText.NetWrapper Crossplatform .NET wrapper for Facebook's FastText library. Works on Windows, Linux and MacOs! - Attention! We are deprecating some methods in 1.1 and replacing them with new API. Migration is really straightforward, but please be sure to read https://github.com/olegtarasov/FastText.NetWrapper/blob/master/README.md for guidance. + Attention! We are deprecating some methods in 1.1 and replacing them with new API. Migration is really straightforward, but please be sure to read https://github.com/crispthinking/FastText.NetWrapper/blob/main/README.md for guidance. Oleg Tarasov - + From b51c8813ced211c98e6d45106a4056b57355047d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 09:49:08 +0000 Subject: [PATCH 10/17] Fix CVE: pin actions/download-artifact to v4.1.3 to patch arbitrary file write Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/3b911b56-bca6-4835-8de4-1efb167fab6c Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@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 ffa131e..9b53a97 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,7 +22,7 @@ jobs: needs: build steps: - name: Download Package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v4.1.3 with: name: artifacts path: bin/artifacts/ From 94867f2cba77e080b2581d0e054348cd3fa9e2f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 10:00:46 +0000 Subject: [PATCH 11/17] Port NuGet publish step to use trusted publishing (OIDC) instead of API key secret Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/e33d7de8-1098-4fb4-8342-d5bec1e045de Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@users.noreply.github.com> --- .github/workflows/publish.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9b53a97..806c7be 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,6 +12,7 @@ permissions: packages: write checks: write pull-requests: write + id-token: write # Required for NuGet trusted publishing (OIDC) jobs: build: @@ -33,4 +34,14 @@ jobs: - name: Publish NuGet package if: github.event_name == 'release' run: | - dotnet nuget push bin/artifacts/**/*.nupkg --api-key "${{ secrets.NUGET_APIKEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate + OIDC_TOKEN=$(curl --silent --show-error --fail-with-body \ + --url "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=api://AzureADTokenExchange" \ + --header "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ + | jq --raw-output '.value') + API_KEY=$(curl --silent --show-error --fail-with-body \ + --request POST \ + --url "https://api.nuget.org/v1/authentication/authenticate" \ + --header "Content-Type: application/json" \ + --data "{\"oidcToken\": \"$OIDC_TOKEN\"}" \ + | jq --raw-output '.apiKey') + dotnet nuget push bin/artifacts/**/*.nupkg --api-key "$API_KEY" --source "https://api.nuget.org/v3/index.json" --skip-duplicate From 1bc9b270ee176cc6a2a54a53af7dc87a78c86017 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 10:17:17 +0000 Subject: [PATCH 12/17] Use NuGet/login@v1 action instead of manual OIDC curl for trusted publishing Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/1e170fc6-c3a2-4651-85a5-ab9e754e253f Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@users.noreply.github.com> --- .github/workflows/publish.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 806c7be..693612e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,17 +31,13 @@ jobs: - name: Publish NuGet Packages to GitHub Packages run: dotnet nuget push bin/artifacts/**/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate + - name: NuGet login (OIDC → temp API key) + if: github.event_name == 'release' + uses: NuGet/login@v1 + id: login + with: + user: ${{ secrets.NUGET_USER }} + - name: Publish NuGet package if: github.event_name == 'release' - run: | - OIDC_TOKEN=$(curl --silent --show-error --fail-with-body \ - --url "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=api://AzureADTokenExchange" \ - --header "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ - | jq --raw-output '.value') - API_KEY=$(curl --silent --show-error --fail-with-body \ - --request POST \ - --url "https://api.nuget.org/v1/authentication/authenticate" \ - --header "Content-Type: application/json" \ - --data "{\"oidcToken\": \"$OIDC_TOKEN\"}" \ - | jq --raw-output '.apiKey') - dotnet nuget push bin/artifacts/**/*.nupkg --api-key "$API_KEY" --source "https://api.nuget.org/v3/index.json" --skip-duplicate + run: dotnet nuget push bin/artifacts/**/*.nupkg --api-key "${{ steps.login.outputs.apiKey }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate From 4e525da641ab013182949362e21f9351fc0f8607 Mon Sep 17 00:00:00 2001 From: Will Speak Date: Wed, 1 Apr 2026 11:54:44 +0100 Subject: [PATCH 13/17] Fix NuGet API key reference in publish workflow --- .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 693612e..dddb4d2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -40,4 +40,4 @@ jobs: - name: Publish NuGet package if: github.event_name == 'release' - run: dotnet nuget push bin/artifacts/**/*.nupkg --api-key "${{ steps.login.outputs.apiKey }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate + run: dotnet nuget push bin/artifacts/**/*.nupkg --api-key "${{steps.login.outputs.NUGET_API_KEY}}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate From 0ea4555f8eb3f36ae4ad858e603610563aef5dd8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 11:19:24 +0000 Subject: [PATCH 14/17] Initial plan From 5039e24c1b73591d46e76421e85c5b4d5520409c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 11:22:26 +0000 Subject: [PATCH 15/17] Fix MinVer version generation by adding fetch-tags: true to checkout step Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/fa02c9ff-8867-4616-929c-8d8f200cdd0f Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@users.noreply.github.com> --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1cb8cc..83e22a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + fetch-tags: true - name: Setup .NET Core uses: actions/setup-dotnet@v4 From 72bb5ef86d30d41061907bdb351df41aa4907fb8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 11:38:41 +0000 Subject: [PATCH 16/17] Initial plan From b5797d6e7da137b6d1ee6722f65ab27e328bad92 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 11:40:38 +0000 Subject: [PATCH 17/17] Reset master to 3d6f17b: revert extra build fixes Agent-Logs-Url: https://github.com/crispthinking/FastText.NetWrapper/sessions/fc8c6a29-df52-4028-9dcb-cf0a44d9de2c Co-authored-by: corpo-iwillspeak <265613520+corpo-iwillspeak@users.noreply.github.com> --- .github/workflows/BuildAndPublish.yml | 44 ++++++++++++ .github/workflows/ci.yml | 69 ------------------- .github/workflows/publish.yml | 43 ------------ .../FastText.NetWrapper.csproj | 6 -- .../FastText.NetWrapper.nuspec | 14 ++-- 5 files changed, 51 insertions(+), 125 deletions(-) create mode 100644 .github/workflows/BuildAndPublish.yml delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/BuildAndPublish.yml b/.github/workflows/BuildAndPublish.yml new file mode 100644 index 0000000..a06a3f3 --- /dev/null +++ b/.github/workflows/BuildAndPublish.yml @@ -0,0 +1,44 @@ +name: Build and publish + +on: + push: + tags: + - "*" + +jobs: + test: + if: ${{ !contains(github.event.head_commit.message, 'skip ci') }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 8.0.402 + + - name: Run tests + run: dotnet test + build: + needs: test + if: ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, 'skip ci') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: olegtarasov/get-tag@v2.1.3 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 8.0.402 + + - name: Create the package + run: dotnet pack FastText.NetWrapper --configuration Release -p:PackageVersion=$GIT_TAG_NAME -o . + + - name: Push the package + env: + APIKEY: ${{ secrets.NugetKey }} + run: dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k $APIKEY diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 83e22a5..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: CI - -# Trigger on pushes and pull requests to the main branch. -on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_dispatch: - workflow_call: # Allows the workflow to be called by other workflows - -# Set permissions for the workflow. -permissions: - contents: write - pull-requests: write - checks: write - packages: read - -env: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_NOLOGO: 1 - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false # This allows the matrix jobs to run independently. - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - fetch-tags: true - - - name: Setup .NET Core - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - - name: Restore dependencies - run: dotnet restore FastText.NetWrapper.sln - - - name: Build - run: dotnet build FastText.NetWrapper.sln --configuration Release --no-restore - - - name: Test - run: dotnet test FastText.NetWrapper.sln --configuration Release --no-build --logger "trx" --logger "console;verbosity=normal" - - - name: Upload test results - uses: actions/upload-artifact@v4 - with: - name: test-results-${{ matrix.os }} - path: "**/*.trx" - - - name: Pack - if: ${{ matrix.os == 'ubuntu-latest' }} - run: dotnet pack FastText.NetWrapper --configuration Release --no-build --output Artifacts - - - name: Upload NuGet packages - if: ${{ matrix.os == 'ubuntu-latest' }} - uses: actions/upload-artifact@v4 - with: - name: artifacts - path: Artifacts/*.nupkg diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index dddb4d2..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Publish FastText.NetWrapper - -on: - release: - types: - - published # Run the workflow when a new GitHub release is published - workflow_dispatch: # Allow manual triggering from the GitHub UI - -# Set permissions for the workflow. -permissions: - contents: write - packages: write - checks: write - pull-requests: write - id-token: write # Required for NuGet trusted publishing (OIDC) - -jobs: - build: - uses: ./.github/workflows/ci.yml - - publish: - runs-on: ubuntu-latest - needs: build - steps: - - name: Download Package - uses: actions/download-artifact@v4.1.3 - with: - name: artifacts - path: bin/artifacts/ - - - name: Publish NuGet Packages to GitHub Packages - run: dotnet nuget push bin/artifacts/**/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate - - - name: NuGet login (OIDC → temp API key) - if: github.event_name == 'release' - uses: NuGet/login@v1 - id: login - with: - user: ${{ secrets.NUGET_USER }} - - - name: Publish NuGet package - if: github.event_name == 'release' - run: dotnet nuget push bin/artifacts/**/*.nupkg --api-key "${{steps.login.outputs.NUGET_API_KEY}}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate diff --git a/FastText.NetWrapper/FastText.NetWrapper.csproj b/FastText.NetWrapper/FastText.NetWrapper.csproj index 5c014ed..2432584 100644 --- a/FastText.NetWrapper/FastText.NetWrapper.csproj +++ b/FastText.NetWrapper/FastText.NetWrapper.csproj @@ -6,7 +6,6 @@ latest true $(MSBuildThisFileDirectory)$(MSBuildProjectName).nuspec - CrispThinking.FastText.NetWrapper @@ -18,15 +17,10 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - $(NuspecProperties);packageId=$(PackageId) $(NuspecProperties);assemblyName=$(AssemblyName) $(NuspecProperties);config=$(Configuration) $(NuspecProperties);version=$(PackageVersion) diff --git a/FastText.NetWrapper/FastText.NetWrapper.nuspec b/FastText.NetWrapper/FastText.NetWrapper.nuspec index c96448a..834a57e 100644 --- a/FastText.NetWrapper/FastText.NetWrapper.nuspec +++ b/FastText.NetWrapper/FastText.NetWrapper.nuspec @@ -1,16 +1,16 @@  - $packageId$ + FastText.NetWrapper $version$ - CrispThinking.FastText.NetWrapper - Crisp Thinking - https://raw.githubusercontent.com/crispthinking/FastText.NetWrapper/main/LICENSE - https://github.com/crispthinking/FastText.NetWrapper + FastText.NetWrapper + Oleg Tarasov + https://raw.githubusercontent.com/olegtarasov/FastText.NetWrapper/master/LICENSE + https://github.com/olegtarasov/FastText.NetWrapper Crossplatform .NET wrapper for Facebook's FastText library. Works on Windows, Linux and MacOs! - Attention! We are deprecating some methods in 1.1 and replacing them with new API. Migration is really straightforward, but please be sure to read https://github.com/crispthinking/FastText.NetWrapper/blob/main/README.md for guidance. + Attention! We are deprecating some methods in 1.1 and replacing them with new API. Migration is really straightforward, but please be sure to read https://github.com/olegtarasov/FastText.NetWrapper/blob/master/README.md for guidance. Oleg Tarasov - +