[netcore] CI work, add rsp for Windows (#15549)
[mono-project.git] / scripts / ci / pipeline-netcore-runtime.yml
blobce2b21cb318c2d3ebd7a0e4f1bd2380d20bbe355
1 trigger:
2   batch: true
3   branches:
4     include:
5     - master
6     - 2019-??
7     - 202?-??
9 variables:
10 - ${{ if ne(variables['System.TeamProject'], 'public') }}:
11   - group: DotNet-VSTS-Bot
12   - group: DotNet-Blob-Feed
13 - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
14   # Variables used to publish packages to blob feed
15   - name: dotnetFeedUrl
16     value: https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
17   # Variables used by arcade to gather asset manifests
18   - name: _DotNetPublishToBlobFeed
19     value: true
21 jobs:
22 - job: Build
23   timeoutInMinutes: 90
24   strategy:
25     matrix:
26       Linux_x64:
27         poolname: Hosted Ubuntu 1604
28         manifest: linux-x64
29         sed: sed
30       Linux_ARM64:
31         ${{ if eq(variables['System.TeamProject'], 'public') }}:
32           poolname: Xamarin-ARM64
33         ${{ if eq(variables['System.TeamProject'], 'internal') }}:
34           poolname: Xamarin-ARM64-Private
35         manifest: linux-arm64
36         sed: sed
37       Windows_x64:
38         poolname: Hosted VS2017
39         manifest: win-x64
40         sed: sed
41       OSX_x64:
42         poolname: Hosted macOS
43         manifest: osx-x64
44         sed: gsed
45   pool:
46     name: $(poolname)
47   steps:
48   - bash: |  
49       brew install autoconf automake libtool gnu-sed
50     displayName: 'Prepare OSX dependencies'
51     condition: eq(variables['poolname'], 'Hosted macOS')
53   - bash: |  
54       sudo apt update
55       sudo apt -y install nuget libgdiplus build-essential libtool libtool-bin cmake gettext bc
56     displayName: 'Prepare Linux dependencies'
57     condition: eq(variables['poolname'], 'Hosted Ubuntu 1604')
58   
59   - script: |
60       choco install msys2 --params="/InstallDir:%CD:~0,2%\msys64 /NoUpdate /NoPath"
61       %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syyuu
62       %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syuu
63       %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Suy"
64       %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -S --needed python2 gettext autoconf automake libtool mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-make"
65       copy %CD:~0,2%\msys64\mingw64\bin\mingw32-make.exe %CD:~0,2%\msys64\mingw64\bin\make.exe
66     env:
67       CHERE_INVOKING: yes
68     displayName: 'Prepare Windows dependencies'
69     condition: eq(variables['poolname'], 'Hosted VS2017')
71   - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
72     - bash: |
73         ${sed} -i "s#git://github.com/#https://dn-bot:${dncengPat}@dev.azure.com/dnceng/internal/_git/#; s#\.git\$##; s#\(url = .*\)/\(.*\)#\1-\2#" .gitmodules
74       env:
75         dncengPat: $(dn-bot-dotnet-build-rw-code-rw)
76         sed: $(sed)
77       displayName: 'Rewrite .gitmodules'
79   - script: |
80       %CD:~0,2%\msys64\usr\bin\bash -lc "PATH=/usr/bin:/mingw64/bin:/c/hostedtoolcache/windows/dncs/2.2.203/x64:/c/Program\ Files/Git/bin ./autogen.sh --host=x86_64-w64-mingw32 --with-core=only"
81       CALL msvc\run-msbuild.bat build x86_64 release "/p:PlatformToolset=v140 /p:MONO_TARGET_GC=sgen"
82       %CD:~0,2%\msys64\usr\bin\bash -lc "PATH=/c/windows/System32/WindowsPowerShell/v1.0/:/usr/bin:/mingw64/bin:/c/hostedtoolcache/windows/dncs/2.2.203/x64:/c/Program\ Files/Git/bin make -C netcore bcl"
83       MKDIR mono\mini\.libs\
84       COPY msvc\build\sgen\x64\bin\Release\mono-2.0-sgen.dll mono\mini\.libs\monosgen-2.0.dll
85       %CD:~0,2%\msys64\usr\bin\bash -lc "PATH=/c/windows/System32/WindowsPowerShell/v1.0/:/usr/bin:/mingw64/bin:/c/hostedtoolcache/windows/dncs/2.2.203/x64:/c/Program\ Files/Git/bin make -C netcore nupkg"
86     displayName: 'Build (MSBuild and Make)'
87     env:
88       CHERE_INVOKING: yes
89     condition: eq(variables['poolname'], 'Hosted VS2017')
91   - bash: |
92       ./autogen.sh --with-core=only
93       make -C mono -j4
94       make -C netcore bcl
95     displayName: 'Build (Make)'
96     condition: ne(variables['poolname'], 'Hosted VS2017')
98   - bash: |
99       make -C netcore nupkg
100     displayName: 'Build nupkg'
101     condition: ne(variables['poolname'], 'Hosted VS2017')
103   - bash: |
104       make -C netcore update-tests-corefx
105     displayName: 'Download CoreFX Tests'
106     condition: ne(variables['poolname'], 'Hosted VS2017')
107   
108   - bash: |
109       rm -rf .failures
110       counter=0
111       tests_count=$(ls -1 netcore/corefx/tests/extracted | wc -l)
112       for testdir in netcore/corefx/tests/extracted/*; do
113         counter=$((counter+1))
114         printf "\nProcessing ($counter / $tests_count) $(basename $testdir)\n";
115         scripts/ci/./run-step.sh --label=$(basename $testdir) --timeout=10m --fatal make -C netcore run-tests-corefx-$(basename $testdir) || echo $(basename $testdir) >> .failures;
116       done
117     displayName: 'Run CoreFX Tests'
118     timeoutInMinutes: 90
119     condition: ne(variables['poolname'], 'Hosted VS2017')
121   - task: PublishTestResults@2
122     inputs:
123       testRunTitle: $(poolname)
124       testResultsFormat: 'XUnit'
125       testResultsFiles: 'netcore/corefx/tests/TestResult-*.xml'
126     condition: ne(variables['poolname'], 'Hosted VS2017')
128   - bash: |
129       if [ -e ".failures" ]; then
130         printf "\n\nFailures in $(<.failures)\nSee 'Run CoreFX tests' logs if Test View shows 0 failures.\n\n";
131         exit 1
132       fi
133     displayName: 'Validate test results'
134     timeoutInMinutes: 90
135     condition: ne(variables['poolname'], 'Hosted VS2017')
137   - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
138     - powershell: |
139         eng\common\build.ps1 /p:DotNetPublishToBlobFeed=true -ci -restore -projects $(Build.Repository.LocalPath)\eng\empty.proj
140       displayName: 'restore Arcade stuff with PowerShell'
141       condition: eq(variables['poolname'], 'Hosted VS2017')
142     - bash: |
143         ./eng/common/build.sh -p:DotNetPublishToBlobFeed=true --ci --restore --projects $(Build.Repository.LocalPath)/eng/empty.proj
144       displayName: 'restore Arcade stuff with Bash'
145       condition: ne(variables['poolname'], 'Hosted VS2017')
146     - bash: |
147         rm -f ./artifacts/Microsoft.NETCore.Runtime.Mono*nupkg
148       displayName: 'Delete metapackage, except on Windows'
149       condition: ne(variables['poolname'], 'Hosted VS2017')
150     - bash: |
151         dotnet msbuild eng/publishwitharcade.proj -p:AzureFeedUrl=$(dotnetfeedUrl) -p:AzureAccountKey=${dotnetFeedPat} -p:AssetManifest=${manifest}
152       env:
153         dotnetFeedPat: $(dotnetfeed-storage-access-key-1)
154         manifest: $(manifest)
155       displayName: 'publish with Arcade'
156     - task: CopyFiles@2
157       displayName: Gather Asset Manifests
158       inputs:
159         SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/Debug/AssetManifest'
160         TargetFolder: '$(Build.StagingDirectory)/AssetManifests'
161       continueOnError: false
162       condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true'))
163     - task: PublishBuildArtifacts@1
164       displayName: Push Asset Manifests
165       inputs:
166         PathtoPublish: '$(Build.StagingDirectory)/AssetManifests'
167         PublishLocation: Container
168         ArtifactName: AssetManifests
169       continueOnError: false
170       condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true'))
172 - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
173   - template: /eng/common/templates/phases/publish-build-assets.yml
174     parameters:
175       dependsOn:
176         - Build
177       queue:
178         name: Hosted VS2017