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
63 changes: 23 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
os: [ubuntu-24.04, windows-2025, macos-15]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.201
- run: dotnet build ProMvvm.slnx -c Release
Expand All @@ -37,42 +37,25 @@ jobs:
- run: dotnet run --project samples/ProMvvm.Sample.CommunityToolkit.Expression -c Release --no-build
- run: dotnet run --project benchmarks/ProMvvm.Benchmarks -c Release --no-build -- --list flat
- if: runner.os == 'Linux'
run: dotnet pack src/ProMvvm.SourceGenerators -c Release --no-build -o artifacts/packages
- if: runner.os == 'Linux'
run: dotnet pack src/ProMvvm -c Release --no-build -o artifacts/packages
- if: runner.os == 'Linux'
name: Validate package contents
run: |
package_version="$(dotnet msbuild src/ProMvvm/ProMvvm.csproj -nologo -getProperty:PackageVersion -p:Configuration=Release)"
./eng/validate-packages.sh "$package_version"
- if: runner.os == 'Linux'
run: >-
dotnet restore tests/ProMvvm.PackageSmoke
--no-cache
--source artifacts/packages
--source https://api.nuget.org/v3/index.json
- if: runner.os == 'Linux'
run: dotnet run --project tests/ProMvvm.PackageSmoke -c Release --no-restore
- if: runner.os == 'Linux'
run: >-
dotnet restore tests/ProMvvm.SourceGenerators.PackageSmoke
--no-cache
--source artifacts/packages
--source https://api.nuget.org/v3/index.json
- if: runner.os == 'Linux'
run: >-
dotnet run --project tests/ProMvvm.SourceGenerators.PackageSmoke
-c Release --no-restore
- if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: coverage
path: artifacts/coverage
- if: runner.os == 'Linux'
uses: actions/upload-artifact@v4

package-integration:
name: Local NuGet package integrations
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.201
- run: ./eng/test-local-packages.sh Release
- uses: actions/upload-artifact@v7
with:
name: packages
path: artifacts/packages
name: local-nuget-packages
path: artifacts/package-integration/feed
if-no-files-found: error

