-
Notifications
You must be signed in to change notification settings - Fork 11
/
build-test-nightly.yml
181 lines (162 loc) · 7.68 KB
/
build-test-nightly.yml
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
# https://aka.ms/yaml
trigger:
branches:
include:
- release/*
variables:
- group: s3PushInstallers
- group: pipeline-tokens
- name: configuration
value: Release
pool: 'rhino-compute'
steps:
- powershell: |
Get-ChildItem *.msi -Recurse | Remove-Item
aws s3 cp s3://oasys-installer-store/GSA/nightly . --exclude "*" --include *Arup*.msi --recursive
Get-ChildItem *.msi | Rename-Item -NewName gsa.msi
displayName: 'Download GSA nightly'
failOnStderr: true
- powershell: |
$installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi)
Write-output "Installer Path: ${installerPath}"
Write-output "GSA Version:"
if (!(Test-Path $installerPath.FullName)) {
Write-output "File '{0}' does not exist" -f $installerPath.FullName
}
try {
$WindowsInstaller = New-Object -com WindowsInstaller.Installer
$Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($installerPath.FullName, 0))
$Query = "SELECT Value FROM Property WHERE Property = 'ProductVersion'"
$View = $database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query))
$View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) | Out-Null
$Record = $View.GetType().InvokeMember( "Fetch", "InvokeMethod", $Null, $View, $Null )
$Version = $Record.GetType().InvokeMember( "StringData", "GetProperty", $Null, $Record, 1 )
Write-output $Version
} catch {
Write-output "Failed to get MSI file version: {0}." -f $_
}
$app = Start-Process ${installerPath} -ArgumentList '/passive /quiet /l* msiLog.txt' -PassThru -Wait
$app.WaitForExit()
Write-Output "Exit code: $($app.ExitCode)"
Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC"
if ($app.ExitCode -ne 0) {
Write-Error "Application could not be installed. Error code $($app.ExitCode)"
exit(1)
}
displayName: 'Install GSA'
failOnStderr: true
- powershell: |
& 'C:\Program Files\Oasys\*\GSA.exe' /Register
displayName: 'Register GSA COM'
failOnStderr: false
- powershell: |
./cleanRegistry.ps1
displayName: 'Run Registry Cleaner'
failOnStderr: true
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
displayName: 'Restoring NuGet packages'
inputs:
command: 'restore'
restoreSolution: 'GsaGH.sln'
- task: VSBuild@1
displayName: 'Building project in $(configuration)'
inputs:
solution: 'GsaGH.sln'
msbuildArgs: '/p:AppxBundlePlatforms="x64" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /m /nr:false /p:TreatWarningsAsErrors="true"'
platform: 'x64'
configuration: '$(configuration)'
clean: true
env:
MSBUILDDISABLENODEREUSE: 1
- powershell: |
dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\gsagh .\GsaGHTests\bin\x64\Release\net48\GsaGHTests.dll
dotnet test --collect:"XPlat Code Coverage" /TestAdapterPath:$env:UserProfile\.nuget\packages\coverlet.collector\6.0.2\build --results-directory .\results\integration .\IntegrationTests\bin\x64\Release\net48\IntegrationTests.dll
displayName: dotnet tests
failOnStderr: true
- powershell: |
if (200 -ne (Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post | Select-Object StatusCode).StatusCode) {
Write-Output "codecov.yml is invalid"
Invoke-WebRequest -Uri https://codecov.io/validate -Body (Get-Content -Raw -LiteralPath .\codecov.yml) -Method post
exit(1)
} else {
Write-Output "codecov.yml is valid"
}
displayName: Validate codecov.yml
failOnStderr: true
- powershell: |
$coverage_file_gsagh = (Resolve-Path $(System.DefaultWorkingDirectory)/results/gsagh/*/coverage.cobertura.xml).Path
echo $coverage_file_gsagh
$coverage_file_integration = (Resolve-Path $(System.DefaultWorkingDirectory)/results/integration/*/coverage.cobertura.xml).Path
echo $coverage_file_integration
Copy-Item $coverage_file_gsagh $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml
Copy-Item $coverage_file_integration $(System.DefaultWorkingDirectory)\results\coverage_integration.xml
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
ls $(System.DefaultWorkingDirectory)\
cd $(System.DefaultWorkingDirectory)\
.\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_gsagh.xml -F gsagh
.\codecov -t $env:CODECOV_TOKEN --dir $(System.DefaultWorkingDirectory)\results --file coverage_integration.xml -F integration
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)
displayName: Upload Code Coverage to codecovio
failOnStderr: true
- publish: $(System.DefaultWorkingDirectory)\results\coverage_gsagh.xml
displayName: Publish GsaGHTest xml to Azure
artifact: GsaGHTestsCoverage
continueOnError: true
- publish: $(System.DefaultWorkingDirectory)\results\coverage_integration.xml
displayName: Publish IntegrationTest xml to Azure
artifact: IntegrationTestsCoverage
continueOnError: true
- powershell: |
cd GsaGH\bin\x64\Release
curl https://files.mcneel.com/yak/tools/latest/yak.exe -o yak.exe
.\yak version
cd net48
..\yak spec
Add-Content manifest.yml 'icon: GsaIcon.png'
Add-Content manifest.yml 'keywords:'
Add-Content manifest.yml '- oasys'
Add-Content manifest.yml '- gsa'
Add-Content manifest.yml '- gsagh'
Add-Content manifest.yml '- fe'
Add-Content manifest.yml '- fea'
Add-Content manifest.yml '- fem'
Add-Content manifest.yml '- structural'
Add-Content manifest.yml '- structuralanalysis'
..\yak build --platform win
$yakCurrentVersName = Get-ChildItem -Path . -Filter "*.yak"
$yakRh7Name = $yakCurrentVersName -Replace "rh6_27", "rh7_0"
Rename-Item -Path $yakCurrentVersName -NewName $yakRh7Name
..\yak build --platform win
New-Item -ItemType Directory -Path $(System.DefaultWorkingDirectory)\results\yak
Copy-Item $yakCurrentVersName $(System.DefaultWorkingDirectory)\results\yak\$yakCurrentVersName
Copy-Item $yakRh7Name $(System.DefaultWorkingDirectory)\results\yak\$yakRh7Name
displayName: Package yak
- publish: $(System.DefaultWorkingDirectory)\results\yak\
displayName: Publish Yak Package to Azure
artifact: Yak Package
continueOnError: false
- powershell: Remove-Item -Path C:\Users\**\AppData\Roaming\Grasshopper\Libraries\*.ghlink
displayName: 'Delete orphan .ghlink files'
condition: always()
- powershell: |
$installerPath = $(ls -r $(Pipeline.Workspace)\gsa.msi)
Write-output "Installer Path: ${installerPath}"
$app = Start-Process "msiexec.exe" -ArgumentList "/x ${installerPath} /quiet /passive /norestart /l* msiUninstallLog.txt" -PassThru -Wait
$app.WaitForExit()
Write-Output "Exit code: $($app.ExitCode)"
Write-Output "Exit time: $($app.ExitTime.ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss')) UTC"
### Success error codes: 0 = ERROR_SUCCESS, 1641 = ERROR_SUCCESS_REBOOT_INITIATED, 3010 = ERROR_SUCCESS_REBOOT_REQUIRED
### See https://docs.microsoft.com/en-us/windows/win32/msi/error-codes
if (($app.ExitCode -eq 0) -or ($app.ExitCode -eq 1641) -or ($app.ExitCode -eq 3010)) {
Write-Output "Application successfully uninstalled with exit code $($app.ExitCode)"
rm $installerPath
exit(0)
} else {
Write-Error "Application could not be uninstalled. Error code $($app.ExitCode)"
exit(1)
}
condition: always()
displayName: 'Uninstall Application'