66 - master
77
88jobs :
9- test-msvc-cppwinrt :
10- name : ' MSVC: Tests '
9+ test-msvc-cppwinrt-build :
10+ name : ' MSVC: Build '
1111 strategy :
1212 matrix :
1313 arch : [x86, x64, arm64]
@@ -19,33 +19,237 @@ jobs:
1919 steps :
2020 - uses : actions/checkout@v3
2121
22- - name : Test all
22+ - name : Download nuget
23+ run : |
24+ mkdir ".\.nuget"
25+ Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile ".\.nuget\nuget.exe"
26+
27+ - name : Find VsDevCmd.bat
2328 run : |
2429 $VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat
2530 if (!$VSDevCmd) { exit 1 }
2631 echo "Using VSDevCmd: ${VSDevCmd}"
27- cmd /c "${VSDevCmd}" "&" build_test_all.cmd ${{ matrix.arch }} ${{ matrix.config }}
32+ Add-Content $env:GITHUB_ENV "VSDevCmd=$VSDevCmd"
33+
34+ - name : Prepare build flags
35+ run : |
36+ $target_configuration = "${{ matrix.config }}"
37+ $target_platform = "${{ matrix.arch }}"
38+ $target_version = "1.2.3.4"
39+ Add-Content $env:GITHUB_ENV "msbuild_config_props=/p:Configuration=$target_configuration,Platform=$target_platform,CppWinRTBuildVersion=$target_version"
40+
41+ - name : Restore nuget packages
42+ run : |
43+ cmd /c "$env:VSDevCmd" "&" nuget restore cppwinrt.sln
44+
45+ - name : Build fast_fwd
46+ run : |
47+ cmd /c "$env:VSDevCmd" "&" msbuild /m "$env:msbuild_config_props" cppwinrt.sln /t:fast_fwd
48+
49+ - name : Build cppwinrt
50+ if : matrix.arch != 'arm64'
51+ run : |
52+ cmd /c "$env:VSDevCmd" "&" msbuild /m "$env:msbuild_config_props" cppwinrt.sln /t:cppwinrt
2853
29- - name : Upload test log
54+ - name : Upload built executables
3055 if : matrix.arch != 'arm64'
3156 uses : actions/upload-artifact@v3
3257 with :
33- name : test-output-${{ matrix.arch }}-${{ matrix.config }}
34- path : " *_results.txt"
58+ name : msvc-build-${{ matrix.arch }}-${{ matrix.config }}-bin
59+ path : |
60+ _build/${{ matrix.arch }}/${{ matrix.config }}/*.exe
61+ _build/${{ matrix.arch }}/${{ matrix.config }}/*.dll
62+ _build/${{ matrix.arch }}/${{ matrix.config }}/*.winmd
63+ _build/${{ matrix.arch }}/${{ matrix.config }}/*.lib
64+ _build/${{ matrix.arch }}/${{ matrix.config }}/*.pdb
3565
36- - name : Check test failure
66+ - name : Run cppwinrt to build projection
3767 if : matrix.arch != 'arm64'
3868 run : |
39- if (Test-Path "test_failures.txt") {
40- Get-Content "test_failures.txt" | ForEach-Object {
41- echo "::error::Test '$_' failed!"
42- }
43- exit 1
69+ $target_configuration = "${{ matrix.config }}"
70+ $target_platform = "${{ matrix.arch }}"
71+ & "_build\$target_platform\$target_configuration\cppwinrt.exe" -in local -out _build\$target_platform\$target_configuration -verbose
72+
73+ test-msvc-cppwinrt-test :
74+ name : ' MSVC: Tests'
75+ needs : test-msvc-cppwinrt-build
76+ strategy :
77+ fail-fast : false
78+ matrix :
79+ arch : [x86, x64]
80+ config : [Debug, Release]
81+ test_exe : [test, test_cpp20, test_win7, test_fast, test_slow, test_old, test_module_lock_custom, test_module_lock_none]
82+ runs-on : windows-latest
83+ steps :
84+ - uses : actions/checkout@v3
85+
86+ - name : Fetch cppwinrt executables
87+ uses : actions/download-artifact@v3
88+ with :
89+ name : msvc-build-${{ matrix.arch }}-${{ matrix.config }}-bin
90+ path : _build/${{ matrix.arch }}/${{ matrix.config }}/
91+
92+ - name : Download nuget
93+ run : |
94+ mkdir ".\.nuget"
95+ Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile ".\.nuget\nuget.exe"
96+
97+ - name : Find VsDevCmd.bat
98+ run : |
99+ $VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat
100+ if (!$VSDevCmd) { exit 1 }
101+ echo "Using VSDevCmd: ${VSDevCmd}"
102+ Add-Content $env:GITHUB_ENV "VSDevCmd=$VSDevCmd"
103+
104+ - name : Prepare build flags
105+ run : |
106+ $target_configuration = "${{ matrix.config }}"
107+ $target_platform = "${{ matrix.arch }}"
108+ $target_version = "1.2.3.4"
109+ Add-Content $env:GITHUB_ENV "msbuild_config_props=/p:Configuration=$target_configuration,Platform=$target_platform,CppWinRTBuildVersion=$target_version"
110+
111+ - name : Restore nuget packages
112+ run : |
113+ cmd /c "$env:VSDevCmd" "&" nuget restore cppwinrt.sln
114+
115+ - name : Remove cppwinrt dependency from all test projects
116+ run : |
117+ # HACK: We already have a built exe, so we want to avoid rebuilding cppwinrt
118+ mv cppwinrt.sln cppwinrt.sln.orig
119+ Get-Content cppwinrt.sln.orig |
120+ Where-Object { -not $_.Contains("{D613FB39-5035-4043-91E2-BAB323908AF4} = {D613FB39-5035-4043-91E2-BAB323908AF4}") } |
121+ Set-Content cppwinrt.sln
122+
123+ - name : Patch catch.hpp to make it build with ANSI colour
124+ run : |
125+ # HACK: Remove <unistd.h> include and the isatty call in catch.hpp to make ANSI colour build work
126+ mv test/catch.hpp test/catch.hpp.orig
127+ Get-Content test/catch.hpp.orig |
128+ Where-Object { -not $_.Contains("#include <unistd.h>") } |
129+ ForEach-Object {
130+ $_.Replace("isatty(STDOUT_FILENO)", "false")
131+ } |
132+ Set-Content test/catch.hpp
133+
134+ - name : Run cppwinrt to build projection
135+ run : |
136+ $target_configuration = "${{ matrix.config }}"
137+ $target_platform = "${{ matrix.arch }}"
138+ & "_build\$target_platform\$target_configuration\cppwinrt.exe" -in local -out _build\$target_platform\$target_configuration -verbose
139+
140+ - name : Build test '${{ matrix.test_exe }}'
141+ run : |
142+ $test_proj = "${{ matrix.test_exe }}"
143+ if ($test_proj -eq "test_old") {
144+ $test_proj = "old_tests\test_old"
44145 }
45- if (!(Test-Path "*_results.txt")) {
46- echo "::error::No test output found!"
146+
147+ cmd /c "$env:VSDevCmd" "&" msbuild /m /p:TestsUseAnsiColor=1 "$env:msbuild_config_props" cppwinrt.sln /t:test\$test_proj
148+
149+ - name : Run test '${{ matrix.test_exe }}'
150+ run : |
151+ $target_configuration = "${{ matrix.config }}"
152+ $target_platform = "${{ matrix.arch }}"
153+ $test_exe = "${{ matrix.test_exe }}"
154+ $test_path = "_build\$target_platform\$target_configuration\$test_exe.exe"
155+ if (!(Test-Path $test_path)) {
156+ echo "::error::Test $test_exe is missing."
47157 exit 1
48158 }
159+ & $test_path --use-colour yes
160+
161+ build-msvc-natvis :
162+ name : ' Build natvis'
163+ strategy :
164+ matrix :
165+ arch : [x86, x64, arm64]
166+ config : [Release]
167+ Deployment : [Component, Standalone]
168+ runs-on : windows-latest
169+ steps :
170+ - uses : actions/checkout@v3
171+
172+ - name : Download nuget
173+ run : |
174+ mkdir ".\.nuget"
175+ Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile ".\.nuget\nuget.exe"
176+
177+ - name : Find VsDevCmd.bat
178+ run : |
179+ $VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat
180+ if (!$VSDevCmd) { exit 1 }
181+ echo "Using VSDevCmd: ${VSDevCmd}"
182+ Add-Content $env:GITHUB_ENV "VSDevCmd=$VSDevCmd"
183+
184+ - name : Prepare build flags
185+ run : |
186+ $target_configuration = "${{ matrix.config }}"
187+ $target_platform = "${{ matrix.arch }}"
188+ $target_version = "1.2.3.4"
189+ Add-Content $env:GITHUB_ENV "msbuild_config_props=/p:Configuration=$target_configuration,Platform=$target_platform,CppWinRTBuildVersion=$target_version"
190+
191+ - name : Restore nuget packages
192+ run : |
193+ cmd /c "$env:VSDevCmd" "&" nuget restore natvis\cppwinrtvisualizer.sln
194+
195+ - name : Build natvis
196+ run : |
197+ cmd /c "$env:VSDevCmd" "&" msbuild /m "$env:msbuild_config_props" /p:Deployment=${{ matrix.Deployment }} natvis\cppwinrtvisualizer.sln
198+
199+ build-msvc-nuget-test :
200+ name : ' Build nuget test'
201+ needs : test-msvc-cppwinrt-build
202+ strategy :
203+ matrix :
204+ arch : [x86, x64]
205+ config : [Release]
206+ runs-on : windows-latest
207+ steps :
208+ - uses : actions/checkout@v3
209+
210+ - name : Fetch cppwinrt executables
211+ uses : actions/download-artifact@v3
212+ with :
213+ name : msvc-build-${{ matrix.arch }}-${{ matrix.config }}-bin
214+ path : _build/${{ matrix.arch }}/${{ matrix.config }}/
215+
216+ - name : Download nuget
217+ run : |
218+ mkdir ".\.nuget"
219+ Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile ".\.nuget\nuget.exe"
220+
221+ - name : Find VsDevCmd.bat
222+ run : |
223+ $VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat
224+ if (!$VSDevCmd) { exit 1 }
225+ echo "Using VSDevCmd: ${VSDevCmd}"
226+ Add-Content $env:GITHUB_ENV "VSDevCmd=$VSDevCmd"
227+
228+ - name : Prepare build flags
229+ run : |
230+ $target_configuration = "${{ matrix.config }}"
231+ $target_platform = "${{ matrix.arch }}"
232+ $target_version = "1.2.3.4"
233+ Add-Content $env:GITHUB_ENV "msbuild_config_props=/p:Configuration=$target_configuration,Platform=$target_platform,CppWinRTBuildVersion=$target_version"
234+
235+ - name : Restore nuget packages
236+ run : |
237+ cmd /c "$env:VSDevCmd" "&" nuget restore test\nuget\NugetTest.sln
238+
239+ - name : Run cppwinrt to build projection
240+ run : |
241+ $target_configuration = "${{ matrix.config }}"
242+ $target_platform = "${{ matrix.arch }}"
243+ & "_build\$target_platform\$target_configuration\cppwinrt.exe" -in local -out _build\$target_platform\$target_configuration -verbose
244+
245+ - name : Run nuget test
246+ run : |
247+ cmd /c "$env:VSDevCmd" "&" msbuild /m "$env:msbuild_config_props" test\nuget\NugetTest.sln
248+ if ($LastExitCode -ne 0) {
249+ echo "::warning::nuget test failed"
250+ }
251+ # FIXME: This build was failing from the start
252+ exit 0
49253
50254 build-nuget :
51255 name : Build nuget package with MSVC
0 commit comments