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
99 changes: 99 additions & 0 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Publish to NuGet

on:
push:
tags:
- "v*.*.*"
- "v*.*.*-*"
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g., 0.0.1-test)"
required: true
default: "0.0.1-test"
skip_publish:
description: "Skip NuGet publish step (dry run)"
required: false
type: boolean
default: true

jobs:
publish:
name: Build, Test, and Publish NuGet Packages
runs-on: ubuntu-latest
permissions:
contents: write
env:
CONFIGURATION: Release

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x

- name: Extract version from tag or input
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Package version: $VERSION"

- name: Restore dependencies
run: dotnet restore FAI.slnx

- name: Build solution
run: dotnet build FAI.slnx --no-restore --configuration ${{ env.CONFIGURATION }}

- name: Run tests
run: dotnet test --no-build --configuration ${{ env.CONFIGURATION }} --verbosity normal

- name: Pack FAI.Core
run: dotnet pack src/FAI.Core/FAI.Core.csproj --configuration ${{ env.CONFIGURATION }} --no-build --output ./packages /p:Version=${{ env.VERSION }}

- name: Pack FAI.Core.Extensions.DI
run: dotnet pack src/FAI.Core.Extensions.DI/FAI.Core.Extensions.DI.csproj --configuration ${{ env.CONFIGURATION }} --no-build --output ./packages /p:Version=${{ env.VERSION }}

- name: Pack FAI.NLP
run: dotnet pack src/FAI.NLP/FAI.NLP.csproj --configuration ${{ env.CONFIGURATION }} --no-build --output ./packages /p:Version=${{ env.VERSION }}

- name: Pack FAI.NLP.Extensions.DI
run: dotnet pack src/FAI.NLP.Extensions.DI/FAI.NLP.Extensions.DI.csproj --configuration ${{ env.CONFIGURATION }} --no-build --output ./packages /p:Version=${{ env.VERSION }}

- name: Pack FAI.Onnx
run: dotnet pack src/FAI.Onnx/FAI.Onnx.csproj --configuration ${{ env.CONFIGURATION }} --no-build --output ./packages /p:Version=${{ env.VERSION }}

- name: List generated packages
run: ls -lh ./packages/

- name: Publish to NuGet
if: github.event_name == 'push' || github.event.inputs.skip_publish != 'true'
run: dotnet nuget push ./packages/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

- name: Upload packages as artifacts (for manual trigger dry runs)
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: nuget-packages-${{ env.VERSION }}
path: ./packages/*.nupkg
retention-days: 7

- name: Create GitHub Release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
files: ./packages/*.nupkg
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49 changes: 49 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<Project>
<PropertyGroup>
<!-- Package Metadata -->
<Authors>Tal Wald</Authors>
<Company>FAI</Company>
<Copyright>Copyright © 2025 Tal Wald</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>

<!-- Repository Information -->
<RepositoryUrl>https://github.com/tjwald/fai</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/tjwald/fai</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>

<!-- Package Tags -->
<PackageTags>ai;ml;machine-learning;inference;onnx;performance;batching;nlp;fast;dotnet;csharp;high-performance;tensor</PackageTags>

<!-- Package Description (can be overridden in individual projects) -->
<Description>High-performance ML inference library for .NET achieving 7X-14X speedup over standard Python stacks. Part of the FAI (Fast AI) framework.</Description>

<!-- Package Settings -->
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<IsPackable>true</IsPackable>

<!-- Version Management (injected by CI/CD) -->
<Version Condition="'$(Version)' == ''">0.0.1-local</Version>

<!-- Symbol Packages for Debugging -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<!-- Source Link Support -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- Deterministic Builds -->
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>

<!-- Include README in all packages -->
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)../README.md" Pack="true" PackagePath="/" />
</ItemGroup>

<!-- Source Link Package Reference -->
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- Not ready for NuGet publishing yet -->
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/FAI.Vision/FAI.Vision.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FAI.Vision</RootNamespace>
<!-- Not ready for NuGet publishing yet -->
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down