-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathJustfile
More file actions
168 lines (149 loc) · 6.29 KB
/
Justfile
File metadata and controls
168 lines (149 loc) · 6.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# Aliases
alias b := build
alias c := clean
alias t := test
# Matrix dimensions
frameworks := "net8.0 net9.0 net10.0"
lifetimes := "Singleton Scoped Transient"
publishers := "ForeachAwait TaskWhenAll"
sizes := "Default Large"
cachingModes := "Eager Lazy"
telemetryMetrics := "Off On"
telemetryTracing := "Off On"
# Main recipes
build:
dotnet build
clean:
git clean -fxd
dotnet build-server shutdown
restore:
dotnet tool restore
dotnet restore -v q
format:
dotnet csharpier format .
format-check:
dotnet csharpier check .
# Main test recipe - matches CI workflow
test: restore test-sourcegen test-memory test-matrix
# Test source generator (net10.0 only)
test-sourcegen:
@echo "=== Running Source Generator Tests (net10.0) ==="
dotnet build --no-restore -v q -f net10.0 ./test/Mediator.SourceGenerator.Tests/
dotnet test --no-restore --no-build -f net10.0 ./test/Mediator.SourceGenerator.Tests/
# Test memory allocation tests
test-memory:
@echo "=== Running Memory Allocation Tests ==="
#!/usr/bin/env sh
set -eu
for framework in {{frameworks}}; do \
echo "Testing memory allocation on $framework"; \
dotnet build --no-restore -v q -f "$framework" ./test/Mediator.MemAllocationTests/; \
dotnet test --no-restore --no-build -f "$framework" ./test/Mediator.MemAllocationTests/; \
done
# Test all matrix combinations for Mediator.Tests
test-matrix:
@echo "=== Running Matrix Tests (Mediator.Tests) ==="
#!/usr/bin/env sh
set -eu
for framework in {{frameworks}}; do \
for lifetime in {{lifetimes}}; do \
for publisher in {{publishers}}; do \
for size in {{sizes}}; do \
for cachingMode in {{cachingModes}}; do \
just _test-config "$framework" "$lifetime" "$publisher" "$size" "$cachingMode"; \
done; \
done; \
done; \
done; \
done
# Test matrix combinations for telemetry runtime tests (net10.0 only)
test-telemetry-matrix:
@echo "=== Running Matrix Tests (Mediator.Telemetry.Tests) ==="
#!/usr/bin/env sh
set -eu
for framework in {{frameworks}}; do \
for lifetime in {{lifetimes}}; do \
for publisher in {{publishers}}; do \
for cachingMode in {{cachingModes}}; do \
for metrics in {{telemetryMetrics}}; do \
for tracing in {{telemetryTracing}}; do \
just _test-telemetry-config "$framework" "$lifetime" "$publisher" "$cachingMode" "$metrics" "$tracing"; \
done; \
done; \
done; \
done; \
done; \
done
# Run both runtime matrix suites back-to-back
test-full-matrix:
@echo "=== Running Full Matrix (Mediator.Tests + Mediator.Telemetry.Tests) ==="
just test-matrix
just test-telemetry-matrix
# Helper recipe for individual configuration testing
_test-config framework lifetime publisher size cachingMode:
@echo "Testing {{framework}} - {{lifetime}}/{{publisher}}/{{size}}/{{cachingMode}}"
dotnet clean -v q ./test/Mediator.Tests/
dotnet build --no-restore -f {{framework}} -p:ExtraDefineConstants=\"Mediator_Lifetime_{{lifetime}}%3BMediator_Publisher_{{publisher}}%3BMediator_{{size}}_Project%3BMediator_CachingMode_{{cachingMode}}\" -v q ./test/Mediator.Tests/
dotnet test --no-restore --no-build -f {{framework}} ./test/Mediator.Tests/
# Helper recipe for telemetry runtime test configuration
_test-telemetry-config framework lifetime publisher cachingMode metrics tracing:
#!/usr/bin/env sh
set -eu
echo "Testing {{framework}} - {{lifetime}}/{{publisher}}/{{cachingMode}}/Metrics={{metrics}}/Tracing={{tracing}}"
DEFINES="Mediator_Lifetime_{{lifetime}}%3BMediator_Publisher_{{publisher}}%3BMediator_CachingMode_{{cachingMode}}"
if [ "{{metrics}}" = "On" ]; then \
DEFINES="${DEFINES}%3BMediator_Telemetry_EnableMetrics%3BMediator_Telemetry_MeterName_Tests"; \
fi
if [ "{{tracing}}" = "On" ]; then \
DEFINES="${DEFINES}%3BMediator_Telemetry_EnableTracing%3BMediator_Telemetry_ActivitySourceName_Tests"; \
fi
dotnet clean -v q ./test/Mediator.Telemetry.Tests/
dotnet build --no-restore -f {{framework}} -p:ExtraDefineConstants=\"${DEFINES}\" -v q ./test/Mediator.Telemetry.Tests/
dotnet test --no-restore --no-build -f {{framework}} ./test/Mediator.Telemetry.Tests/
# Convenience recipes
# Test a specific framework with all matrix combinations
test-framework framework="net10.0":
@echo "=== Testing framework {{framework}} with all matrix combinations ==="
#!/usr/bin/env sh
set -eu
for lifetime in {{lifetimes}}; do \
for publisher in {{publishers}}; do \
for size in {{sizes}}; do \
for cachingMode in {{cachingModes}}; do \
just _test-config "{{framework}}" "$lifetime" "$publisher" "$size" "$cachingMode"; \
done; \
done; \
done; \
done
# Test a specific lifetime across all frameworks
test-lifetime lifetime="Singleton":
@echo "=== Testing lifetime {{lifetime}} across all frameworks ==="
#!/usr/bin/env sh
set -eu
for framework in {{frameworks}}; do \
for publisher in {{publishers}}; do \
for size in {{sizes}}; do \
for cachingMode in {{cachingModes}}; do \
just _test-config "$framework" "{{lifetime}}" "$publisher" "$size" "$cachingMode"; \
done; \
done; \
done; \
done
# Test a specific publisher across all frameworks
test-publisher publisher="ForeachAwait":
@echo "=== Testing publisher {{publisher}} across all frameworks ==="
#!/usr/bin/env sh
set -eu
for framework in {{frameworks}}; do \
for lifetime in {{lifetimes}}; do \
for size in {{sizes}}; do \
for cachingMode in {{cachingModes}}; do \
just _test-config "$framework" "$lifetime" "{{publisher}}" "$size" "$cachingMode"; \
done; \
done; \
done; \
done
# Test a specific configuration
test-config framework lifetime publisher size cachingMode:
@echo "=== Testing specific configuration ==="
just _test-config {{framework}} {{lifetime}} {{publisher}} {{size}} {{cachingMode}}