-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (93 loc) · 4.02 KB
/
pr-build.yml
File metadata and controls
119 lines (93 loc) · 4.02 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
name: PR Build & Test
on:
pull_request:
branches: [main]
push:
branches: [main]
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
name: Build & Test
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
dotnet-quality: 'preview'
# .NET Framework 4.8 is pre-installed on windows-latest
- name: Restore dependencies
run: dotnet restore
- name: Build Core Library
run: dotnet build src/SVNPathCopy.Core/SVNPathCopy.Core.csproj --configuration Release --no-restore
- name: Build Shell Extension (.NET Framework 4.8)
run: dotnet build src/SVNPathCopy.ShellExtension/SVNPathCopy.ShellExtension.csproj --configuration Release --no-restore
- name: Build Configuration App
run: dotnet build src/SVNPathCopy.Configuration/SVNPathCopy.Configuration.csproj --configuration Release --no-restore
- name: Build Tests
run: dotnet build tests/SVNPathCopy.Tests/SVNPathCopy.Tests.csproj --configuration Release --no-restore
- name: Run Tests with Coverage
run: dotnet test tests/SVNPathCopy.Tests/SVNPathCopy.Tests.csproj --configuration Release --no-build --verbosity normal --results-directory tests/SVNPathCopy.Tests/TestResults --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage"
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: test-results
path: tests/SVNPathCopy.Tests/TestResults/*.trx
- name: DeepSource Code Coverage
if: success() && env.DEEPSOURCE_DSN != ''
shell: pwsh
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
run: |
# Install DeepSource CLI (drops ./bin/deepsource.exe on Windows)
curl https://deepsource.io/cli | sh
$coverageRoot = "tests/SVNPathCopy.Tests/TestResults"
if (-not (Test-Path $coverageRoot)) {
throw "Coverage results directory not found: $coverageRoot"
}
# dotnet test --collect:"XPlat Code Coverage" produces Cobertura at coverage.cobertura.xml
$coverageFiles = Get-ChildItem -Path $coverageRoot -Recurse -File -Filter "coverage.cobertura.xml"
if (-not $coverageFiles -or $coverageFiles.Count -eq 0) {
Write-Host "No coverage.cobertura.xml found under $coverageRoot. Directory contents:";
Get-ChildItem -Path $coverageRoot -Recurse | Select-Object FullName | Format-Table -AutoSize | Out-String | Write-Host
throw "No coverage files found."
}
foreach ($file in $coverageFiles) {
Write-Host "Reporting coverage: $($file.FullName)"
./bin/deepsource.exe report --analyzer test-coverage --key csharp --value-file "$($file.FullName)"
}
build-installer:
name: Build Installer
runs-on: windows-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Install WiX Toolset
run: dotnet tool restore
- name: Add WiX extensions
run: |
dotnet wix extension add WixToolset.UI.wixext/6.0.2
dotnet wix extension add WixToolset.Util.wixext/6.0.2
- name: Restore dependencies
run: dotnet restore
- name: Build Solution (Release)
run: dotnet build --configuration Release
- name: Build Installer
run: dotnet build src/SVNPathCopy.Installer/SVNPathCopy.Installer.wixproj --configuration Release --no-restore
- name: Upload MSI artifact
uses: actions/upload-artifact@v7
with:
name: SVNPathCopy-Installer
path: src/SVNPathCopy.Installer/bin/x64/Release/*.msi