Skip to content

Commit 2ac7fd0

Browse files
committed
update project for .net9
1 parent 8ab0054 commit 2ac7fd0

30 files changed

+1326
-509
lines changed

.github/workflows/dotnet.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ jobs:
1717

1818
steps:
1919

20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v5
2121
- name: Setup .NET
22-
uses: actions/setup-dotnet@v1
22+
uses: actions/setup-dotnet@v4
2323
with:
24-
dotnet-version: 7.0.x
24+
dotnet-version: 9.0.x
2525

2626
# run build and test
2727
- name: Restore dependencies
28-
run: dotnet restore
28+
run: dotnet restore ManagedCode.TimeSeries.slnx
2929
- name: Build
30-
run: dotnet build --no-restore
31-
- name: Test and сollect Code Coverage
32-
run: dotnet test -p:CollectCoverage=true -p:CoverletOutputFormat=lcov -p:CoverletOutput=ManagedCode.Communication.Tests/
30+
run: dotnet build ManagedCode.TimeSeries.slnx --configuration Release --no-restore
31+
- name: Test and collect code coverage
32+
run: dotnet test ManagedCode.TimeSeries.Tests/ManagedCode.TimeSeries.Tests.csproj --configuration Release --no-build -p:CollectCoverage=true -p:CoverletOutputFormat=lcov -p:CoverletOutput=ManagedCode.TimeSeries.Tests/
3333
- name: coveralls
3434
uses: coverallsapp/github-action@master
3535
with:
3636
github-token: ${{secrets.GITHUB_TOKEN }}
37-
path-to-lcov: ManagedCode.TimeSeries.Tests/lcov.info
37+
path-to-lcov: ManagedCode.TimeSeries.Tests/coverage.info

