Skip to content

Commit 2d4a671

Browse files
committed
feat(build): target net10 and net9 with updated CI matrix
1 parent 0e00bb0 commit 2d4a671

File tree

4 files changed

+89
-73
lines changed

4 files changed

+89
-73
lines changed
Lines changed: 81 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,98 @@
1-
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
21
name: publish
2+
33
on:
4-
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
4+
workflow_dispatch:
55
push:
6-
branches:
7-
- "master" # Run the workflow when pushing to the main branch
6+
branches: [ master ]
87
pull_request:
9-
branches:
10-
- "*" # Run the workflow for all pull requests
8+
branches: [ '*' ]
119
release:
12-
types:
13-
- published # Run the workflow when a new GitHub release is published
10+
types: [ published ]
11+
1412
env:
1513
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
1614
DOTNET_NOLOGO: true
17-
NuGetDirectory: ${{ github.workspace}}/nuget
15+
NuGetDirectory: ${{ github.workspace }}/nuget
16+
1817
defaults:
1918
run:
2019
shell: pwsh
20+
2121
jobs:
22-
build_and_pack:
23-
name: Build & Test & Pack
24-
runs-on: ubuntu-latest # Use Linux runner
25-
permissions:
26-
contents: write # Needed for gh release create step to upload assets
22+
build_test_and_pack:
23+
name: Build, Test, and Pack
24+
runs-on: ubuntu-latest
2725
steps:
28-
- name: Checkout code
29-
uses: actions/checkout@v4
30-
with:
31-
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
32-
- name: Setup .NET 9 SDK
33-
uses: actions/setup-dotnet@v4
34-
with:
35-
dotnet-version: '9.x' # Use the .NET 9 SDK
36-
- name: Restore dependencies
37-
run: dotnet restore TTSTextNormalization.sln # Restore for the whole solution
38-
- name: Build Library
39-
# Build the specific library project in Release config
40-
run: dotnet build TTSTextNormalization/TTSTextNormalization.csproj --configuration Release --no-restore
41-
42-
# --- New Test Step ---
43-
- name: Run Unit Tests
44-
# Run tests for the entire solution in Release config
45-
# --no-build assumes the previous build step was successful
46-
run: dotnet test TTSTextNormalization.sln --configuration Release --verbosity normal
47-
48-
- name: Pack Library
49-
# Pack the specific library project
50-
# Use Release config
51-
# Output packages to an 'artifacts' directory
52-
run: dotnet pack TTSTextNormalization/TTSTextNormalization.csproj --configuration Release --no-build --output ${{ env.NuGetDirectory }}
53-
- uses: actions/upload-artifact@v4
54-
with:
55-
name: nuget
56-
if-no-files-found: error
57-
retention-days: 7
58-
path: ${{ env.NuGetDirectory }}/*.nupkg
26+
- name: Checkout Repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Setup .NET SDK
32+
uses: actions/setup-dotnet@v4
33+
with:
34+
dotnet-version: |
35+
10.x
36+
9.x
37+
38+
- name: Restore Dependencies
39+
run: dotnet restore TTSTextNormalization.sln
40+
41+
- name: Build Solution
42+
run: dotnet build TTSTextNormalization.sln --configuration Release --no-restore
43+
44+
- name: Run Tests for .NET 10.0
45+
run: dotnet test TTSTextNormalization.Tests/TTSTextNormalization.Tests.csproj --configuration Release --framework net10.0 --no-build --report-trx --report-trx-filename test-results-net10.trx
46+
47+
- name: Run Tests for .NET 9.0
48+
run: dotnet test TTSTextNormalization.Tests/TTSTextNormalization.Tests.csproj --configuration Release --framework net9.0 --no-build --report-trx --report-trx-filename test-results-net9.trx
49+
50+
- name: Upload Test Results
51+
if: always()
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: test-results
55+
path: '**/*.trx'
56+
retention-days: 7
57+
58+
- name: Pack Library
59+
run: dotnet pack TTSTextNormalization/TTSTextNormalization.csproj --configuration Release --no-build --output ${{ env.NuGetDirectory }}
60+
61+
- name: Upload NuGet Packages Artifact
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: nuget-packages
65+
if-no-files-found: error
66+
retention-days: 7
67+
path: ${{ env.NuGetDirectory }}/*.nupkg
5968

6069
deploy:
61-
# Publish only when creating a GitHub Release
62-
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
63-
# You can update this logic if you want to manage releases differently
64-
if: github.event_name == 'release'
70+
name: Deploy Packages to NuGet.org
71+
if: github.event_name == 'release' && github.event.action == 'published'
6572
runs-on: ubuntu-latest
66-
needs: [build_and_pack] # Depends on the job that now includes testing
73+
needs: [build_test_and_pack]
74+
environment:
75+
name: nuget.org
76+
url: https://www.nuget.org/packages/Agash.TTSTextNormalization
77+
permissions:
78+
contents: read
6779
steps:
68-
# Download the NuGet package created in the previous job
69-
- uses: actions/download-artifact@v4
70-
with:
71-
name: nuget
72-
path: ${{ env.NuGetDirectory }}
73-
# Install the .NET SDK indicated in the global.json file
74-
- name: Setup .NET Core
75-
uses: actions/setup-dotnet@v4
76-
# Publish all NuGet packages to NuGet.org
77-
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
78-
# If you retry a failed workflow, already published packages will be skipped without error.
79-
- name: Publish NuGet package
80-
run: |
81-
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
82-
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
83-
}
80+
- name: Download NuGet Packages Artifact
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: nuget-packages
84+
path: ${{ env.NuGetDirectory }}
85+
86+
- name: Setup .NET SDK
87+
uses: actions/setup-dotnet@v4
88+
with:
89+
dotnet-version: 10.x
90+
91+
- name: Publish NuGet Packages
92+
env:
93+
NUGET_API_KEY: ${{ secrets.NUGET_APIKEY }}
94+
run: |
95+
Get-ChildItem "${{ env.NuGetDirectory }}" -Filter *.nupkg | ForEach-Object {
96+
Write-Host "Pushing $($_.FullName)..."
97+
dotnet nuget push $_.FullName --api-key "$env:NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
98+
}

TTSTextNormalization.Generator/TTSTextNormalization.EmojiDataGenerator.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5-
<LangVersion>latest</LangVersion>
5+
<LangVersion>preview</LangVersion>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
@@ -49,4 +49,4 @@
4949
<ItemGroup>
5050
<AdditionalFiles Include="data-by-emoji.json" />
5151
</ItemGroup>
52-
</Project>
52+
</Project>

TTSTextNormalization.Tests/TTSTextNormalization.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="MSTest.Sdk/3.6.4">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
5-
<LangVersion>latest</LangVersion>
4+
<TargetFrameworks>net10.0;net9.0</TargetFrameworks>
5+
<LangVersion>preview</LangVersion>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<!--

TTSTextNormalization/TTSTextNormalization.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFrameworks>net10.0;net9.0</TargetFrameworks>
5+
<LangVersion>preview</LangVersion>
56
<ImplicitUsings>enable</ImplicitUsings>
67
<Nullable>enable</Nullable>
78

@@ -12,7 +13,7 @@
1213
<PackageId>Agash.TTSTextNormalization</PackageId>
1314
<Authors>Agash</Authors>
1415
<Company>Agash</Company>
15-
<Description>A .NET 9 / C# 13 class library to normalize text (emojis, currency, numbers, abbreviations) for consistent Text-to-Speech (TTS) output, tailored for chat/donation scenarios.</Description>
16+
<Description>A .NET 10 / .NET 9 class library to normalize text (emojis, currency, numbers, abbreviations) for consistent Text-to-Speech (TTS) output, tailored for chat/donation scenarios.</Description>
1617
<Copyright>Copyright (c) Agash 2025</Copyright>
1718
<PackageProjectUrl>https://github.com/Agash/TTSTextNormalization</PackageProjectUrl>
1819
<RepositoryUrl>https://github.com/Agash/TTSTextNormalization.git</RepositoryUrl>
@@ -70,4 +71,4 @@
7071
<ProjectReference Include="..\TTSTextNormalization.Generator\TTSTextNormalization.EmojiDataGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
7172
</ItemGroup>
7273

73-
</Project>
74+
</Project>

0 commit comments

Comments
 (0)