-
Notifications
You must be signed in to change notification settings - Fork 51
275 lines (221 loc) · 10.3 KB
/
Copy pathInstallRunAndArtifact.yml
File metadata and controls
275 lines (221 loc) · 10.3 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: Install and Run
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
DOTNET_VERSION: 8.0.204
DOTNET_FRAMEWORK: net8.0
jobs:
install:
name: Create Installer Artifact
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Restore dependencies
run: dotnet restore ./MetaMorpheus/MetaMorpheus.sln
- name: Build solution
run: dotnet msbuild -v:minimal -p:Configuration=Release -p:UseSharedCompilation=false ./MetaMorpheus/
- name: Build installer
run: |
msbuild ./MetaMorpheus/MetaMorpheusSetup/MetaMorpheusSetup.wixproj /p:Configuration=Release /verbosity=minimal /p:UseSharedCompilation=false
msbuild ./MetaMorpheus/Bootstrapper/Bootstrapper.wixproj /p:Configuration=Release /p:UseSharedCompilation=false
- name: Verify installer exists
run: |
if (!(Test-Path "./MetaMorpheus/MetaMorpheusSetup/bin/Release/MetaMorpheusInstaller.msi")) {
Write-Host "❌ Installer build failed: MetaMorpheusInstaller.msi not found." -ForegroundColor Red
exit 1
}
- name: Zip command-line version
run: |
7z a MetaMorpheus_CommandLine.zip .\MetaMorpheus\CMD\bin\Release\$env:DOTNET_FRAMEWORK\* "-x!*.xml"
# check that installer is greater than 1 kb to avoid pushing an empty artifact
- name: Validate command-line zip artifact
run: |
if ((Get-Item MetaMorpheus_CommandLine.zip).length -lt 1kb) {
Write-Host "❌ The build failed because the command-line .zip did not build properly; it is empty." -ForegroundColor Red
exit 1
}
- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: MetaMorpheusInstaller
path: ./MetaMorpheus/MetaMorpheusSetup/bin/Release/MetaMorpheusInstaller.msi
- name: Upload command-line zip artifact
uses: actions/upload-artifact@v4
with:
name: MetaMorpheus_CommandLine
path: MetaMorpheus_CommandLine.zip
test_installer:
name: Search with Installed
runs-on: windows-latest
needs: install
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Download installer artifact
uses: actions/download-artifact@v4
with:
name: MetaMorpheusInstaller
- name: Install MetaMorpheus MSI
run: |
Start-Process -FilePath msiexec.exe -ArgumentList "/i `"$(Get-Location)\MetaMorpheusInstaller.msi`" /qn /l*v install.log" -Wait
- name: Display workspace directory tree
run: |
function Show-Tree ($path, $indent = "") {
Get-ChildItem -LiteralPath $path | ForEach-Object {
Write-Host "$indent|- $($_.Name)"
if ($_.PSIsContainer) {
Show-Tree -path $_.FullName -indent ("$indent ")
}
}
}
$workspace = Get-Location
Write-Host "Workspace directory tree for: $workspace"
Show-Tree $workspace
- name: Microvinette with installed CMD.exe
run: |
$dataDir = "$(Get-Location)\MetaMorpheus\MetaMorpheus\Test\TestData"
& "C:\Program Files\MetaMorpheus\CMD.exe" --test -o "$dataDir\exe_output" -v minimal
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ CMD.exe search failed with exit code $LASTEXITCODE" -ForegroundColor Red
exit $LASTEXITCODE
}
- name: Generate Default TOMLs with installed CMD.dll
run: |
dotnet "C:\Program Files\MetaMorpheus\CMD.dll" -g -o "$(Get-Location)\MetaMorpheus\EngineLayer\Data"
- name: Run search with installed CMD.dll
run: |
$dataDir = "$(Get-Location)\MetaMorpheus\EngineLayer\Data"
dotnet "C:\Program Files\MetaMorpheus\CMD.dll" -s "$dataDir\SmallCalibratible_Yeast.mzML" -d "$dataDir\SmallYeast.fasta" -t "$dataDir\SearchTask.toml" -o "$dataDir\dll_output" -v minimal
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ CMD.dll search failed with exit code $LASTEXITCODE" -ForegroundColor Red
exit $LASTEXITCODE
}
test_build:
name: Search with Built
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore ./MetaMorpheus/MetaMorpheus.sln
- name: Build solution
run: dotnet msbuild -v:minimal -p:Configuration=Release -p:UseSharedCompilation=false ./MetaMorpheus/
- name: Generate Default TOMLs
run: |
dotnet "$(Get-Location)\MetaMorpheus\CMD\bin\Release\$env:DOTNET_FRAMEWORK\CMD.dll" -g -o "$(Get-Location)\MetaMorpheus\CMD\bin\Release\$env:DOTNET_FRAMEWORK\Data"
- name: Run search with built CMD.dll
run: |
$dataDir = "$(Get-Location)\MetaMorpheus\CMD\bin\Release\$env:DOTNET_FRAMEWORK\Data"
dotnet "$(Get-Location)\MetaMorpheus\CMD\bin\Release\$env:DOTNET_FRAMEWORK\CMD.dll" -s "$dataDir\SmallCalibratible_Yeast.mzML" -d "$dataDir\SmallYeast.fasta" -t "$dataDir\SearchTask.toml" -o "$dataDir\built_dll_output" -v minimal
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Built CMD.dll search failed with exit code $LASTEXITCODE" -ForegroundColor Red
exit $LASTEXITCODE
}
## Installs and builds. Verifies that the same dlls exist
validate_installer_contents:
name: Validate Installer Contents
runs-on: windows-latest
needs: install
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Download installer artifact
uses: actions/download-artifact@v4
with:
name: MetaMorpheusInstaller
- name: Install MetaMorpheus MSI
run: |
Start-Process -FilePath msiexec.exe -ArgumentList "/i `"$(Get-Location)\MetaMorpheusInstaller.msi`" /qn /l*v install.log" -Wait
- name: Restore dependencies
run: dotnet restore ./MetaMorpheus/MetaMorpheus.sln
- name: Build solution
run: dotnet msbuild -v:minimal -p:Configuration=Release -p:UseSharedCompilation=false ./MetaMorpheus/
- name: Compare built DLLs to installed DLLs
run: |
$buildDir = $repoDir = Get-Location
$installDir = "C:\Program Files\MetaMorpheus"
# Get DLL names
$buildDlls = Get-ChildItem -Path $buildDir -Filter *.dll | Select-Object -ExpandProperty Name
$installedDlls = Get-ChildItem -Path $installDir -Filter *.dll | Select-Object -ExpandProperty Name
# Define whitelist for missing DLLs (build-only) - Okay to not be installed
$whitelistedMissingDlls = @(
"System.Configuration.ConfigurationManager.dll",
"System.Security.Cryptography.ProtectedData.dll",
"System.Security.Permissions.dll",
"System.Windows.Extensions.dll",
"Microsoft.Win32.SystemEvents.dll",
"Microsoft.Extensions.DependencyInjection.Abstractions.dll",
"Microsoft.Extensions.DependencyInjection.dll",
"Microsoft.Extensions.Logging.Abstractions.dll",
"Microsoft.Extensions.Logging.dll",
"Microsoft.Extensions.Options.dll",
"Microsoft.Extensions.Primitives.dll"
)
# Define whitelist for extra DLLs (install-only)
$whitelistedExtraDlls = @(
)
# Get all unique DLLs in the entire build repository
# Define which folders to check in the repo
$foldersToCheck = @(
"$(Get-Location)\MetaMorpheus\EngineLayer\bin\Release\$env:DOTNET_FRAMEWORK",
"$(Get-Location)\MetaMorpheus\CMD\bin\Release\$env:DOTNET_FRAMEWORK",
"$(Get-Location)\MetaMorpheus\TaskLayer\bin\Release\$env:DOTNET_FRAMEWORK",
"$(Get-Location)\MetaMorpheus\GUI\bin\Release\$env:DOTNET_FRAMEWORK-windows",
"$(Get-Location)\MetaMorpheus\GuiFunctions\bin\Release\$env:DOTNET_FRAMEWORK"
)
# Collect DLLs and their source folders
$buildDlls = @()
$buildDllLocations = @{}
foreach ($folder in $foldersToCheck) {
if (Test-Path $folder) {
Get-ChildItem -Path $folder -Filter *.dll | ForEach-Object {
$dllName = $_.Name
$buildDlls += $dllName
$buildDllLocations[$dllName] = $folder
}
}
}
$buildDlls = $buildDlls | Sort-Object -Unique
# Get installed DLLs
$installedDlls = Get-ChildItem -Path $installDir -Filter *.dll | Select-Object -ExpandProperty Name -Unique
# Find missing DLLs (in build, not in install), ignoring whitelist
$missingDlls = $buildDlls | Where-Object { $_ -notin $installedDlls -and $_ -notin $whitelistedMissingDlls }
# Find extra DLLs (in install, not in build), ignoring whitelist
$extraDlls = $installedDlls | Where-Object { $_ -notin $buildDlls -and $_ -notin $whitelistedExtraDlls }
$hasError = $false
if ($missingDlls.Count -gt 0) {
Write-Host "❌ Missing DLLs from installer (not whitelisted):" -ForegroundColor Red
$missingDlls | ForEach-Object {
$sourceFolder = $buildDllLocations[$_]
Write-Host "- $_ (from $sourceFolder)"
}
$hasError = $true
}
if ($extraDlls.Count -gt 0) {
Write-Host "❌ Extra/unexpected DLLs in installer:" -ForegroundColor Red
$extraDlls | ForEach-Object { Write-Host "- $_" }
$hasError = $true
}
if ($hasError) {
exit 1
} else {
Write-Host "✅ Installer DLLs match build output exactly." -ForegroundColor Green
}