Skip to content

Commit 4b9e445

Browse files
author
cleilson pereira
committed
feat: Add performance analysis workflow for .NET builds in GitHub Actions
1 parent 7c32d34 commit 4b9e445

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Build e Performance Analysis
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
analyze-build:
11+
runs-on: ubuntu-24.04
12+
timeout-minutes: 90
13+
env:
14+
DOTNET_TieredPGO: 0
15+
DOTNET_HOTLOOPCOUNT: 0
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Cache NuGet global-packages
21+
uses: actions/cache@v4
22+
with:
23+
path: ~/.nuget/packages
24+
key: nuget-cache-${{ hashFiles('**/*.csproj','**/*.sln') }}
25+
restore-keys: nuget-cache-
26+
27+
- name: Setup .NET 8 SDK
28+
uses: actions/setup-dotnet@v4
29+
with:
30+
dotnet-version: '8.0.x'
31+
32+
- name: Setup .NET 6 runtime (para ferramentas compatíveis)
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
dotnet-version: '6.0.x'
36+
package-type: runtime
37+
38+
- name: Restore dependencies
39+
run: dotnet restore HEZKCredentialLib.sln
40+
41+
- name: Create artifacts directory
42+
run: mkdir -p artifacts
43+
44+
- name: Build com análise de performance + segurança
45+
id: msbuild
46+
run: |
47+
dotnet msbuild HEZKCredentialLib.sln \
48+
/t:Rebuild /p:Configuration=Release \
49+
/maxcpucount /graphBuild:true /nodeReuse:false /noAutoResponse \
50+
/consoleLoggerParameters:"PerformanceSummary;ShowCommandLine" \
51+
/detailedSummary /bl:artifacts/build-${{ github.run_id }}.binlog \
52+
/profileEvaluation:artifacts/profile-eval.md \
53+
/warnAsError \
54+
/p:RunCodeAnalysis=true \
55+
/p:TreatWarningsAsErrors=true \
56+
/p:EnableNETAnalyzers=true \
57+
/p:AnalysisMode=AllEnabledByDefault \
58+
/p:AnalysisLevel=8.0
59+
continue-on-error: true
60+
61+
- name: Install Binlogtool (global tool)
62+
run: dotnet tool install --global binlogtool --version 1.0.27
63+
continue-on-error: true
64+
65+
- name: Install Meziantou.MSBuild.Tools (global tool)
66+
run: dotnet tool install --global Meziantou.MSBuild.Tools
67+
continue-on-error: true
68+
69+
- name: Add dotnet tools to PATH
70+
run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
71+
72+
- name: Detect Double‑Writes in binlog
73+
run: |
74+
Meziantou.MSBuild.Tools detect-double-writes --path artifacts/build-${{ github.run_id }}.binlog
75+
continue-on-error: true
76+
77+
- name: Analyze binlog for tasks and warnings (JSON report)
78+
run: |
79+
binlogtool analyze artifacts/build-${{ github.run_id }}.binlog --format json > artifacts/binlog-report.json
80+
continue-on-error: true
81+
82+
- name: Upload artifacts (logs, binlog, reports)
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: build-artifacts
86+
path: artifacts/
87+
88+
- name: Summary Log
89+
run: |
90+
echo "Artifacts disponíveis: build.binlog, profile-eval.md, binlog-report.json."
91+
echo "Use o MSBuild Structured Log Viewer local para inspeção detalhada."

0 commit comments

Comments
 (0)