trimmed:
name: Full trim (${{ matrix.rid }})
Expand All @@ -91,8 +74,8 @@ jobs:
executable: ./artifacts/trim/ProMvvm.AotSmoke
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.201
- run: >-
Expand Down Expand Up @@ -120,8 +103,8 @@ jobs:
executable: ./artifacts/aot/ProMvvm.AotSmoke
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.201
- run: >-
Expand All @@ -135,8 +118,8 @@ jobs:
name: NativeAOT framework samples
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.201
- run: >-
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,11 @@ jobs:
-o artifacts/packages
- name: Validate package contents
run: ./eng/validate-packages.sh "${{ steps.release.outputs.version }}"
- name: Restore automatic generator package smoke test
- name: Test all package and framework integrations
run: >-
dotnet restore tests/ProMvvm.PackageSmoke
--no-cache
--source artifacts/packages
- name: Run automatic generator package smoke test
run: dotnet run --project tests/ProMvvm.PackageSmoke -c Release --no-restore
- name: Restore explicit generator package smoke test
run: >-
dotnet restore tests/ProMvvm.SourceGenerators.PackageSmoke
--no-cache
--source artifacts/packages
- name: Run explicit generator package smoke test
run: >-
dotnet run --project tests/ProMvvm.SourceGenerators.PackageSmoke
-c Release --no-restore
./eng/run-package-integrations.sh
artifacts/packages
"${{ steps.release.outputs.version }}"
- name: Generate checksums
working-directory: artifacts/packages
run: sha256sum -- ./*.nupkg ./*.snupkg > SHA256SUMS
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,19 @@ dotnet test tests/ProMvvm.SourceGenerators.Tests -c Release
dotnet test tests/ProMvvm.IntegrationTests -c Release
dotnet test tests/ProMvvm.ReactiveUiCoreIntegrationTests -c Release

./eng/test-local-packages.sh Release

dotnet publish tests/ProMvvm.AotSmoke -c Release -r osx-arm64 --self-contained
./tests/ProMvvm.AotSmoke/bin/Release/net10.0/osx-arm64/publish/ProMvvm.AotSmoke
```

Release unit tests enforce 100% line coverage, at least 98% branch coverage, and 100% method coverage. Dedicated generator tests validate emitted descriptors and overloads; integration tests compile and execute both source-generator ecosystems.

CI builds and tests on Linux, Windows, and macOS, and full-trim and NativeAOT smoke executables run on all three platforms. Both framework samples are also NativeAOT-published and executed. Package smoke tests restore from the freshly built local feed and validate both automatic generator installation through `ProMvvm` and an explicit `ProMvvm.SourceGenerators` reference.
CI builds and tests on Linux, Windows, and macOS, and full-trim and NativeAOT smoke executables run on all three platforms. Both framework samples are also NativeAOT-published and executed. A dedicated local-package CI job packs both NuGet packages and runs 12 dependency-isolated integration projects across plain INPC, explicit adapters, CommunityToolkit.Mvvm, ReactiveUI core, and ReactiveUI.Reactive, with separate typed, expression, and explicit-generator graphs. See the [local NuGet integration matrix](tests/PackageIntegration/README.md) for the exact coverage and focused commands.

## Releasing

Version tags drive the release workflow, which revalidates the complete test and package-smoke surface, publishes both packages to NuGet.org through trusted publishing, and creates a GitHub release containing the packages, runtime symbols, and SHA-256 checksums. See the [release guide](docs/RELEASING.md) for repository setup and the release procedure.
Version tags drive the release workflow, which revalidates the complete test and local-package integration surface, publishes both packages to NuGet.org through trusted publishing, and creates a GitHub release containing the packages, runtime symbols, and SHA-256 checksums. See the [release guide](docs/RELEASING.md) for repository setup and the release procedure.

## Benchmarks

Expand Down
5 changes: 3 additions & 2 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Releasing ProMvvm

Releases are produced by the tag-driven [release workflow](../.github/workflows/release.yml). The workflow validates, tests, packs, and smoke-tests both NuGet packages before it publishes them to NuGet.org and creates the matching GitHub release.
Releases are produced by the tag-driven [release workflow](../.github/workflows/release.yml). The workflow validates, tests, packs, and runs the complete local NuGet integration matrix before it publishes both packages to NuGet.org and creates the matching GitHub release.

## One-time setup

Expand Down Expand Up @@ -50,7 +50,8 @@ Before publishing, the workflow verifies that:
- the tag has a supported version form and exactly matches both project package versions;
- the tag resolves to the checked-out commit and that commit is reachable from `main`;
- the solution builds and all runtime, generator, and integration test suites pass;
- both the automatic and explicit source-generator package consumption modes restore and run from the local package output;
- all 12 isolated runtime, explicit-generator, adapter, CommunityToolkit.Mvvm, ReactiveUI core, and ReactiveUI.Reactive package projects restore and pass from the local package output;
- NuGet restore metadata proves each ProMvvm package dependency came from that local output rather than NuGet.org or a machine cache;
- the generator package exposes only its analyzer asset, while the runtime package contains the runtime assembly and retains its generator dependency.

The workflow publishes `ProMvvm.SourceGenerators` before `ProMvvm`, uploads the runtime symbol package automatically with the runtime package, and attaches all packages plus `SHA256SUMS` to the generated GitHub release. NuGet pushes use `--skip-duplicate`, so a failed publishing job can be rerun safely after a partial NuGet.org upload.
Expand Down
110 changes: 110 additions & 0 deletions eng/run-package-integrations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env bash

set -euo pipefail

package_directory="${1:-}"
package_version="${2:-}"

if [[ -z "$package_directory" || -z "$package_version" ]]; then
echo "Usage: $0 <package-directory> <package-version> [project ...]" >&2
exit 2
fi

shift 2

if [[ ! -d "$package_directory" ]]; then
echo "Package directory '$package_directory' does not exist." >&2
exit 1
fi

package_directory="$(cd "$package_directory" && pwd)"
runtime_package="$package_directory/ProMvvm.$package_version.nupkg"
generator_package="$package_directory/ProMvvm.SourceGenerators.$package_version.nupkg"

./eng/validate-packages.sh "$package_version" "$package_directory"

package_fingerprint="$(
shasum -a 256 "$runtime_package" "$generator_package" |
shasum -a 256 |
awk '{ print $1 }'
)"
integration_packages_directory="$(pwd)/artifacts/package-integration/cache/$package_version/$package_fingerprint"
runtime_extract_directory="$(pwd)/artifacts/package-integration/runtime/$package_fingerprint"
runtime_assembly="$runtime_extract_directory/lib/net10.0/ProMvvm.dll"
mkdir -p "$integration_packages_directory"
mkdir -p "$runtime_extract_directory"

if [[ ! -f "$runtime_assembly" ]]; then
unzip -q "$runtime_package" 'lib/net10.0/ProMvvm.dll' -d "$runtime_extract_directory"
fi

package_projects=(
tests/PackageIntegration/Plain.Typed/ProMvvm.PackageIntegration.Plain.Typed.csproj
tests/PackageIntegration/Plain.Expression/ProMvvm.PackageIntegration.Plain.Expression.csproj
tests/PackageIntegration/NotificationAdapters/ProMvvm.PackageIntegration.NotificationAdapters.csproj
tests/PackageIntegration/SourceGenerators.Plain/ProMvvm.PackageIntegration.SourceGenerators.Plain.csproj
tests/PackageIntegration/CommunityToolkit.Typed/ProMvvm.PackageIntegration.CommunityToolkit.Typed.csproj
tests/PackageIntegration/CommunityToolkit.Expression/ProMvvm.PackageIntegration.CommunityToolkit.Expression.csproj
tests/PackageIntegration/SourceGenerators.CommunityToolkit/ProMvvm.PackageIntegration.SourceGenerators.CommunityToolkit.csproj
tests/PackageIntegration/ReactiveUIReactive.Typed/ProMvvm.PackageIntegration.ReactiveUIReactive.Typed.csproj
tests/PackageIntegration/ReactiveUIReactive.Expression/ProMvvm.PackageIntegration.ReactiveUIReactive.Expression.csproj
tests/PackageIntegration/SourceGenerators.ReactiveUI/ProMvvm.PackageIntegration.SourceGenerators.ReactiveUI.csproj
tests/PackageIntegration/ReactiveUICore.Typed/ProMvvm.PackageIntegration.ReactiveUICore.Typed.csproj
tests/PackageIntegration/ReactiveUICore.Expression/ProMvvm.PackageIntegration.ReactiveUICore.Expression.csproj
)

if (( $# > 0 )); then
package_projects=("$@")
fi

for package_project in "${package_projects[@]}"; do
if [[ ! -f "$package_project" ]]; then
echo "Package integration project '$package_project' does not exist." >&2
exit 1
fi

echo "Restoring $package_project from local ProMvvm packages."
NUGET_PACKAGES="$integration_packages_directory" \
dotnet restore "$package_project" \
--force \
--no-cache \
--packages "$integration_packages_directory" \
--source "$package_directory" \
--source https://api.nuget.org/v3/index.json \
-p:ProMvvmPackageVersion="$package_version" \
-p:ProMvvmRuntimeAssembly="$runtime_assembly"

restored_package_ids=(promvvm promvvm.sourcegenerators)
if [[ "$package_project" == *'/SourceGenerators.'* ]]; then
restored_package_ids=(promvvm.sourcegenerators)
project_assets="$(dirname "$package_project")/obj/project.assets.json"
if grep -Fq "\"ProMvvm/$package_version\"" "$project_assets"; then
echo "$package_project must use the extracted runtime assembly, not a ProMvvm package reference." >&2
exit 1
fi
fi

for package_id in "${restored_package_ids[@]}"; do
package_metadata="$integration_packages_directory/$package_id/$package_version/.nupkg.metadata"
if [[ ! -f "$package_metadata" ]]; then
echo "$package_project did not restore $package_id $package_version." >&2
exit 1
fi

if ! grep -Fq "\"source\": \"$package_directory\"" "$package_metadata"; then
echo "$package_project restored $package_id from a source other than '$package_directory'." >&2
exit 1
fi
done

echo "Testing $package_project."
NUGET_PACKAGES="$integration_packages_directory" \
dotnet test "$package_project" \
-c Release \
--no-restore \
-p:ProMvvmPackageVersion="$package_version" \
-p:ProMvvmRuntimeAssembly="$runtime_assembly" \
--logger "console;verbosity=minimal"
done

echo "All ${#package_projects[@]} local-package integration projects passed."
27 changes: 27 additions & 0 deletions eng/test-local-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -euo pipefail

package_configuration="${1:-Release}"
if (( $# > 0 )); then
shift
fi

package_version="$(
dotnet msbuild src/ProMvvm/ProMvvm.csproj \
-nologo \
-getProperty:PackageVersion \
-p:Configuration="$package_configuration" |
tr -d '\r'
)"
package_directory="artifacts/package-integration/feed/$package_version"
mkdir -p "$package_directory"

dotnet pack src/ProMvvm.SourceGenerators \
-c "$package_configuration" \
-o "$package_directory"
dotnet pack src/ProMvvm \
-c "$package_configuration" \
-o "$package_directory"

./eng/run-package-integrations.sh "$package_directory" "$package_version" "$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace ProMvvm.PackageIntegration;

public sealed class CommunityToolkitExpressionPackageTests
{
[Fact]
public void ExpressionNestedAndMultiSourceApisObserveToolkitProperties()
{
var model = new ToolkitModel();
var count = new RecordingObserver<int>();
var child = new RecordingObserver<int>();
var projection = new RecordingObserver<string>();

#pragma warning disable IL2026
using var countSubscription = WhenAnyValueExtensions.WhenAnyValue(model, value => value.Count)
.Subscribe(count);
using var childSubscription = WhenAnyValueExtensions.WhenAnyValue(
model,
value => value.Child.Value)
.Subscribe(child);
using var projectionSubscription = WhenAnyValueMultiExtensions.WhenAnyValue(
model,
value => value.Name,
value => value.Count,
static (name, value) => $"{name}:{value}")
.Subscribe(projection);
#pragma warning restore IL2026

model.Count = 2;
model.Child.Value = 3;
model.Name = "changed";
model.Child = new ToolkitChild { Value = 4 };

Assert.Equal([1, 2], count.Values);
Assert.Equal([2, 3, 4], child.Values);
Assert.Equal(["toolkit:1", "toolkit:2", "changed:2"], projection.Values);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../PackageIntegration.props" />
<ItemGroup>
<Compile Include="../Shared/CommunityToolkitModels.cs" Link="CommunityToolkitModels.cs" />
<PackageReference Include="ProMvvm" Version="$(ProMvvmPackageVersion)" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace ProMvvm.PackageIntegration;

public sealed class CommunityToolkitTypedPackageTests
{
[Fact]
public void GeneratedNestedAndMultiSourcePathsObserveToolkitProperties()
{
var model = new ToolkitModel();
var count = new RecordingObserver<int>();
var child = new RecordingObserver<int>();
var projection = new RecordingObserver<string>();
var childPath = ToolkitModelPropertyPaths.Child
.Then(nameof(ToolkitChild.Value), static value => value.Value);

using var countSubscription = model.WhenAnyValue(ToolkitModelPropertyPaths.Count)
.Subscribe(count);
using var childSubscription = model.WhenAnyValue(childPath).Subscribe(child);
using var projectionSubscription = model.WhenAnyValue(
ToolkitModelPropertyPaths.Name,
ToolkitModelPropertyPaths.Count,
static (name, value) => $"{name}:{value}")
.Subscribe(projection);

model.Count = 2;
model.Child.Value = 3;
model.Name = "changed";
model.Child = new ToolkitChild { Value = 4 };

Assert.Equal([1, 2], count.Values);
Assert.Equal([2, 3, 4], child.Values);
Assert.Equal(["toolkit:1", "toolkit:2", "changed:2"], projection.Values);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../PackageIntegration.props" />
<ItemGroup>
<Compile Include="../Shared/CommunityToolkitModels.cs" Link="CommunityToolkitModels.cs" />
<PackageReference Include="ProMvvm" Version="$(ProMvvmPackageVersion)" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
</ItemGroup>
</Project>
Loading