[netcore] Consolidate running tests between AzDO pipeline and Makefile (#16348)
[mono-project.git] / scripts / ci / pipeline-netcore-runtime.yml
blob3a847d79c5ba6a854f3d5e16e0cdadfb43e1e8fb
1 trigger:
2   batch: true
3   branches:
4     include:
5     - master
7 pr:
8   branches:
9     include:
10     - master
12 variables:
13 - ${{ if ne(variables['System.TeamProject'], 'public') }}:
14   - group: DotNet-VSTS-Bot
15   - group: DotNet-Blob-Feed
16 - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
17   # Variables used to publish packages to blob feed
18   - name: dotnetFeedUrl
19     value: https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
20   # Variables used by arcade to gather asset manifests
21   - name: _DotNetPublishToBlobFeed
22     value: true
24 stages:
25 - stage: build
26   displayName: Build
27   jobs:
28   - template: /eng/common/templates/jobs/jobs.yml
29     parameters:
30       enablePublishBuildArtifacts: true
31       enablePublishBuildAssets: true
32       enablePublishUsingPipelines: false
33       variables:
34         - _BuildConfig: Release
35       jobs:
37       ############ LINUX BUILD ############
38       - job: Build_Linux
39         displayName: Linux
40         timeoutInMinutes: 120
41         strategy:
42           matrix:
43             x64:
44               poolname: Hosted Ubuntu 1604
45               manifest: linux-x64
46               prepareDependencies: true
47             ARM64:
48               manifest: linux-arm64
49               ${{ if eq(variables['System.TeamProject'], 'public') }}:
50                 poolname: Xamarin-ARM64
51               ${{ if eq(variables['System.TeamProject'], 'internal') }}:
52                 poolname: Xamarin-ARM64-Private
53         pool:
54           name: $(poolname)
55         steps:
56         - bash: |
57             git clean -ffdx
58             git reset --hard HEAD
59           displayName: 'Clean up working directory'
61         - bash: |
62             sudo apt update
63             sudo apt -y install nuget libgdiplus build-essential libtool libtool-bin cmake gettext bc
64           displayName: 'Prepare Linux dependencies'
65           condition: and(succeeded(), eq(variables['prepareDependencies'], 'true'))
67         - bash: |
68             sed -i "s#git://github.com/#https://dn-bot:${dncengPat}@dev.azure.com/dnceng/internal/_git/#; s#\.git\$##; s#\(url = .*\)/\(.*\)#\1-\2#" .gitmodules
69           env:
70             dncengPat: $(dn-bot-dotnet-build-rw-code-rw)
71           displayName: 'Rewrite .gitmodules'
72           condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))
74         - bash: |
75             cd netcore
76             ./build.sh -c $(_BuildConfig)
77           displayName: 'Build (Make)'
79         - bash: |
80             make -C netcore nupkg
81             rm -f ./artifacts/Microsoft.NETCore.Runtime.Mono*nupkg
82             mkdir -p ./artifacts/log/$(_BuildConfig)
83           displayName: 'Build nupkg'
85         - bash: |
86             make -C netcore run-tests-corefx USE_TIMEOUT=1
87           displayName: 'Download and Run CoreFX Tests'
88           timeoutInMinutes: 90
89           condition: and(succeeded(), eq(variables['System.TeamProject'], 'public'))
91         - task: PublishTestResults@2
92           inputs:
93             testRunTitle: $(poolname)
94             testResultsFormat: 'XUnit'
95             testResultsFiles: 'netcore/corefx/tests/TestResult-*.xml'
96           condition: and(succeededOrFailed(), eq(variables['System.TeamProject'], 'public'))
98         - script: ./eng/common/build.sh -c $(_BuildConfig) /p:DotNetPublishToBlobFeed=true --ci --restore --projects $(Build.SourcesDirectory)/eng/empty.proj
99           displayName: Restore blob feed tasks
100           condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))
102         - script: ./eng/common/msbuild.sh --ci $(Build.SourcesDirectory)/eng/publishwitharcade.proj /p:Configuration=$(_BuildConfig) /p:AzureFeedUrl=$(dotnetFeedUrl) /p:AzureAccountKey=$(dotnetfeed-storage-access-key-1) /p:AssetManifest=$(manifest)
103           displayName: Publish packages to blob feed
104           condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))
106       ############ MACOS BUILD ############
107       - job: Build_macOS
108         displayName: macOS
109         timeoutInMinutes: 120
110         strategy:
111           matrix:
112             x64:
113               poolname: Hosted macOS
114               manifest: osx-x64
115         pool:
116           name: $(poolname)
117         steps:
118         - bash: |
119             git clean -ffdx
120             git reset --hard HEAD
121           displayName: 'Clean up working directory'
122         - bash: |
123             brew install autoconf automake libtool gnu-sed
124           displayName: 'Prepare macOS dependencies'
126         - bash: |
127             gsed -i "s#git://github.com/#https://dn-bot:${dncengPat}@dev.azure.com/dnceng/internal/_git/#; s#\.git\$##; s#\(url = .*\)/\(.*\)#\1-\2#" .gitmodules
128           env:
129             dncengPat: $(dn-bot-dotnet-build-rw-code-rw)
130           displayName: 'Rewrite .gitmodules'
131           condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))
133         - bash: |
134             cd netcore
135             ./build.sh -c $(_BuildConfig)
136           displayName: 'Build (Make)'
138         - bash: |
139             make -C netcore nupkg
140             rm -f ./artifacts/Microsoft.NETCore.Runtime.Mono*nupkg
141             mkdir -p ./artifacts/log/$(_BuildConfig)
142           displayName: 'Build nupkg'
144         - bash: |
145             make -C netcore run-tests-corefx USE_TIMEOUT=1
146           displayName: 'Download and Run CoreFX Tests'
147           timeoutInMinutes: 90
148           condition: and(succeeded(), eq(variables['System.TeamProject'], 'public'))
150         - task: PublishTestResults@2
151           inputs:
152             testRunTitle: $(poolname)
153             testResultsFormat: 'XUnit'
154             testResultsFiles: 'netcore/corefx/tests/TestResult-*.xml'
155           condition: and(succeededOrFailed(), eq(variables['System.TeamProject'], 'public'))
157         - script: ./eng/common/build.sh -c $(_BuildConfig) /p:DotNetPublishToBlobFeed=true --ci --restore --projects $(Build.SourcesDirectory)/eng/empty.proj
158           displayName: Restore blob feed tasks
159           condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))
161         - script: ./eng/common/msbuild.sh --ci $(Build.SourcesDirectory)/eng/publishwitharcade.proj /p:Configuration=$(_BuildConfig) /p:AzureFeedUrl=$(dotnetFeedUrl) /p:AzureAccountKey=$(dotnetfeed-storage-access-key-1) /p:AssetManifest=$(manifest)
162           displayName: Publish packages to blob feed
163           condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))
165       ############ WINDOWS BUILD ############
166       - job: Build_Windows
167         displayName: Windows
168         timeoutInMinutes: 120
169         strategy:
170           matrix:
171             x64:
172               poolname: Hosted VS2017
173               manifest: win-x64
174         pool:
175           name: $(poolname)
176         steps:
177         - bash: |
178             git clean -ffdx
179             git reset --hard HEAD
180           displayName: 'Clean up working directory'
182         - script: |
183             choco install msys2 --params="/InstallDir:%CD:~0,2%\msys64 /NoUpdate /NoPath"
184             %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syyuu
185             %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syuu
186             %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Suy"
187             %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"
188             copy %CD:~0,2%\msys64\mingw64\bin\mingw32-make.exe %CD:~0,2%\msys64\mingw64\bin\make.exe
189           env:
190             CHERE_INVOKING: yes
191           displayName: 'Prepare Windows dependencies'
193         - bash: |
194             sed -i "s#git://github.com/#https://dn-bot:${dncengPat}@dev.azure.com/dnceng/internal/_git/#; s#\.git\$##; s#\(url = .*\)/\(.*\)#\1-\2#" .gitmodules
195           env:
196             dncengPat: $(dn-bot-dotnet-build-rw-code-rw)
197           displayName: 'Rewrite .gitmodules'
198           condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))
200         - script: |
201             %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"
202             CALL msvc\run-msbuild.bat build x86_64 release "/p:PlatformToolset=v140 /p:MONO_TARGET_GC=sgen"
203             %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 CORLIB_BUILD_FLAGS='-c $(_BuildConfig)'"
204             MKDIR mono\mini\.libs\
205             COPY msvc\build\sgen\x64\bin\Release\mono-2.0-sgen.dll mono\mini\.libs\monosgen-2.0.dll
206             %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"
207             MKDIR artifacts\log\$(_BuildConfig)\
208           displayName: 'Build (MSBuild and Make)'
209           env:
210             CHERE_INVOKING: yes
212         - powershell: eng\common\build.ps1 /p:DotNetPublishToBlobFeed=true -c $(_BuildConfig) -ci -restore -projects $(Build.SourcesDirectory)\eng\empty.proj
213           displayName: Restore blob feed tasks
214           condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))
216         - powershell: eng\common\msbuild.ps1 -ci $(Build.SourcesDirectory)\eng\publishwitharcade.proj /p:Configuration=$(_BuildConfig) /p:AzureFeedUrl=$(dotnetFeedUrl) /p:AzureAccountKey=$(dotnetfeed-storage-access-key-1) /p:AssetManifest=$(manifest)
217           displayName: Publish packages to blob feed
218           condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))
221 # - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
222 #   - template: /eng/common/templates/post-build/post-build.yml
223 #     parameters:
224 #       enableSourceLinkValidation: false
225 #       enableSigningValidation: false
226 #       enableSymbolValidation: false
227 #       enableNugetValidation: true