-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathazure-steps-nix.yml
More file actions
203 lines (178 loc) · 9.22 KB
/
azure-steps-nix.yml
File metadata and controls
203 lines (178 loc) · 9.22 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
# AGENT_OS=Linux|Darwin|Windows_NT
# condition: eq(variables['Agent.OS'], 'Linux|Darwin|Windows_NT')
steps:
- pwsh: |
Install-Module Platform-Info -Force
Write-Host "CPU: $(Get-Cpu-Name)"
Write-Host "Platform: $(Get-Os-Platform)"
Write-Host "Memory $((Get-Memory-Info).Description)"
Get-Childitem -path env:
Write-Host "PATH = [$($ENV:PATH)]"
displayName: 'Bootstrap pwsh'
- bash: |
export DOTNET_VERSIONS="3.1 5.0 6.0 7.0"
script=https://raw.githubusercontent.com/devizer/test-and-build/master/lab/install-DOTNET.sh; (wget -q -nv --no-check-certificate -O - $script 2>/dev/null || curl -ksSL $script) | bash; test -s /usr/share/dotnet/dotnet && sudo ln -f -s /usr/share/dotnet/dotnet /usr/local/bin/dotnet; test -s /usr/local/share/dotnet/dotnet && sudo ln -f -s /usr/local/share/dotnet/dotnet /usr/local/bin/dotnet;
dotnet --info
exit 0
condition: ne(variables.SKIP_SDK_INSTALL, 'True')
displayName: 'Install dotnet sdk'
- powershell: |
$ErrorActionPreference = "SilentlyContinue"
& uname -a
& dotnet --info
& mono --version
& nvm --version
& node --version
& npm --version
& yarn --version
"PATH: [" + [Environment]::GetEnvironmentVariable("PATH") + "]"
& bash -c "Say ENVIRONMENT; printenv | sort";
$true
exit 0;
failOnStderr: false
condition: ne(variables.QEMU, 'True')
displayName: 'system info (pwsh)'
- script: |
uname -a
if [[ -s /etc/debian_version ]]; then
. /etc/os-release
Say "OS: $PRETTY_NAME v$(cat /etc/debian_version)"
fi;
dotnet --info
Say "mono: $(mono --version)"
Say "nvm: $(nvm --version)"
Say "node: $(node --version)"
Say "npm: $(npm --version)"
Say "yarn: $(yarn --version)"
echo "PATH: [$PATH]"
Say "/etc/environment"
cat /etc/environment
Say "env"
printenv | sort
Say "git config"
git config -l
condition: eq(variables['OS'], 'Linux')
displayName: 'system info (bash)'
- script: |
time list-packages
condition: and(eq(variables['OS'], 'Linux'), ne(variables.QEMU, 'True'))
displayName: 'List Packages'
- bash: |
set -eu; set -o pipefail;
url=https://raw.githubusercontent.com/devizer/glist/master/install-libssl-1.1.sh; (wget -q -nv --no-check-certificate -O - $url 2>/dev/null || curl -ksSL $url) | bash
condition: eq(variables['Agent.OS'], 'Linux')
displayName: 'SSL (optional)'
- script: |
# export VSS_NUGET_EXTERNAL_FEED_ENDPOINTS='{"endpointCredentials": [{"endpoint":"https://devizer.pkgs.visualstudio.com/_packaging/devizer.nuget/nuget/v3/index.json", "username":"optional", "password":"'$MY_AZ_APIKEY'"}]}'
# echo "VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: [$VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]"
# echo "##vso[task.setvariable variable=VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]VSS_NUGET_EXTERNAL_FEED_ENDPOINTS"
dotnet restore || dotnet restore --disable-parallel
condition: eq(variables['Agent.OS'], 'Windows_NT')
displayName: '[win] restore'
env:
MY_AZ_APIKEY: $(AZ_API_KEY)
- script: |
set
echo "CoverletOutput=[$(Build.SourcesDirectory)/coverage/]"
export VSS_NUGET_EXTERNAL_FEED_ENDPOINTS='{"endpointCredentials": [{"endpoint":"https://devizer.pkgs.visualstudio.com/_packaging/devizer.nuget/nuget/v3/index.json", "username":"optional", "password":"'$MY_AZ_APIKEY'"}]}'
rem dotnet test --no-restore --logger trx -f netcoreapp2.2 -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$(Build.SourcesDirectory)/coverage/
REM dotnet test --no-restore --logger trx -f netcoreapp3.1 -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$(Build.SourcesDirectory)/coverage/ --collect:"XPlat Code Coverage"
REM if Exist %SystemRoot%\System32\xtajit.dll (
REM c:\x\git\usr\bin\bash -c "export PROCESSOR_ARCHITECTURE=ARM64; echo Workaround PROCESSOR_ARCHITECTURE=$PROCESSOR_ARCHITECTURE; dotnet test -f net5.0 -c Release"
REM ) else (
REM rem dotnet test --collect:"XPlat Code Coverage" --logger trx -f netcoreapp3.1 -c Release
REM dotnet test -f net5.0 -c Release
REM )
dotnet test --collect:"XPlat Code Coverage" --logger trx -f net5.0 -c Release
condition: eq(variables['Agent.OS'], 'Windows_NT')
displayName: '[win] test'
env:
MY_AZ_APIKEY: $(AZ_API_KEY)
- script: |
# export VSS_NUGET_EXTERNAL_FEED_ENDPOINTS='{"endpointCredentials": [{"endpoint":"https://devizer.pkgs.visualstudio.com/_packaging/devizer.nuget/nuget/v3/index.json", "username":"optional", "password":"'$MY_AZ_APIKEY'"}]}'
# echo "VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: [$VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]"
# echo "##vso[task.setvariable variable=VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]VSS_NUGET_EXTERNAL_FEED_ENDPOINTS"
dotnet --info
dotnet restore || (Say "Fallback to singlethreaded restore"; dotnet restore --disable-parallel) || true
condition: and(ne(variables['Agent.OS'], 'Windows_NT'), ne(variables.QEMU, 'True'))
displayName: '[nix] restore'
env:
MY_AZ_APIKEY: $(AZ_API_KEY)
- script: |
set -e
cd Universe.CpuUsage.Tests
# msbuild Universe.CpuUsage.Tests.csproj /p:TargetFramework=net46;Configuration=Release
msbuild Universe.CpuUsage.Tests.csproj /p:TargetFramework=net46 /p:Configuration=Release
condition: eq(variables['Agent.JobName'], 'Ubuntu_20_04')
displayName: 'BinTests: Build'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.Repository.LocalPath)/Universe.CpuUsage.Tests/bin/Release/net46'
artifactName: 'BinTests'
condition: eq(variables['Agent.JobName'], 'Ubuntu_20_04')
displayName: 'BinTests: Publish'
- script: |
set -eu
time dotnet test --collect:"XPlat Code Coverage" --logger trx -f net5.0 -c Release
condition: ne(variables['Agent.OS'], 'Windows_NT')
displayName: '[nix] test'
env:
MY_AZ_APIKEY: $(AZ_API_KEY)
- script: |
printenv | sort
script=https://raw.githubusercontent.com/devizer/test-and-build/master/install-build-tools-bundle.sh; (wget -q -nv --no-check-certificate -O - $script 2>/dev/null || curl -ksSL $script) | bash
Show-System-Stat || true
echo ""
condition: ne(variables['Agent.OS'], 'Windows_NT')
displayName: 'System Stat'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
testRunTitle: 'All the tests for $(Agent.JobName)'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: cobertura
failIfCoverageEmpty: false # Optional
summaryFileLocation: '**/In/**/coverage.cobertura.xml'
#pathToSources: # Optional
#reportDirectory: # Optional
#additionalCodeCoverageFiles: # Optional
- powershell: |
$currentVersion=Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
$win_10_release_id = $currentVersion.ReleaseId; if (! $win_10_release_id) { $win_10_release_id = $currentVersion.CurrentBuildNumber }
$win_name = $(Get-WMIObject win32_operatingsystem -EA SilentlyContinue).Caption
echo "$($win_name): Release [$win_10_release_id], powershell [$($PSVersionTable.PSVersion)]" | tee "System Info.log"
$cpu=Get-WmiObject Win32_Processor;
echo "CPU: $($cpu.Name), $([System.Environment]::ProcessorCount) Cores" | tee "System Info.log" -Append
# get-wmiobject win32_product |
# sort -Property Vendor, Name, Version |
# ft Version, Name, Vendor, InstallState, IdentifyingNumber -AutoSize |
# Out-File -Width 512 "Preintalled Software.log"
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/devizer/Universe.SqlServerJam/master/SqlServer-Version-Management/Install-SqlServer-Version-Management.ps1'))
Get-Speedy-Software-Product-List |
sort -Property Vendor, Name, Version, Origin |
ft IdentifyingNumber, Vendor, Name, Version, Origin -AutoSize |
Out-File -Width 2048 "Preintalled Software.log"
# $true
condition: eq(variables['OS'], 'Windows')
displayName: 'About Windows'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.Repository.LocalPath)'
artifactName: '$(Agent.JobName)-$(Build.BuildNumber)'
displayName: 'publish working folder'
- bash: |
pushd Universe.CpuUsage/bin/Release
ls -la Universe.CpuUsage.1.42.0.nupkg
echo 'iex "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) }"' | pwsh
# https://github.com/Microsoft/artifacts-credprovider/blob/master/README.md#environment-variables
export VSS_NUGET_EXTERNAL_FEED_ENDPOINTS='{"endpointCredentials": [{"endpoint":"https://devizer.pkgs.visualstudio.com/_packaging/devizer.nuget/nuget/v3/index.json", "username":"optional", "password":"'$MY_AZ_APIKEY'"}]}'
Say "VSS_NUGET_EXTERNAL_FEED_ENDPOINTS" ${VSS_NUGET_EXTERNAL_FEED_ENDPOINTS}"
dotnet nuget push --source "devizer.nuget" --api-key az Universe.CpuUsage.*.nupkg
popd
displayName: 'push local nuget'
condition: eq(variables.when, 'Never')
env:
MY_AZ_APIKEY: $(AZ_APIKEY)