-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (138 loc) · 5.25 KB
/
ci.yml
File metadata and controls
168 lines (138 loc) · 5.25 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
checks: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DOTNET_VERSION: '9.0.x'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
name: Build and Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0 # Full history for better analysis
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props', '**/Directory.Build.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore ICTAce.FileHub.slnx
- name: Build solution
run: dotnet build ICTAce.FileHub.slnx --configuration Release --no-restore
- name: Verify analyzer enforcement
run: |
echo "Verifying code quality analyzers are enabled..."
echo "✓ SonarAnalyzer.CSharp"
echo "✓ Meziantou.Analyzer"
echo "✓ AsyncFixer"
echo "✓ Roslynator.Analyzers"
echo "Build completed with analyzer checks enforced"
test-server:
name: Server Unit Tests (TUnit)
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props', '**/Directory.Build.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore Server.Tests/ICTAce.FileHub.Server.Tests.csproj
- name: Build test project
run: dotnet build Server.Tests/ICTAce.FileHub.Server.Tests.csproj --configuration Release --no-restore
- name: Run server tests
run: dotnet test Server.Tests/ICTAce.FileHub.Server.Tests.csproj --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=server-test-results.trx"
continue-on-error: true
- name: Upload server test results
uses: actions/upload-artifact@v6
if: always()
with:
name: server-test-results
path: Server.Tests/TestResults/*.trx
retention-days: 30
test-client:
name: Client Component Tests (bUnit)
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props', '**/Directory.Build.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore Client.Tests/ICTAce.FileHub.Client.Tests.csproj
- name: Build test project
run: dotnet build Client.Tests/ICTAce.FileHub.Client.Tests.csproj --configuration Release --no-restore
- name: Run client component tests
run: dotnet test Client.Tests/ICTAce.FileHub.Client.Tests.csproj --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=client-test-results.trx"
continue-on-error: true
- name: Upload client test results
uses: actions/upload-artifact@v6
if: always()
with:
name: client-test-results
path: Client.Tests/TestResults/*.trx
retention-days: 30
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-server, test-client]
if: always()
steps:
- name: Check test results
run: |
echo "## Test Execution Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Server Unit Tests: ${{ needs.test-server.result }}" >> $GITHUB_STEP_SUMMARY
echo "✅ Client Component Tests: ${{ needs.test-client.result }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Code Quality Checks" >> $GITHUB_STEP_SUMMARY
echo "- ✓ SonarAnalyzer.CSharp" >> $GITHUB_STEP_SUMMARY
echo "- ✓ Meziantou.Analyzer" >> $GITHUB_STEP_SUMMARY
echo "- ✓ AsyncFixer" >> $GITHUB_STEP_SUMMARY
echo "- ✓ Roslynator.Analyzers" >> $GITHUB_STEP_SUMMARY
echo "- ✓ BannedApiAnalyzers" >> $GITHUB_STEP_SUMMARY
- name: Fail if any tests failed
if: needs.test-server.result == 'failure' || needs.test-client.result == 'failure'
run: |
echo "❌ One or more test jobs failed"
exit 1