Skip to content

Commit ce93a25

Browse files
blaze6950Mykyta ZotovCopilot
authored
Feature/define visited places cache (#12)
* feat: implement Visited Places cache with initial project structure and dependencies; docs were updated to describe new VPC; refactor: update benchmarks for cache performance evaluation; refactor: refactor rebalance decision logic and diagnostics interface; test: refactor unit tests for cache interaction and diagnostics; chore: update project files for new cache implementation * feat(visited-places): implement Visited Places cache with data generation helpers and test data sources; chore: add project files for Visited Places cache and its tests; refactor: remove unused caching references from various files * refactor(eviction): unify just-stored segment handling and improve eviction logic; refactor(evaluators): consolidate eviction count computation methods; refactor(scheduler): enhance event channel capacity configuration options; docs: update comments and documentation for clarity and accuracy; * refactor(SnapshotAppendBufferStorage): move configuration value to settings * refactor(eviction): update eviction policies and selectors for improved clarity and functionality; feat(eviction): introduce new eviction selectors and policies for enhanced cache management; docs: update documentation to reflect changes in eviction strategy and cache structure; test: add unit tests for new eviction policies and selectors * refactor(eviction): remove unnecessary statistics from CachedSegment initialization; feat(eviction): introduce IEvictionMetadata interface for selector-owned metadata; test: update tests to reflect changes in segment metadata handling; docs: update documentation to describe new eviction metadata structure; * refactor(eviction): update pressure classes to use nested types for clarity and consistency; refactor(eviction): improve documentation for pressure produced by policies * refactor(eviction): enhance SmallestFirstEvictionSelector with cached span metadata; add tests for metadata initialization and ordering fallback * refactor(eviction): implement sampling-based eviction strategy for selectors; update selector interfaces and metadata handling * refactor(eviction): update metadata handling in eviction selectors; simplify interface and clarify metadata requirements * refactor(eviction): simplify pressure evaluation logic in BackgroundEventProcessor * refactor(eviction): add TODO comment regarding sync method behavior with task-based scheduler * refactor(visited-places-cache): update constructor parameters to suggest configuration in options * refactor(visited-places-cache): update storage strategy options to use typed configuration objects; refactor(visited-places-cache): simplify cache options handling for storage strategies; refactor(visited-places-cache): remove unused using directives from cache-related files; refactor(storage-strategy-options): introduce new storage strategy options classes for better configuration management; refactor(tests): update tests to accommodate changes in storage strategy options * refactor(visited-places-cache): update constructor documentation to clarify usage of builder API * refactor(eviction): encapsulate eviction policy lifecycle and evaluation logic in a dedicated evaluator class; refactor(eviction): simplify null checks using ArgumentNullException.ThrowIfNull; refactor(eviction): update BackgroundEventProcessor to use the new EvictionPolicyEvaluator; refactor(eviction): enhance MaxTotalSpanPolicy to implement stateful behavior; refactor(eviction): improve documentation for eviction policies and their lifecycle methods; refactor(eviction): add unit tests for EvictionPolicyEvaluator and stateful policies * refactor(eviction): encapsulate eviction logic within a new EvictionEngine class; update BackgroundEventProcessor to utilize the engine for metadata management, policy evaluation, and eviction execution * refactor(cache-normalization): rename BackgroundEventProcessor to CacheNormalizationExecutor; update related diagnostics and documentation * chore: update xunit.runner.visualstudio package version to 2.8.2 in test projects * refactor(eviction): improve XML documentation formatting in EvictionPolicyEvaluator and UserRequestHandler * refactor(eviction): remove unnecessary timestamp parameters from metadata methods * fix: ensure ThreadPool execution via Task.Yield() in ChainExecutionAsync; docs: update documentation for clarity * refactor(work-scheduler): remove unnecessary comments regarding Func usage * refactor(diagnostics): rename ICacheDiagnostics to IVisitedPlacesCacheDiagnostics and update related references; fix(diagnostics): ensure background operation failure events are correctly reported; refactor: update diagnostics handling in various components to use new interface * refactor(eviction): improve XML documentation formatting in EvictionEngine * refactor(data-sources): replace List with Array for data generation methods; refactor(diagnostics): remove unused using directives from diagnostics files; * refactor(UserRequestHandler): optimize memory handling by using IEnumerable instead of IList * refactor(UserRequestHandler): optimize memory usage by utilizing IEnumerable for segment assembly * refactor(UserRequestHandler): improve data assembly by utilizing RangeData sources and optimizing memory usage * refactor(UserRequestHandler): optimize data handling by replacing List with Array and improving memory allocation * refactor(UserRequestHandler): optimize memory allocations by reducing array allocations in data processing * refactor(UserRequestHandler): optimize memory allocations by utilizing ArrayPool for buffer management and replacing List with IEnumerable for gap computation * feat(ttl): implement TTL expiration for cached segments with diagnostics; refactor: enhance diagnostics for TTL events and segment removal; refactor: update cache options to support segment TTL configuration; test: add unit tests for TTL expiration behavior and idempotency * docs: update diagnostics documentation with execution context and threading details; refactor: improve diagnostic hooks implementation guidelines and context annotations * refactor: rename TaskBasedWorkScheduler and ChannelBasedWorkScheduler to UnboundedSerialWorkScheduler and BoundedSerialWorkScheduler respectively; update documentation and references throughout the codebase * feat(scheduler): implement bounded and unbounded serial work schedulers with backpressure control and task chaining; test: add unit tests for ConcurrentWorkScheduler functionality and lifecycle * refactor(TtlExpirationWorkItem): replace private cancellation token field with public property * refactor(VisitedPlacesCache): replace cancellation token cancellation with asynchronous method * refactor: diagnostics interfaces have been updated to include new caching infrastructure; refactor: work scheduler interfaces have been introduced for serialization and supersession semantics; refactor: caching classes have been modified to utilize new work scheduler interfaces; * refactor(TtlEngine): encapsulate TTL subsystem and simplify CacheNormalizationExecutor integration; update diagnostics and disposal logic * fix: update imports to include new scheduling infrastructure components * refactor(CacheNormalizationExecutor): simplify eviction candidate selection logic; update policies to maintain internal state; enhance storage interaction in eviction selectors * refactor: update segment removal methods to use TryRemove and TryGetRandomSegment; improve documentation for eviction logic * refactor: extract common logic into SegmentStorageBase; simplify segment management in LinkedListStrideIndexStorage and SnapshotAppendBufferStorage * refactor: improve segment intersection logic and enhance documentation for stride index operations; unify binary search accessors for segment retrieval * feat: concrete eviction types have been made public; refactor: NoOp stubs have been removed from WasmValidation in favor of real implementations; ci: monolithic workflow has been split into SWC-specific and VPC-specific workflows; feat: VPC WasmValidation project has been added; docs: AGENTS.md has been updated to reflect public eviction API and dual CI/CD workflows * docs: AGENTS.md has been updated with code style guidelines for braces and commit policy * refactor: update paths for SlidingWindow and VisitedPlaces projects in CI/CD scripts and configuration files; improve local CI/CD testing script for clarity and organization * docs: code comments have been enhanced for clarity and allocation notes; refactor: lazy initialization has been implemented for result lists to reduce allocations; refactor: memory allocation patterns have been optimized in various storage classes * refactor: optimize gap computation logic to eliminate closure allocations; improve test strategy creation for clarity * refactor: allocation strategy for hittingRangeData and merged sources has been optimized; ArrayPool usage has been removed for small arrays; documentation has been updated for clarity * refactor: segment lifecycle notification methods have been updated for clarity and consistency; OnSegmentsRemoved has been replaced with OnSegmentRemoved for individual segment notifications * refactor: improve linked list node unlinking logic for thread safety and clarity; enhance comments for better understanding * refactor: code comments have been enhanced for clarity and consistency across multiple files * refactor: improve package creation error handling and logging for clarity; update documentation references for VisitedPlaces * refactor: remove core project build and pack steps from CI workflows; update project references to use PrivateAssets * refactor: async methods have been updated to use BuildAsync for cache initialization; validation for bounded ranges has been added * refactor: code comments have been improved for clarity and consistency in IEvictionMetadata * docs: update diagnostics and glossary for VisitedPlaces cache; add architecture and test infrastructure documentation * docs: architecture documentation has been updated for clarity and accuracy; glossary terms have been refined * docs: architecture documentation has been enhanced for clarity and detail; cache behavior explanations have been refined; refactor: code comments have been improved for consistency and clarity across multiple files; unnecessary remarks have been removed; * docs: agent guidelines have been updated for clarity and conciseness; build and test commands have been streamlined * docs: infrastructure and architecture documentation have been updated for clarity on task scheduling mechanisms; cache behavior explanations have been refined * feat: shared infrastructure for data generation has been introduced; cache data extension service has been renamed to cache data extender; disposal state management has been refactored for concurrency safety * refactor: unused using directives have been removed from several files; new test data sources have been introduced for boundary handling and exception testing * refactor: eviction policy lifecycle has been clarified and improved for thread safety; cache layer initialization has been enhanced for better readability; exception handling during cache building has been refined * refactor: activity counter management has been improved for thread safety; NaN checks have been added for cache size and threshold parameters; TOCTOU race conditions have been mitigated in caching mechanisms * style: spacing in array spread syntax has been corrected * feat(benchmarks): performance benchmarks for caching mechanisms have been introduced; benchmark runner has been implemented; synchronous and slow data sources have been added for testing; construction benchmarks for layered cache have been created * feat(storage): AddRange method has been introduced for bulk segment insertion; CacheNormalizationRequest has been updated to support multiple fetched chunks; documentation for AddRange has been added; tests for AddRange functionality have been implemented * feat(benchmarks): multiple gaps and single gap partial hit benchmarks have been introduced for VisitedPlaces cache; CacheMissBenchmarks have been updated for improved parameterization; README has been updated to reflect new benchmark files and cases * feat(cache): TTL expiration handling has been integrated into normalization process; diagnostics for expired segments have been updated; time provider has been introduced for deterministic testing; documentation has been revised to reflect changes * fix(cache): eviction logic has been corrected to ensure segments are only removed if present * refactor(cache): CacheNormalizationExecutor has been simplified by removing the TDomain type parameter; related tests have been updated accordingly * refactor(cache): expiration check logic has been streamlined to remove expired segments directly * refactor(storage): Add and AddRange methods have been replaced with TryAdd and TryAddRange for overlap checks; test: unit tests for TryAdd and TryAddRange methods have been updated accordingly * refactor(cache): segment removal logic has been updated to use TryRemove; documentation has been clarified for segment storage invariants * chore: benchmark tests for VPC have been planned; code formatting has been improved * docs: documentation has been updated to reflect TryRemove semantics and TTL normalization changes; refactor(storage): segment removal logic has been updated to use TryRemove with idempotent removal; refactor(builder): Build method has been restricted to single use per builder instance; refactor: linked list storage synchronization has been clarified and structural mutations have been guarded; refactor: SnapshotReadStorage read path has been optimized for consistency; test: SlidingWindowCacheBuilder tests have been updated to verify single-use restriction; test: SegmentStorageBaseTests naming has been clarified for intra-batch overlap behavior * docs: XML documentation has been streamlined for clarity and consistency; refactor: parameter descriptions in various classes have been simplified; refactor: remarks and comments have been cleaned up for better readability. * refactor(cache): GetDataAndWaitForIdleAsync has been replaced with GetDataAsync for improved performance; documentation has been updated to clarify event channel capacity requirements * feat(cache): FrozenDataSource and FrozenYieldingDataSource have been introduced for improved caching performance; learning pass has been implemented in benchmarks to ensure data sources are pre-learned before measurements. * feat(benchmarks): benchmark classes have been renamed for clarity and consistency; new eventual and strong consistency benchmarks for cache hits and misses have been added * refactor(benchmarks): layout constants and factory methods have been streamlined for clarity; learning pass logic has been centralized for improved maintainability; cache setup methods have been standardized across benchmark classes * chore: old project with benchmarks was removed * feat(benchmarks): new benchmark reports for layered and visited places caching scenarios have been added * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Mykyta Zotov <mykyta.zotov@ihsmarkit.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent af912bb commit ce93a25

337 files changed

Lines changed: 35311 additions & 13881 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/test-ci-locally.ps1

Lines changed: 108 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Local CI/CD Testing Script
2-
# This script replicates the GitHub Actions workflow locally for testing
2+
# This script replicates the GitHub Actions workflows locally for testing
33

44
Write-Host "========================================" -ForegroundColor Cyan
55
Write-Host "Intervals.NET.Caching CI/CD Local Test" -ForegroundColor Cyan
@@ -8,19 +8,28 @@ Write-Host ""
88

99
# Environment variables (matching GitHub Actions)
1010
$env:SOLUTION_PATH = "Intervals.NET.Caching.sln"
11-
$env:PROJECT_PATH = "src/Intervals.NET.Caching/Intervals.NET.Caching.csproj"
12-
$env:WASM_VALIDATION_PATH = "src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj"
13-
$env:UNIT_TEST_PATH = "tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj"
14-
$env:INTEGRATION_TEST_PATH = "tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj"
15-
$env:INVARIANTS_TEST_PATH = "tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj"
11+
12+
# SlidingWindow
13+
$env:SWC_PROJECT_PATH = "src/Intervals.NET.Caching.SlidingWindow/Intervals.NET.Caching.SlidingWindow.csproj"
14+
$env:SWC_WASM_VALIDATION_PATH = "src/Intervals.NET.Caching.SlidingWindow.WasmValidation/Intervals.NET.Caching.SlidingWindow.WasmValidation.csproj"
15+
$env:SWC_UNIT_TEST_PATH = "tests/Intervals.NET.Caching.SlidingWindow.Unit.Tests/Intervals.NET.Caching.SlidingWindow.Unit.Tests.csproj"
16+
$env:SWC_INTEGRATION_TEST_PATH = "tests/Intervals.NET.Caching.SlidingWindow.Integration.Tests/Intervals.NET.Caching.SlidingWindow.Integration.Tests.csproj"
17+
$env:SWC_INVARIANTS_TEST_PATH = "tests/Intervals.NET.Caching.SlidingWindow.Invariants.Tests/Intervals.NET.Caching.SlidingWindow.Invariants.Tests.csproj"
18+
19+
# VisitedPlaces
20+
$env:VPC_PROJECT_PATH = "src/Intervals.NET.Caching.VisitedPlaces/Intervals.NET.Caching.VisitedPlaces.csproj"
21+
$env:VPC_WASM_VALIDATION_PATH = "src/Intervals.NET.Caching.VisitedPlaces.WasmValidation/Intervals.NET.Caching.VisitedPlaces.WasmValidation.csproj"
22+
$env:VPC_UNIT_TEST_PATH = "tests/Intervals.NET.Caching.VisitedPlaces.Unit.Tests/Intervals.NET.Caching.VisitedPlaces.Unit.Tests.csproj"
23+
$env:VPC_INTEGRATION_TEST_PATH = "tests/Intervals.NET.Caching.VisitedPlaces.Integration.Tests/Intervals.NET.Caching.VisitedPlaces.Integration.Tests.csproj"
24+
$env:VPC_INVARIANTS_TEST_PATH = "tests/Intervals.NET.Caching.VisitedPlaces.Invariants.Tests/Intervals.NET.Caching.VisitedPlaces.Invariants.Tests.csproj"
1625

1726
# Track failures
1827
$failed = $false
1928

2029
# Step 1: Restore solution dependencies
21-
Write-Host "[Step 1/9] Restoring solution dependencies..." -ForegroundColor Yellow
30+
Write-Host "[Step 1/12] Restoring solution dependencies..." -ForegroundColor Yellow
2231
dotnet restore $env:SOLUTION_PATH
23-
if ($LASTEXITCODE -ne 0) {
32+
if ($LASTEXITCODE -ne 0) {
2433
Write-Host "? Restore failed" -ForegroundColor Red
2534
$failed = $true
2635
}
@@ -30,9 +39,9 @@ else {
3039
Write-Host ""
3140

3241
# Step 2: Build solution
33-
Write-Host "[Step 2/9] Building solution (Release)..." -ForegroundColor Yellow
42+
Write-Host "[Step 2/12] Building solution (Release)..." -ForegroundColor Yellow
3443
dotnet build $env:SOLUTION_PATH --configuration Release --no-restore
35-
if ($LASTEXITCODE -ne 0) {
44+
if ($LASTEXITCODE -ne 0) {
3645
Write-Host "? Build failed" -ForegroundColor Red
3746
$failed = $true
3847
}
@@ -41,56 +50,104 @@ else {
4150
}
4251
Write-Host ""
4352

44-
# Step 3: Validate WebAssembly compatibility
45-
Write-Host "[Step 3/9] Validating WebAssembly compatibility..." -ForegroundColor Yellow
46-
dotnet build $env:WASM_VALIDATION_PATH --configuration Release --no-restore
47-
if ($LASTEXITCODE -ne 0) {
48-
Write-Host "? WebAssembly validation failed" -ForegroundColor Red
53+
# Step 3: Validate SlidingWindow WebAssembly compatibility
54+
Write-Host "[Step 3/12] Validating SlidingWindow WebAssembly compatibility..." -ForegroundColor Yellow
55+
dotnet build $env:SWC_WASM_VALIDATION_PATH --configuration Release --no-restore
56+
if ($LASTEXITCODE -ne 0) {
57+
Write-Host "? SlidingWindow WebAssembly validation failed" -ForegroundColor Red
58+
$failed = $true
59+
}
60+
else {
61+
Write-Host "? SlidingWindow WebAssembly compilation successful - library is compatible with net8.0-browser" -ForegroundColor Green
62+
}
63+
Write-Host ""
64+
65+
# Step 4: Validate VisitedPlaces WebAssembly compatibility
66+
Write-Host "[Step 4/12] Validating VisitedPlaces WebAssembly compatibility..." -ForegroundColor Yellow
67+
dotnet build $env:VPC_WASM_VALIDATION_PATH --configuration Release --no-restore
68+
if ($LASTEXITCODE -ne 0) {
69+
Write-Host "? VisitedPlaces WebAssembly validation failed" -ForegroundColor Red
4970
$failed = $true
5071
}
5172
else {
52-
Write-Host "? WebAssembly compilation successful - library is compatible with net8.0-browser" -ForegroundColor Green
73+
Write-Host "? VisitedPlaces WebAssembly compilation successful - library is compatible with net8.0-browser" -ForegroundColor Green
5374
}
5475
Write-Host ""
5576

56-
# Step 4: Run Unit Tests
57-
Write-Host "[Step 4/9] Running Unit Tests with coverage..." -ForegroundColor Yellow
58-
dotnet test $env:UNIT_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Unit
59-
if ($LASTEXITCODE -ne 0) {
60-
Write-Host "? Unit tests failed" -ForegroundColor Red
77+
# Step 5: Run SlidingWindow Unit Tests
78+
Write-Host "[Step 5/12] Running SlidingWindow Unit Tests with coverage..." -ForegroundColor Yellow
79+
dotnet test $env:SWC_UNIT_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/SWC/Unit
80+
if ($LASTEXITCODE -ne 0) {
81+
Write-Host "? SlidingWindow Unit tests failed" -ForegroundColor Red
6182
$failed = $true
6283
}
6384
else {
64-
Write-Host "? Unit tests passed" -ForegroundColor Green
85+
Write-Host "? SlidingWindow Unit tests passed" -ForegroundColor Green
6586
}
6687
Write-Host ""
6788

68-
# Step 5: Run Integration Tests
69-
Write-Host "[Step 5/9] Running Integration Tests with coverage..." -ForegroundColor Yellow
70-
dotnet test $env:INTEGRATION_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Integration
71-
if ($LASTEXITCODE -ne 0) {
72-
Write-Host "? Integration tests failed" -ForegroundColor Red
89+
# Step 6: Run SlidingWindow Integration Tests
90+
Write-Host "[Step 6/12] Running SlidingWindow Integration Tests with coverage..." -ForegroundColor Yellow
91+
dotnet test $env:SWC_INTEGRATION_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/SWC/Integration
92+
if ($LASTEXITCODE -ne 0) {
93+
Write-Host "? SlidingWindow Integration tests failed" -ForegroundColor Red
7394
$failed = $true
7495
}
7596
else {
76-
Write-Host "? Integration tests passed" -ForegroundColor Green
97+
Write-Host "? SlidingWindow Integration tests passed" -ForegroundColor Green
7798
}
7899
Write-Host ""
79100

80-
# Step 6: Run Invariants Tests
81-
Write-Host "[Step 6/9] Running Invariants Tests with coverage..." -ForegroundColor Yellow
82-
dotnet test $env:INVARIANTS_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Invariants
83-
if ($LASTEXITCODE -ne 0) {
84-
Write-Host "? Invariants tests failed" -ForegroundColor Red
101+
# Step 7: Run SlidingWindow Invariants Tests
102+
Write-Host "[Step 7/12] Running SlidingWindow Invariants Tests with coverage..." -ForegroundColor Yellow
103+
dotnet test $env:SWC_INVARIANTS_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/SWC/Invariants
104+
if ($LASTEXITCODE -ne 0) {
105+
Write-Host "? SlidingWindow Invariants tests failed" -ForegroundColor Red
85106
$failed = $true
86107
}
87108
else {
88-
Write-Host "? Invariants tests passed" -ForegroundColor Green
109+
Write-Host "? SlidingWindow Invariants tests passed" -ForegroundColor Green
89110
}
90111
Write-Host ""
91112

92-
# Step 7: Check coverage files
93-
Write-Host "[Step 7/9] Checking coverage files..." -ForegroundColor Yellow
113+
# Step 8: Run VisitedPlaces Unit Tests
114+
Write-Host "[Step 8/12] Running VisitedPlaces Unit Tests with coverage..." -ForegroundColor Yellow
115+
dotnet test $env:VPC_UNIT_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/VPC/Unit
116+
if ($LASTEXITCODE -ne 0) {
117+
Write-Host "? VisitedPlaces Unit tests failed" -ForegroundColor Red
118+
$failed = $true
119+
}
120+
else {
121+
Write-Host "? VisitedPlaces Unit tests passed" -ForegroundColor Green
122+
}
123+
Write-Host ""
124+
125+
# Step 9: Run VisitedPlaces Integration Tests
126+
Write-Host "[Step 9/12] Running VisitedPlaces Integration Tests with coverage..." -ForegroundColor Yellow
127+
dotnet test $env:VPC_INTEGRATION_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/VPC/Integration
128+
if ($LASTEXITCODE -ne 0) {
129+
Write-Host "? VisitedPlaces Integration tests failed" -ForegroundColor Red
130+
$failed = $true
131+
}
132+
else {
133+
Write-Host "? VisitedPlaces Integration tests passed" -ForegroundColor Green
134+
}
135+
Write-Host ""
136+
137+
# Step 10: Run VisitedPlaces Invariants Tests
138+
Write-Host "[Step 10/12] Running VisitedPlaces Invariants Tests with coverage..." -ForegroundColor Yellow
139+
dotnet test $env:VPC_INVARIANTS_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/VPC/Invariants
140+
if ($LASTEXITCODE -ne 0) {
141+
Write-Host "? VisitedPlaces Invariants tests failed" -ForegroundColor Red
142+
$failed = $true
143+
}
144+
else {
145+
Write-Host "? VisitedPlaces Invariants tests passed" -ForegroundColor Green
146+
}
147+
Write-Host ""
148+
149+
# Step 11: Check coverage files
150+
Write-Host "[Step 11/12] Checking coverage files..." -ForegroundColor Yellow
94151
$coverageFiles = Get-ChildItem -Path "./TestResults" -Filter "coverage.cobertura.xml" -Recurse
95152
if ($coverageFiles.Count -gt 0) {
96153
Write-Host "? Found $($coverageFiles.Count) coverage file(s)" -ForegroundColor Green
@@ -103,26 +160,31 @@ else {
103160
}
104161
Write-Host ""
105162

106-
# Step 8: Build NuGet package
107-
Write-Host "[Step 8/9] Creating NuGet package..." -ForegroundColor Yellow
163+
# Step 12: Build NuGet packages
164+
Write-Host "[Step 12/12] Creating NuGet packages..." -ForegroundColor Yellow
108165
if (Test-Path "./artifacts") {
109166
Remove-Item -Path "./artifacts" -Recurse -Force
110167
}
111-
dotnet pack $env:PROJECT_PATH --configuration Release --no-build --output ./artifacts
112-
if ($LASTEXITCODE -ne 0) {
113-
Write-Host "? Package creation failed" -ForegroundColor Red
168+
dotnet pack $env:SWC_PROJECT_PATH --configuration Release --no-build --output ./artifacts
169+
if ($LASTEXITCODE -ne 0) {
170+
Write-Host "? Package creation failed (SlidingWindow)" -ForegroundColor Red
114171
$failed = $true
115172
}
116-
else {
173+
dotnet pack $env:VPC_PROJECT_PATH --configuration Release --no-build --output ./artifacts
174+
if ($LASTEXITCODE -ne 0) {
175+
Write-Host "? Package creation failed (VisitedPlaces)" -ForegroundColor Red
176+
$failed = $true
177+
}
178+
if (-not $failed) {
117179
$packages = Get-ChildItem -Path "./artifacts" -Filter "*.nupkg"
118-
Write-Host "? Package created successfully" -ForegroundColor Green
180+
Write-Host "? Packages created successfully" -ForegroundColor Green
119181
foreach ($pkg in $packages) {
120182
Write-Host " - $($pkg.Name)" -ForegroundColor Gray
121183
}
122184
}
123185
Write-Host ""
124186

125-
# Step 9: Summary
187+
# Summary
126188
Write-Host "========================================" -ForegroundColor Cyan
127189
Write-Host "Test Summary" -ForegroundColor Cyan
128190
Write-Host "========================================" -ForegroundColor Cyan
@@ -135,7 +197,7 @@ else {
135197
Write-Host ""
136198
Write-Host "Next steps:" -ForegroundColor Cyan
137199
Write-Host " - Review coverage reports in ./TestResults/" -ForegroundColor Gray
138-
Write-Host " - Inspect NuGet package in ./artifacts/" -ForegroundColor Gray
139-
Write-Host " - Push to trigger GitHub Actions workflow" -ForegroundColor Gray
200+
Write-Host " - Inspect NuGet packages in ./artifacts/" -ForegroundColor Gray
201+
Write-Host " - Push to trigger GitHub Actions workflows" -ForegroundColor Gray
140202
exit 0
141203
}
Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,75 @@
1-
name: CI/CD - Intervals.NET.Caching
1+
name: CI/CD - Intervals.NET.Caching.SlidingWindow
22

33
on:
44
push:
55
branches: [ master, main ]
66
paths:
77
- 'src/Intervals.NET.Caching/**'
8-
- 'src/Intervals.NET.Caching.WasmValidation/**'
9-
- 'tests/**'
10-
- '.github/workflows/Intervals.NET.Caching.yml'
8+
- 'src/Intervals.NET.Caching.SlidingWindow/**'
9+
- 'src/Intervals.NET.Caching.SlidingWindow.WasmValidation/**'
10+
- 'tests/Intervals.NET.Caching.SlidingWindow.Unit.Tests/**'
11+
- 'tests/Intervals.NET.Caching.SlidingWindow.Integration.Tests/**'
12+
- 'tests/Intervals.NET.Caching.SlidingWindow.Invariants.Tests/**'
13+
- 'tests/Intervals.NET.Caching.SlidingWindow.Tests.Infrastructure/**'
14+
- '.github/workflows/intervals-net-caching-swc.yml'
1115
pull_request:
1216
branches: [ master, main ]
1317
paths:
1418
- 'src/Intervals.NET.Caching/**'
15-
- 'src/Intervals.NET.Caching.WasmValidation/**'
16-
- 'tests/**'
17-
- '.github/workflows/Intervals.NET.Caching.yml'
19+
- 'src/Intervals.NET.Caching.SlidingWindow/**'
20+
- 'src/Intervals.NET.Caching.SlidingWindow.WasmValidation/**'
21+
- 'tests/Intervals.NET.Caching.SlidingWindow.Unit.Tests/**'
22+
- 'tests/Intervals.NET.Caching.SlidingWindow.Integration.Tests/**'
23+
- 'tests/Intervals.NET.Caching.SlidingWindow.Invariants.Tests/**'
24+
- 'tests/Intervals.NET.Caching.SlidingWindow.Tests.Infrastructure/**'
25+
- '.github/workflows/intervals-net-caching-swc.yml'
1826
workflow_dispatch:
1927

2028
env:
2129
DOTNET_VERSION: '8.x.x'
2230
SOLUTION_PATH: 'Intervals.NET.Caching.sln'
23-
PROJECT_PATH: 'src/Intervals.NET.Caching/Intervals.NET.Caching.csproj'
24-
WASM_VALIDATION_PATH: 'src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj'
25-
UNIT_TEST_PATH: 'tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj'
26-
INTEGRATION_TEST_PATH: 'tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj'
27-
INVARIANTS_TEST_PATH: 'tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj'
31+
PROJECT_PATH: 'src/Intervals.NET.Caching.SlidingWindow/Intervals.NET.Caching.SlidingWindow.csproj'
32+
WASM_VALIDATION_PATH: 'src/Intervals.NET.Caching.SlidingWindow.WasmValidation/Intervals.NET.Caching.SlidingWindow.WasmValidation.csproj'
33+
UNIT_TEST_PATH: 'tests/Intervals.NET.Caching.SlidingWindow.Unit.Tests/Intervals.NET.Caching.SlidingWindow.Unit.Tests.csproj'
34+
INTEGRATION_TEST_PATH: 'tests/Intervals.NET.Caching.SlidingWindow.Integration.Tests/Intervals.NET.Caching.SlidingWindow.Integration.Tests.csproj'
35+
INVARIANTS_TEST_PATH: 'tests/Intervals.NET.Caching.SlidingWindow.Invariants.Tests/Intervals.NET.Caching.SlidingWindow.Invariants.Tests.csproj'
2836

2937
jobs:
3038
build-and-test:
3139
runs-on: ubuntu-latest
32-
40+
3341
steps:
3442
- name: Checkout code
3543
uses: actions/checkout@v4
36-
44+
3745
- name: Setup .NET
3846
uses: actions/setup-dotnet@v4
3947
with:
4048
dotnet-version: ${{ env.DOTNET_VERSION }}
41-
49+
4250
- name: Restore solution dependencies
4351
run: dotnet restore ${{ env.SOLUTION_PATH }}
44-
52+
4553
- name: Build solution
4654
run: dotnet build ${{ env.SOLUTION_PATH }} --configuration Release --no-restore
47-
55+
4856
- name: Validate WebAssembly compatibility
4957
run: |
5058
echo "::group::WebAssembly Validation"
51-
echo "Building Intervals.NET.Caching.WasmValidation for net8.0-browser target..."
59+
echo "Building Intervals.NET.Caching.SlidingWindow.WasmValidation for net8.0-browser target..."
5260
dotnet build ${{ env.WASM_VALIDATION_PATH }} --configuration Release --no-restore
53-
echo "? WebAssembly compilation successful - library is compatible with net8.0-browser"
61+
echo "WebAssembly compilation successful - library is compatible with net8.0-browser"
5462
echo "::endgroup::"
55-
63+
5664
- name: Run Unit Tests with coverage
5765
run: dotnet test ${{ env.UNIT_TEST_PATH }} --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Unit
58-
66+
5967
- name: Run Integration Tests with coverage
6068
run: dotnet test ${{ env.INTEGRATION_TEST_PATH }} --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Integration
61-
69+
6270
- name: Run Invariants Tests with coverage
6371
run: dotnet test ${{ env.INVARIANTS_TEST_PATH }} --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Invariants
64-
72+
6573
- name: Upload coverage reports to Codecov
6674
uses: codecov/codecov-action@v4
6775
with:
@@ -76,30 +84,30 @@ jobs:
7684
runs-on: ubuntu-latest
7785
needs: build-and-test
7886
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
79-
87+
8088
steps:
8189
- name: Checkout code
8290
uses: actions/checkout@v4
83-
91+
8492
- name: Setup .NET
8593
uses: actions/setup-dotnet@v4
8694
with:
8795
dotnet-version: ${{ env.DOTNET_VERSION }}
88-
96+
8997
- name: Restore dependencies
90-
run: dotnet restore ${{ env.PROJECT_PATH }}
91-
92-
- name: Build Intervals.NET.Caching
98+
run: dotnet restore ${{ env.SOLUTION_PATH }}
99+
100+
- name: Build Intervals.NET.Caching.SlidingWindow
93101
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore
94-
95-
- name: Pack Intervals.NET.Caching
102+
103+
- name: Pack Intervals.NET.Caching.SlidingWindow
96104
run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output ./artifacts
97-
98-
- name: Publish Intervals.NET.Caching to NuGet
99-
run: dotnet nuget push ./artifacts/Intervals.NET.Caching.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
100-
105+
106+
- name: Publish packages to NuGet
107+
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
108+
101109
- name: Upload package artifacts
102110
uses: actions/upload-artifact@v4
103111
with:
104-
name: Intervals.NET.Caching-package
112+
name: nuget-packages-swc
105113
path: ./artifacts/*.nupkg

0 commit comments

Comments
 (0)