Repository navigation
146 lines (119 loc) · 5.6 KB
/
Copy pathci.yml
File metadata and controls
146 lines (119 loc) · 5.6 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
name: CI
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
workflow_dispatch:
env:
DOTNET_VERSION: '10.0.x'
permissions:
contents: read
jobs:
performance:
name: Isolated concurrency comparison
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 30
env:
BASELINE_REF: '705b47da12e41fa22aebc3049819c9efd2b605f8'
TEST_PROJECT: 'ManagedCode.Orleans.RateLimiting.Tests/ManagedCode.Orleans.RateLimiting.Tests.csproj'
RATE_LIMIT_PERFORMANCE_ALGORITHM: 'concurrency'
RATE_LIMIT_PERFORMANCE_WARM_WORKLOAD: 'true'
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v6.0.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Prepare identical baseline harness
run: |
baseline_dir="$RUNNER_TEMP/rate-baseline"
mkdir -p "$baseline_dir"
git archive "$BASELINE_REF" | tar -x -C "$baseline_dir"
cp -R ManagedCode.Orleans.RateLimiting.Tests/Performance "$baseline_dir/ManagedCode.Orleans.RateLimiting.Tests/Performance"
printf 'Baseline: %s; updated: %s. All samples run serially on this runner.\n' "$BASELINE_REF" "$GITHUB_SHA" >> "$GITHUB_STEP_SUMMARY"
- name: Build baseline
working-directory: ${{ runner.temp }}/rate-baseline
run: dotnet build "$TEST_PROJECT" -c Release -p:RunPerformanceTests=true
- name: Build updated
run: dotnet build "$TEST_PROJECT" -c Release -p:RunPerformanceTests=true
- name: Compare warmed workloads in ABBA order
run: |
sample=0
for version in baseline updated updated baseline; do
source_dir="$GITHUB_WORKSPACE"
if [ "$version" = baseline ]; then source_dir="$RUNNER_TEMP/rate-baseline"; fi
for caller_token in false true; do
export RATE_LIMIT_PERFORMANCE_CALLER_TOKEN="$caller_token"
export RATE_LIMIT_PERFORMANCE_OUTPUT="$GITHUB_WORKSPACE/artifacts/performance/$sample-$version-$caller_token.json"
dotnet test --project "$source_dir/$TEST_PROJECT" -c Release --no-build -p:RunPerformanceTests=true --treenode-filter '/*/*/PerformanceBenchmarkTests/*'
done
sample=$((sample + 1))
done
- name: Summarize paired measurements
run: python3 scripts/summarize-performance.py artifacts/performance >> "$GITHUB_STEP_SUMMARY"
- name: Upload every measurement
if: always()
uses: actions/upload-artifact@v7.0.1
with:
name: performance-comparison
path: artifacts/performance/**
retention-days: 30
build-and-test:
name: Build, Test, and Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Setup .NET
uses: actions/setup-dotnet@v6.0.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore local tools
run: dotnet tool restore
- name: Restore
run: dotnet restore ManagedCode.Orleans.RateLimiting.sln
- name: Build
run: dotnet build ManagedCode.Orleans.RateLimiting.sln --configuration Release --no-restore
- name: Analyze
run: dotnet build ManagedCode.Orleans.RateLimiting.sln --configuration Release --no-restore -p:RunAnalyzers=true
- name: Validate package compatibility
run: dotnet pack ManagedCode.Orleans.RateLimiting.sln --configuration Release --no-build
- name: Verify formatting
run: dotnet format ManagedCode.Orleans.RateLimiting.sln --verify-no-changes
- name: Test
run: dotnet test --solution ManagedCode.Orleans.RateLimiting.sln --configuration Release --no-build --verbosity normal --report-trx --results-directory ./artifacts/test-results
- name: Map deterministic coverage source paths
run: |
mkdir -p artifacts/coverage
printf '|%s/=/_/\n' "$GITHUB_WORKSPACE" > artifacts/coverage/SourceRootsMapping.txt
- name: Collect coverage
run: dotnet tool run coverlet ManagedCode.Orleans.RateLimiting.Tests/bin/Release/net10.0/ManagedCode.Orleans.RateLimiting.Tests.dll --target "dotnet" --targetargs "test --project ManagedCode.Orleans.RateLimiting.Tests/ManagedCode.Orleans.RateLimiting.Tests.csproj --configuration Release --no-build --no-restore" --source-mapping-file artifacts/coverage/SourceRootsMapping.txt --format cobertura --output artifacts/coverage/coverage.cobertura.xml --exclude "[ManagedCode.Orleans.RateLimiting.Tests]*" --threshold 85 --threshold-type line --threshold-stat total
- name: Render coverage report
run: dotnet tool run reportgenerator -reports:"artifacts/coverage/coverage.cobertura.xml" -targetdir:"artifacts/coverage-report" -reporttypes:"HtmlSummary;MarkdownSummaryGithub"
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v7.0.1
with:
name: test-results
path: ./artifacts/test-results/**
retention-days: 5
- name: Upload coverage artifacts
if: always()
uses: actions/upload-artifact@v7.0.1
with:
name: coverage-report
path: |
./artifacts/coverage/**
./artifacts/coverage-report/**
retention-days: 5
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./artifacts/coverage/coverage.cobertura.xml
fail_ci_if_error: false