From 261588f18808c09bd155adce710dd93bd4dfa0ee Mon Sep 17 00:00:00 2001 From: Jesse Squire Date: Mon, 8 Dec 2025 08:52:33 -0800 Subject: [PATCH 1/3] [EngSys] .NET 10 Migration The focus of these changes is to move the repository to .NET 10, including the SDK, target frameworks, and BCL package dependencies. --- .github/CODEOWNERS | 2 +- .github/workflows/codegen-validation.yml | 18 +++++++-------- .github/workflows/live-test.yml | 5 +++++ .github/workflows/main.yml | 5 +++++ .github/workflows/release.yml | 17 +++++++++----- global.json | 4 ++-- nuget.config | 1 + src/OpenAI.csproj | 28 ++++++++++++++---------- tests/OpenAI.Tests.csproj | 27 +++++++++++++---------- tests/Responses/ResponsesTests.cs | 5 ++++- 10 files changed, 71 insertions(+), 41 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4db002235..36fe47c39 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,4 +2,4 @@ # For more information, see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners # The '*' pattern represents global owners. -* @joseharriaga @trrwilson @ShivangiReja +* @joseharriaga @christothes @ShivangiReja @jsquire diff --git a/.github/workflows/codegen-validation.yml b/.github/workflows/codegen-validation.yml index 9c8bf671d..e0fd3b130 100644 --- a/.github/workflows/codegen-validation.yml +++ b/.github/workflows/codegen-validation.yml @@ -20,7 +20,7 @@ jobs: validate-codegen: name: Validate Code Generation runs-on: ubuntu-latest - + steps: - name: Checkout code uses: actions/checkout@v4 @@ -29,7 +29,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: '22.x' - + - name: Setup .NET uses: actions/setup-dotnet@v4 with: @@ -41,14 +41,14 @@ jobs: run: | Write-Host "Running code generation validation..." ./scripts/Invoke-CodeGen.ps1 -Clean - + if ($LASTEXITCODE -ne 0) { Write-Error "Code generation failed with exit code: $LASTEXITCODE" exit $LASTEXITCODE } - + Write-Host "Code generation completed successfully!" - + - name: Check for uncommitted changes run: | # Check if there are any changes to tracked files after code generation @@ -60,7 +60,7 @@ jobs: git diff exit 1 fi - + # Also check for untracked files that might have been generated if [ -n "$(git ls-files --others --exclude-standard)" ]; then echo "::error::Code generation produced untracked files. Please review and commit them if they should be included." @@ -68,16 +68,16 @@ jobs: git ls-files --others --exclude-standard exit 1 fi - + echo "No uncommitted changes detected - code generation is up to date!" - + - name: Run codegen visitor tests run: dotnet test codegen/generator/test/ --configuration Release --logger "trx;LogFilePrefix=codegen" --results-directory ${{github.workspace}}/artifacts/test-results ${{ env.version_suffix_args}} - + - name: Upload artifacts uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} diff --git a/.github/workflows/live-test.yml b/.github/workflows/live-test.yml index f1359007c..50be7d493 100644 --- a/.github/workflows/live-test.yml +++ b/.github/workflows/live-test.yml @@ -17,6 +17,11 @@ jobs: version_suffix_args: ${{ format('/p:VersionSuffix="alpha.{0}"', github.run_number) }} steps: - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '10.x' + + - name: Setup .NET 9 uses: actions/setup-dotnet@v3 with: dotnet-version: '9.x' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b9421310..6d5c1e7e1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,11 @@ jobs: version_suffix_args: ${{ format('/p:VersionSuffix="alpha.{0}"', github.run_number) }} steps: - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '10.x' + + - name: Setup .NET 9 uses: actions/setup-dotnet@v3 with: dotnet-version: '9.x' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3a9f9bdf7..bae93ead3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,11 @@ jobs: version_suffix_args: ${{ github.event_name == 'schedule' && format('/p:VersionSuffix="alpha.{0}"', github.run_number) || '' }} steps: - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '10.x' + + - name: Setup .NET 9 uses: actions/setup-dotnet@v3 with: dotnet-version: '9.x' @@ -78,22 +83,22 @@ jobs: environment: release # Needed for OIDC subject for releases triggered on release being created. permissions: id-token: write # Required for requesting the JWT - + steps: - name: Download build artifacts uses: actions/download-artifact@v4 with: name: build-artifacts path: ${{ github.workspace }}/build-artifacts - + - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '9.x' - + - name: Install Sign CLI tool run: dotnet tool install --tool-path . --prerelease sign - + - name: 'Az CLI login' uses: azure/login@v2 with: @@ -113,13 +118,13 @@ jobs: --azure-credential-type "azure-cli" --azure-key-vault-url "https://sc-openaisdk.vault.azure.net/" --azure-key-vault-certificate "OpenAISDKSCCert" - + - name: Upload signed artifact uses: actions/upload-artifact@v4 with: name: build-artifacts-signed path: ${{ github.workspace }}/build-artifacts - + deploy: name: Publish package needs: sign diff --git a/global.json b/global.json index cbe802cdb..8e8a4cdff 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.306", + "version": "10.0.100", "rollForward": "feature" } -} +} \ No newline at end of file diff --git a/nuget.config b/nuget.config index 6bf477c46..273cdaeaf 100644 --- a/nuget.config +++ b/nuget.config @@ -10,6 +10,7 @@ + diff --git a/src/OpenAI.csproj b/src/OpenAI.csproj index d04e2c055..0ad5624c3 100644 --- a/src/OpenAI.csproj +++ b/src/OpenAI.csproj @@ -3,15 +3,15 @@ The official .NET library for the OpenAI service API. - SDK Code Generation OpenAI + OpenAI client library for .NET OpenAI;openai-dotnet;ChatGPT;Dall-E MIT - Copyright (c) 2024 OpenAI (https://openai.com) + Copyright (c) 2025 OpenAI (https://openai.com) 2.7.0 - net8.0;netstandard2.0 + net10.0;net8.0;netstandard2.0 latest @@ -62,10 +62,6 @@ - - - true - @@ -73,12 +69,22 @@ - - + + + + + - - + + + + + + + + true + diff --git a/tests/OpenAI.Tests.csproj b/tests/OpenAI.Tests.csproj index bcb5bd4f8..d787da307 100644 --- a/tests/OpenAI.Tests.csproj +++ b/tests/OpenAI.Tests.csproj @@ -1,28 +1,33 @@  - net9.0 + net10.0;net9.0;net8.0 + latest $(NoWarn);CS1591 - - $(NoWarn);OPENAI001;SCME0001; - - latest + + $(NoWarn);OPENAI001;OPENAI002;SCME0001; + + - - - - + + - - + + + + + + + + diff --git a/tests/Responses/ResponsesTests.cs b/tests/Responses/ResponsesTests.cs index 21bdf8bb3..7042e2f02 100644 --- a/tests/Responses/ResponsesTests.cs +++ b/tests/Responses/ResponsesTests.cs @@ -760,7 +760,10 @@ public async Task AllInstructionMethodsWork(ResponsesTestInstructionMethod instr } List listedItems = []; - await client.GetResponseInputItemsAsync(response.Id).ForEachAsync(item => listedItems.Add(item)); + await foreach (var item in client.GetResponseInputItemsAsync(response.Id)) + { + listedItems.Add(item); + } if (instructionMethod == ResponsesTestInstructionMethod.InstructionsProperty) { From 1a34803b33ed164c2cba5a2340e02d52925a56c5 Mon Sep 17 00:00:00 2001 From: Jesse Squire Date: Mon, 8 Dec 2025 09:23:25 -0800 Subject: [PATCH 2/3] Make actions step for installing .NET 10 more explicitly named --- .github/workflows/live-test.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/live-test.yml b/.github/workflows/live-test.yml index 50be7d493..61c69ab03 100644 --- a/.github/workflows/live-test.yml +++ b/.github/workflows/live-test.yml @@ -16,7 +16,7 @@ jobs: env: version_suffix_args: ${{ format('/p:VersionSuffix="alpha.{0}"', github.run_number) }} steps: - - name: Setup .NET + - name: Setup .NET 10 uses: actions/setup-dotnet@v3 with: dotnet-version: '10.x' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6d5c1e7e1..a4f0a3dd9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: env: version_suffix_args: ${{ format('/p:VersionSuffix="alpha.{0}"', github.run_number) }} steps: - - name: Setup .NET + - name: Setup .NET 10 uses: actions/setup-dotnet@v3 with: dotnet-version: '10.x' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bae93ead3..815255255 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: env: version_suffix_args: ${{ github.event_name == 'schedule' && format('/p:VersionSuffix="alpha.{0}"', github.run_number) || '' }} steps: - - name: Setup .NET + - name: Setup .NET 10 uses: actions/setup-dotnet@v3 with: dotnet-version: '10.x' From acb96bdd7fe2e151817bbcee43f31ff16649bf5c Mon Sep 17 00:00:00 2001 From: Jesse Squire Date: Mon, 8 Dec 2025 09:27:02 -0800 Subject: [PATCH 3/3] Move to direct System.Linq.AsyncEnumerable reference --- tests/OpenAI.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/OpenAI.Tests.csproj b/tests/OpenAI.Tests.csproj index d787da307..960ad0d01 100644 --- a/tests/OpenAI.Tests.csproj +++ b/tests/OpenAI.Tests.csproj @@ -20,12 +20,12 @@ + -