.github/workflows/nuget.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
env:
9+
DOTNET_VERSION: '9.0.x'
10+
11+
jobs:
12+
build:
13+
name: Build and Test
14+
runs-on: ubuntu-latest
15+
16+
outputs:
17+
version: ${{ steps.version.outputs.version }}
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v5
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: ${{ env.DOTNET_VERSION }}
27+
28+
- name: Extract version from Directory.Build.props
29+
id: version
30+
run: |
31+
VERSION=$(grep -oPm1 "(?<=<Version>)[^<]+" Directory.Build.props)
32+
echo "version=$VERSION" >> $GITHUB_OUTPUT
33+
echo "Version from Directory.Build.props: $VERSION"
34+
35+
- name: Restore dependencies
36+
run: dotnet restore ManagedCode.TimeSeries.slnx
37+
38+
- name: Build
39+
run: dotnet build ManagedCode.TimeSeries.slnx --configuration Release --no-restore
40+
41+
- name: Test
42+
run: dotnet test ManagedCode.TimeSeries.Tests/ManagedCode.TimeSeries.Tests.csproj --configuration Release --no-build --verbosity normal
43+
44+
- name: Pack NuGet packages
45+
run: dotnet pack ManagedCode.TimeSeries.slnx --configuration Release --no-build -p:IncludeSymbols=false -p:SymbolPackageFormat=snupkg --output ./artifacts
46+
47+
- name: Upload artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: nuget-packages
51+
path: ./artifacts/*.nupkg
52+
retention-days: 5
53+
54+
publish-nuget:
55+
name: Publish to NuGet
56+
needs: build
57+
runs-on: ubuntu-latest
58+
if: github.ref == 'refs/heads/main'
59+
60+
outputs:
61+
published: ${{ steps.publish.outputs.published }}
62+
version: ${{ needs.build.outputs.version }}
63+
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v5
67+
68+
- name: Download artifacts
69+
uses: actions/download-artifact@v5
70+
with:
71+
name: nuget-packages
72+
path: ./artifacts
73+
74+
- name: Setup .NET
75+
uses: actions/setup-dotnet@v4
76+
with:
77+
dotnet-version: ${{ env.DOTNET_VERSION }}
78+
79+
- name: Publish to NuGet
80+
id: publish
81+
continue-on-error: true
82+
run: |
83+
set +e
84+
OUTPUT=""
85+
PUBLISHED=false
86+
87+
for package in ./artifacts/*.nupkg; do
88+
echo "Publishing $package..."
89+
RESULT=$(dotnet nuget push "$package" \
90+
--api-key ${{ secrets.NUGET_API_KEY }} \
91+
--source https://api.nuget.org/v3/index.json \
92+
--skip-duplicate 2>&1)
93+
EXIT_CODE=$?
94+
echo "$RESULT"
95+
OUTPUT="$OUTPUT$RESULT"
96+
97+
if [ $EXIT_CODE -eq 0 ]; then
98+
echo "Successfully published $package"
99+
PUBLISHED=true
100+
elif echo "$RESULT" | grep -q "already exists"; then
101+
echo "Package already exists, skipping..."
102+
else
103+
echo "Failed to publish $package"
104+
exit 1
105+
fi
106+
done
107+
108+
if [ "$PUBLISHED" = true ] || echo "$OUTPUT" | grep -q "Your package was pushed"; then
109+
echo "published=true" >> $GITHUB_OUTPUT
110+
echo "At least one package was successfully published"
111+
else
112+
echo "published=false" >> $GITHUB_OUTPUT
113+
echo "No new packages were published (all already exist)"
114+
fi
115+
116+
create-release:
117+
name: Create GitHub Release and Tag
118+
needs: publish-nuget
119+
runs-on: ubuntu-latest
120+
if: needs.publish-nuget.outputs.published == 'true'
121+
122+
steps:
123+
- name: Checkout
124+
uses: actions/checkout@v5
125+
with:
126+
fetch-depth: 0
127+
token: ${{ secrets.GITHUB_TOKEN }}
128+
129+
- name: Download artifacts
130+
uses: actions/download-artifact@v5
131+
with:
132+
name: nuget-packages
133+
path: ./artifacts
134+
135+
- name: Create and push tag
136+
id: create_tag
137+
run: |
138+
VERSION="${{ needs.publish-nuget.outputs.version }}"
139+
TAG="v$VERSION"
140+
141+
git config user.name "github-actions[bot]"
142+
git config user.email "github-actions[bot]@users.noreply.github.com"
143+
144+
if git rev-parse "$TAG" >/dev/null 2>&1; then
145+
echo "Tag $TAG already exists"
146+
echo "tag_exists=true" >> $GITHUB_OUTPUT
147+
else
148+
echo "Creating tag $TAG"
149+
git tag -a "$TAG" -m "Release $VERSION"
150+
git push origin "$TAG"
151+
echo "tag_exists=false" >> $GITHUB_OUTPUT
152+
fi
153+
154+
- name: Get previous tag
155+
id: prev_tag
156+
run: |
157+
CURRENT_TAG="v${{ needs.publish-nuget.outputs.version }}"
158+
PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -A1 "^$CURRENT_TAG$" | tail -n1 || echo "")
159+
if [ "$PREVIOUS_TAG" = "$CURRENT_TAG" ] || [ -z "$PREVIOUS_TAG" ]; then
160+
PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -v "^$CURRENT_TAG$" | head -n1 || echo "")
161+
fi
162+
echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
163+
echo "Current tag: $CURRENT_TAG"
164+
echo "Previous tag: $PREVIOUS_TAG"
165+
166+
- name: Generate release notes
167+
id: release_notes
168+
run: |
169+
VERSION="${{ needs.publish-nuget.outputs.version }}"
170+
CURRENT_TAG="v$VERSION"
171+
PREVIOUS_TAG="${{ steps.prev_tag.outputs.previous_tag }}"
172+
173+
echo "# Release $VERSION" > release_notes.md
174+
echo "" >> release_notes.md
175+
echo "Released on $(date +'%Y-%m-%d')" >> release_notes.md
176+
echo "" >> release_notes.md
177+
178+
if [ -n "$PREVIOUS_TAG" ]; then
179+
echo "## 📋 Changes since $PREVIOUS_TAG" >> release_notes.md
180+
echo "" >> release_notes.md
181+
182+
echo "### ✨ Features" >> release_notes.md
183+
git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD --grep="^feat" --grep="^feature" >> release_notes.md || true
184+
echo "" >> release_notes.md
185+
186+
echo "### 🐛 Bug Fixes" >> release_notes.md
187+
git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD --grep="^fix" --grep="^bugfix" >> release_notes.md || true
188+
echo "" >> release_notes.md
189+
190+
echo "### 📚 Documentation" >> release_notes.md
191+
git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD --grep="^docs" --grep="^doc" >> release_notes.md || true
192+
echo "" >> release_notes.md
193+
194+
echo "### 🔧 Other Changes" >> release_notes.md
195+
git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD --invert-grep --grep="^feat" --grep="^feature" --grep="^fix" --grep="^bugfix" --grep="^docs" --grep="^doc" >> release_notes.md || true
196+
echo "" >> release_notes.md
197+
else
198+
echo "## 🎉 Initial Release" >> release_notes.md
199+
echo "" >> release_notes.md
200+
echo "### Recent Changes" >> release_notes.md
201+
git log --pretty=format:"- %s (%h)" --max-count=20 >> release_notes.md
202+
echo "" >> release_notes.md
203+
fi
204+
205+
echo "" >> release_notes.md
206+
echo "## 📦 NuGet Packages" >> release_notes.md
207+
echo "" >> release_notes.md
208+
for package in ./artifacts/*.nupkg; do
209+
PACKAGE_NAME=$(basename "$package" .nupkg)
210+
BASE_NAME=$(echo "$PACKAGE_NAME" | sed "s/\.$VERSION//")
211+
echo "- [$BASE_NAME v$VERSION](https://www.nuget.org/packages/$BASE_NAME/$VERSION)" >> release_notes.md
212+
done
213+
214+
echo "" >> release_notes.md
215+
echo "---" >> release_notes.md
216+
echo "*This release was automatically created by GitHub Actions*" >> release_notes.md
217+
218+
- name: Create GitHub Release
219+
uses: softprops/action-gh-release@v2
220+
with:
221+
tag_name: v${{ needs.publish-nuget.outputs.version }}
222+
name: v${{ needs.publish-nuget.outputs.version }}
223+
body_path: release_notes.md
224+
draft: false
225+
prerelease: false
226+
files: ./artifacts/*.nupkg
227+
token: ${{ secrets.GITHUB_TOKEN }}

AGENTS.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Conversations
2+
any resulting updates to agents.md should go under the section "## Rules to follow"
3+
When you see a convincing argument from me on how to solve or do something. add a summary for this in agents.md. so you learn what I want over time.
4+
If I say any of the following point, you do this: add the context to agents.md, and associate this with a specific type of task.
5+
if I say "never do x" in some way.
6+
if I say "always do x" in some way.
7+
if I say "the process is x" in some way.
8+
If I tell you to remember something, you do the same, update
9+
10+
11+
## Rules to follow (SUPER IMPORTANT)
12+
For any code modification task: run dotnet build before applying changes to capture the current error count. After the changes, run dotnet build again and only commit if the error count stays the same or decreases; revert if it increases.
13+
14+
15+
# Repository Guidelines
16+
17+
## Project Structure & Module Organization
18+
- `ManagedCode.TimeSeries/` — core library with accumulators, summers, and shared abstractions.
19+
- `ManagedCode.TimeSeries.Tests/` — xUnit test suite referencing the core project; coverage instrumentation configured via coverlet.
20+
- `ManagedCode.TimeSeries.Orleans/` — Orleans-specific adapters built atop the core types.
21+
- `ManagedCode.TimeSeries.Benchmark/` — BenchmarkDotNet harness for performance tracking, entry point in `Program.cs`.
22+
- `Directory.Build.props` centralizes NuGet metadata, reproducible build settings, and solution-wide assets.
23+
24+
## Build, Test, and Development Commands
25+
- `dotnet restore` — fetch solution dependencies.
26+
- `dotnet build --configuration Release` — compile all projects and validate analyzers.
27+
- `dotnet test ManagedCode.TimeSeries.Tests/ManagedCode.TimeSeries.Tests.csproj -p:CollectCoverage=true` — run tests with coverlet lcov output (mirrors CI).
28+
- `dotnet run --project ManagedCode.TimeSeries.Benchmark/ManagedCode.TimeSeries.Benchmark.csproj -c Release` — execute benchmarks before publishing performance-sensitive changes.
29+
- `dotnet pack ManagedCode.TimeSeries/ManagedCode.TimeSeries.csproj -c Release` — produce the NuGet package using metadata from `Directory.Build.props`.
30+
31+
## Coding Style & Naming Conventions
32+
Target `net9.0` with C# 13, `Nullable` and `ImplicitUsings` enabled; favour modern language features when they improve clarity. Stick to four-space indentation, braces on new lines, PascalCase for types, methods, and public properties, camelCase for locals and parameters, and ALL_CAPS only for constants. Keep namespaces aligned with folder paths under `ManagedCode.TimeSeries`.
33+
34+
## Testing Guidelines
35+
Use xUnit `[Fact]` and `[Theory]` patterns with FluentAssertions for expectations; prefer descriptive test method names (`MethodUnderTest_State_Expectation`). Ensure new logic includes coverage and leaves no skipped tests behind; if a skip is unavoidable, document the unblocker in-code. Generate fresh coverage via the command above before opening a PR and verify lcov output lands under `ManagedCode.TimeSeries.Tests/`.
36+
37+
## Commit & Pull Request Guidelines
38+
Follow the repo’s concise commit style (`scope summary` or short imperative lines under ~60 characters, e.g., `bench improve queue path`). Each PR should describe the change, reference related issues, and call out API or serialization impacts. Include evidence of local `dotnet test` runs (and benchmarks when relevant) plus screenshots for user-facing changes. Highlight breaking changes or version bumps so release automation remains accurate.

Directory.Build.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<RepositoryUrl>https://github.com/managedcode/TimeSeries</RepositoryUrl>
1818
<PackageProjectUrl>https://github.com/managedcode/TimeSeries</PackageProjectUrl>
1919
<Product>Managed Code - TimeSeries</Product>
20-
<Version>0.0.18</Version>
21-
<PackageVersion>0.0.18</PackageVersion>
20+
<Version>0.0.20</Version>
21+
<PackageVersion>0.0.20</PackageVersion>
2222

2323
</PropertyGroup>
2424
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
@@ -29,9 +29,9 @@
2929
<None Include="$(SolutionDir)\README.md" Pack="true" Visible="false" PackagePath="\"/>
3030
</ItemGroup>
3131
<ItemGroup>
32-
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.1.1">
32+
<PackageReference Include="DotNet.ReproducibleBuilds">
3333
<PrivateAssets>all</PrivateAssets>
3434
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3535
</PackageReference>
3636
</ItemGroup>
37-
</Project>
37+
</Project>

Directory.Packages.props

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageVersion Include="BenchmarkDotNet" Version="0.15.4" />
7+
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
8+
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
9+
<PackageVersion Include="DotNet.ReproducibleBuilds" Version="1.2.39" />
10+
<PackageVersion Include="FluentAssertions" Version="8.7.1" />
11+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
12+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
13+
<PackageVersion Include="Microsoft.Orleans.Sdk" Version="9.2.1" />
14+
<PackageVersion Include="Microsoft.Orleans.Serialization.Abstractions" Version="9.2.1" />
15+
<PackageVersion Include="xunit" Version="2.9.3" />
16+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
17+
</ItemGroup>
18+
</Project>

ManagedCode.TimeSeries.Benchmark/ManagedCode.TimeSeries.Benchmark.csproj

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

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
6-
<LangVersion>11</LangVersion>
5+
<TargetFramework>net9.0</TargetFramework>
6+
<LangVersion>13</LangVersion>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
<IsPackable>false</IsPackable>
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
13+
<PackageReference Include="BenchmarkDotNet" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

0 commit comments

Comments
 (0)