Increase foldability of various templates #269
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
test-msvc-cppwinrt-build: | |
name: '${{ matrix.compiler }}: Build (${{ matrix.arch }}, ${{ matrix.config }})' | |
strategy: | |
matrix: | |
compiler: [MSVC, clang-cl] | |
arch: [x86, x64, arm64] | |
config: [Debug, Release] | |
exclude: | |
- arch: arm64 | |
config: Debug | |
- compiler: clang-cl | |
arch: arm64 | |
- compiler: clang-cl | |
config: Release | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- id: setup-llvm | |
name: Set up LLVM (MSVC) | |
uses: ./.github/actions/setup-llvm-msvc | |
if: matrix.compiler == 'clang-cl' | |
- name: Download nuget | |
run: | | |
mkdir ".\.nuget" | |
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile ".\.nuget\nuget.exe" | |
- name: Find VsDevCmd.bat | |
run: | | |
$VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat | |
if (!$VSDevCmd) { exit 1 } | |
echo "Using VSDevCmd: ${VSDevCmd}" | |
Add-Content $env:GITHUB_ENV "VSDevCmd=$VSDevCmd" | |
- name: Prepare build flags | |
run: | | |
$target_configuration = "${{ matrix.config }}" | |
$target_platform = "${{ matrix.arch }}" | |
$target_version = "1.2.3.4" | |
$props = "Configuration=$target_configuration,Platform=$target_platform,CppWinRTBuildVersion=$target_version" | |
if ("${{ matrix.compiler }}" -eq "clang-cl") { | |
$props += ",Clang=1,PlatformToolset=LLVM_v143,LLVMInstallDir=${{ steps.setup-llvm.outputs.llvm-path }}" | |
} | |
Add-Content $env:GITHUB_ENV "msbuild_config_props=/p:$props" | |
- name: Restore nuget packages | |
run: | | |
cmd /c "$env:VSDevCmd" "&" nuget restore cppwinrt.sln | |
- name: Build fast_fwd | |
run: | | |
cmd /c "$env:VSDevCmd" "&" msbuild /m /clp:ForceConsoleColor "$env:msbuild_config_props" cppwinrt.sln /t:fast_fwd | |
- name: Build x86 prebuild tool | |
if: matrix.arch == 'arm64' | |
run: | | |
cmd /c "$env:VSDevCmd" "&" msbuild /m /clp:ForceConsoleColor "$env:msbuild_config_props" /p:Platform=x86 cppwinrt.sln /t:cppwinrt | |
- name: Build cppwinrt | |
run: | | |
cmd /c "$env:VSDevCmd" "&" msbuild /m /clp:ForceConsoleColor "$env:msbuild_config_props" cppwinrt.sln /t:cppwinrt | |
- name: Upload built executables | |
uses: actions/upload-artifact@v3 | |
with: | |
name: msvc-build-${{ matrix.arch }}-${{ matrix.config }}-bin | |
path: | | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.exe | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.dll | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.winmd | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.lib | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.pdb | |
- name: Run cppwinrt to build projection | |
if: matrix.arch != 'arm64' | |
run: | | |
$target_configuration = "${{ matrix.config }}" | |
$target_platform = "${{ matrix.arch }}" | |
& "_build\$target_platform\$target_configuration\cppwinrt.exe" -in local -out _build\$target_platform\$target_configuration -verbose | |
test-msvc-cppwinrt-test: | |
name: '${{ matrix.compiler }}: Test [${{ matrix.test_exe }}] (${{ matrix.arch }}, ${{ matrix.config }})' | |
needs: test-msvc-cppwinrt-build | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [MSVC, clang-cl] | |
arch: [x86, x64, arm64] | |
config: [Debug, Release] | |
test_exe: [test, test_cpp20, test_cpp20_no_sourcelocation, test_win7, test_fast, test_slow, test_old, test_module_lock_custom, test_module_lock_none] | |
exclude: | |
- arch: arm64 | |
config: Debug | |
- compiler: clang-cl | |
arch: arm64 | |
- compiler: clang-cl | |
config: Release | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- id: setup-llvm | |
name: Set up LLVM (MSVC) | |
uses: ./.github/actions/setup-llvm-msvc | |
if: matrix.compiler == 'clang-cl' | |
- name: Fetch cppwinrt executables | |
if: matrix.arch != 'arm64' | |
uses: actions/download-artifact@v3 | |
with: | |
name: msvc-build-${{ matrix.arch }}-${{ matrix.config }}-bin | |
path: _build/${{ matrix.arch }}/${{ matrix.config }}/ | |
- name: Fetch x86 cppwinrt executables (arm64 only) | |
if: matrix.arch == 'arm64' | |
uses: actions/download-artifact@v3 | |
with: | |
name: msvc-build-x86-Release-bin | |
path: _build/x86/Release/ | |
- name: Download nuget | |
run: | | |
mkdir ".\.nuget" | |
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile ".\.nuget\nuget.exe" | |
- name: Find VsDevCmd.bat | |
run: | | |
$VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat | |
if (!$VSDevCmd) { exit 1 } | |
echo "Using VSDevCmd: ${VSDevCmd}" | |
Add-Content $env:GITHUB_ENV "VSDevCmd=$VSDevCmd" | |
- name: Prepare build flags | |
run: | | |
$target_configuration = "${{ matrix.config }}" | |
$target_platform = "${{ matrix.arch }}" | |
$target_version = "1.2.3.4" | |
$props = "Configuration=$target_configuration,Platform=$target_platform,CppWinRTBuildVersion=$target_version" | |
if ("${{ matrix.compiler }}" -eq "clang-cl") { | |
$props += ",Clang=1,PlatformToolset=LLVM_v143,LLVMInstallDir=${{ steps.setup-llvm.outputs.llvm-path }}" | |
} | |
Add-Content $env:GITHUB_ENV "msbuild_config_props=/p:$props" | |
- name: Restore nuget packages | |
run: | | |
cmd /c "$env:VSDevCmd" "&" nuget restore cppwinrt.sln | |
- name: Remove cppwinrt dependency from all test projects | |
run: | | |
# HACK: We already have a built exe, so we want to avoid rebuilding cppwinrt | |
mv cppwinrt.sln cppwinrt.sln.orig | |
Get-Content cppwinrt.sln.orig | | |
Where-Object { -not $_.Contains("{D613FB39-5035-4043-91E2-BAB323908AF4} = {D613FB39-5035-4043-91E2-BAB323908AF4}") } | | |
Set-Content cppwinrt.sln | |
- name: Patch catch.hpp to make it build with ANSI colour | |
run: | | |
# HACK: Remove <unistd.h> include and the isatty call in catch.hpp to make ANSI colour build work | |
mv test/catch.hpp test/catch.hpp.orig | |
Get-Content test/catch.hpp.orig | | |
Where-Object { -not $_.Contains("#include <unistd.h>") } | | |
ForEach-Object { | |
$_.Replace("isatty(STDOUT_FILENO)", "false") | |
} | | |
Set-Content test/catch.hpp | |
- name: Run cppwinrt to build projection | |
run: | | |
$target_configuration = "${{ matrix.config }}" | |
$target_platform = "${{ matrix.arch }}" | |
$cppwinrt_path = "_build\$target_platform\$target_configuration\cppwinrt.exe" | |
if ($target_platform -eq "arm64") { | |
$cppwinrt_path = "_build\x86\Release\cppwinrt.exe" | |
} | |
& $cppwinrt_path -in local -out _build\$target_platform\$target_configuration -verbose | |
- name: Build test '${{ matrix.test_exe }}' | |
run: | | |
$test_proj = "${{ matrix.test_exe }}" | |
if ($test_proj -eq "test_old") { | |
$test_proj = "old_tests\test_old" | |
} | |
cmd /c "$env:VSDevCmd" "&" msbuild /m /clp:ForceConsoleColor /p:TestsUseAnsiColor=1 "$env:msbuild_config_props" cppwinrt.sln /t:test\$test_proj | |
- name: Run tests in '${{ matrix.test_exe }}' one by one | |
if: matrix.compiler == 'clang-cl' | |
run: | | |
$target_configuration = "${{ matrix.config }}" | |
$target_platform = "${{ matrix.arch }}" | |
$test_exe = "${{ matrix.test_exe }}" | |
$test_path = "_build\$target_platform\$target_configuration\$test_exe.exe" | |
if (!(Test-Path $test_path)) { | |
echo "::error::Test $test_exe is missing." | |
exit 1 | |
} | |
$test_names = @( & $test_path --list-test-names-only ) | |
$failed_tests = 0 | |
foreach ($test_name in $test_names) { | |
echo "::group::Running test $test_name" | |
$escaped = $test_name.Replace("\", "\\").Replace(",", "\,").Replace("[", "\[") | |
& $test_path --use-colour yes --warn NoTests "$escaped" | |
echo "::endgroup::" | |
if ($LastExitCode -ne 0) { | |
$failed_tests += 1 | |
# Add a newline in case test exited abnormally without newline | |
echo "" | |
echo "::error::Test $test_exe/'$test_name' failed with exit code $LastExitCode!" | |
} | |
} | |
if ($failed_tests -eq 0) { | |
echo "All tests in $test_exe passed." | |
} else { | |
echo "$failed_tests failed in $test_exe." | |
exit 1 | |
} | |
- name: Run test '${{ matrix.test_exe }}' | |
if: matrix.arch != 'arm64' | |
run: | | |
$target_configuration = "${{ matrix.config }}" | |
$target_platform = "${{ matrix.arch }}" | |
$test_exe = "${{ matrix.test_exe }}" | |
$test_path = "_build\$target_platform\$target_configuration\$test_exe.exe" | |
if (!(Test-Path $test_path)) { | |
echo "::error::Test $test_exe is missing." | |
exit 1 | |
} | |
& $test_path --use-colour yes | |
- name: Upload arm64 test executables | |
if: matrix.arch == 'arm64' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: msvc-tests-${{ matrix.arch }}-${{ matrix.config }}-bin | |
path: | | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.exe | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.dll | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.winmd | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.lib | |
_build/${{ matrix.arch }}/${{ matrix.config }}/*.pdb | |
test-llvm-mingw-cppwinrt: | |
name: 'llvm-mingw: Build and test' | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [i686, x86_64] | |
config: [Debug, Release] | |
runs-on: windows-latest | |
env: | |
CMAKE_COLOR_DIAGNOSTICS: 1 | |
CLICOLOR_FORCE: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- id: setup-llvm | |
name: Set up llvm-mingw | |
uses: ./.github/actions/setup-llvm-mingw | |
with: | |
host-arch: ${{ matrix.arch }} | |
- name: Build cppwinrt | |
run: | | |
mkdir build | |
cd build | |
if ("${{ matrix.config }}" -eq "Debug") { | |
$sanitizers = "TRUE" | |
} else { | |
$sanitizers = "FALSE" | |
} | |
cmake ../ -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.config }} ` | |
-DDOWNLOAD_WINDOWSNUMERICS=TRUE ` | |
-DUSE_ANSI_COLOR=TRUE ` | |
-DCMAKE_CXX_FLAGS="-fansi-escape-codes" ` | |
-DENABLE_TEST_SANITIZERS=$sanitizers | |
cmake --build . -j2 --target cppwinrt | |
- name: Upload cppwinrt.exe | |
uses: actions/upload-artifact@v3 | |
with: | |
name: llvm-mingw-build-${{ matrix.arch }}-bin | |
path: build/cppwinrt.exe | |
- name: Build tests | |
run: | | |
cd build | |
cmake --build . -j2 --target test-vanilla test_cpp20 test_cpp20_no_sourcelocation test_win7 test_old | |
- name: Upload test binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: llvm-mingw-tests-${{ matrix.arch }}-bin | |
path: build/test/*.exe | |
- name: Run tests | |
run: | | |
cd build | |
$env:UBSAN_OPTIONS = "print_stacktrace=1" | |
ctest --verbose | |
test-msys2-gcc-cppwinrt: | |
name: 'gcc/msys2: Build and test (${{ matrix.sys }}, ${{ matrix.config }})' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# 32-bit builds are running out of memory | |
# - { sys: mingw32, arch: i686, config: Release } | |
- { sys: mingw64, arch: x86_64, config: Debug } | |
- { sys: mingw64, arch: x86_64, config: Release } | |
- { sys: ucrt64, arch: x86_64, config: Release } | |
runs-on: windows-latest | |
env: | |
CMAKE_COLOR_DIAGNOSTICS: 1 | |
CLICOLOR_FORCE: 1 | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
update: true | |
pacboy: >- | |
crt:p | |
gcc:p | |
binutils:p | |
cmake:p | |
ninja:p | |
- uses: actions/checkout@v3 | |
- name: Build cppwinrt | |
run: | | |
mkdir build | |
cd build | |
if [[ "${{ matrix.arch }}" = "i686" ]]; then | |
skip_large_pch_arg="-DSKIP_LARGE_PCH=TRUE" | |
fi | |
cmake ../ -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config }} \ | |
-DDOWNLOAD_WINDOWSNUMERICS=TRUE \ | |
-DUSE_ANSI_COLOR=TRUE \ | |
$skip_large_pch_arg | |
cmake --build . --target cppwinrt | |
- name: Build tests | |
run: | | |
cd build | |
cmake --build . -j2 --target test-vanilla test_cpp20 test_cpp20_no_sourcelocation test_win7 test_old | |
- name: Run tests | |
run: | | |
cd build | |
ctest --verbose | |
build-linux-cross-cppwinrt: | |
name: 'cross: Cross-build from Linux' | |
strategy: | |
matrix: | |
arch: [i686, x86_64] | |
runs-on: ubuntu-22.04 | |
env: | |
CMAKE_COLOR_DIAGNOSTICS: 1 | |
CLICOLOR_FORCE: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install cross compiler | |
run: | | |
arch=${{ matrix.arch }} | |
sudo apt-get install g++-mingw-w64-${arch/_/-} | |
sudo update-alternatives --set "${{ matrix.arch }}-w64-mingw32-gcc" "/usr/bin/${{ matrix.arch }}-w64-mingw32-gcc-posix" | |
sudo update-alternatives --set "${{ matrix.arch }}-w64-mingw32-g++" "/usr/bin/${{ matrix.arch }}-w64-mingw32-g++-posix" | |
- name: Cross-build cppwinrt | |
run: | | |
cmake -S . -B build/cross_x64/ --toolchain cross-mingw-toolchain.cmake \ | |
-DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DCMAKE_CXX_FLAGS="-static" \ | |
-DCMAKE_INSTALL_PREFIX=$PWD/install/ | |
cmake --build build/cross_x64/ --target install -j2 | |
- name: Upload cppwinrt.exe | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cross-build-${{ matrix.arch }}-bin | |
path: install/bin/cppwinrt.exe | |
test-linux-cross-cppwinrt: | |
name: 'cross: Test run on Windows' | |
needs: build-linux-cross-cppwinrt | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [i686, x86_64] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fetch cppwinrt executable | |
uses: actions/download-artifact@v3 | |
with: | |
name: cross-build-${{ matrix.arch }}-bin | |
path: ./.test | |
- name: Run cppwinrt to build projection | |
run: | | |
.\.test\cppwinrt.exe -in local -out .\.test\out -verbose | |
- id: setup-llvm | |
name: Set up llvm-mingw | |
uses: ./.github/actions/setup-llvm-mingw | |
with: | |
host-arch: ${{ matrix.arch }} | |
- name: Build cppwinrt tests | |
run: | | |
mkdir build | |
cd build | |
cmake ../test -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ` | |
-DCPPWINRT_PROJECTION_INCLUDE_DIR="../.test/out" ` | |
-DDOWNLOAD_WINDOWSNUMERICS=TRUE ` | |
-DUSE_ANSI_COLOR=TRUE | |
cmake --build . -j2 | |
- name: Run tests | |
run: | | |
cd build | |
ctest --verbose | |
build-linux-native-cppwinrt: | |
name: 'linux: GCC native build + mingw-w64 cross-build tests' | |
strategy: | |
fail-fast: false | |
matrix: | |
# TODO: Enable gcc build once Arch Linux gets more recent mingw-w64 headers (ver. 11 perhaps?) | |
# cross_toolchain: [gcc, llvm-mingw] | |
cross_toolchain: [llvm-mingw] | |
cross_arch: [i686, x86_64] | |
# include: | |
# - cross_toolchain: gcc | |
# container: | |
# image: archlinux:base-devel | |
runs-on: ubuntu-22.04 | |
container: ${{ matrix.container }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
CMAKE_COLOR_DIAGNOSTICS: 1 | |
CLICOLOR_FORCE: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install build tools | |
if: matrix.cross_toolchain == 'gcc' | |
run: | | |
pacman --noconfirm -Suuy | |
pacman --needed --noconfirm -S cmake ninja git | |
- name: Build cppwinrt | |
run: | | |
cmake -S . -B build/native/ \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DCMAKE_INSTALL_PREFIX=$PWD/install/ | |
cmake --build build/native/ --target install -j2 | |
- name: Test run (cppwinrt -?) | |
run: | | |
install/bin/cppwinrt -? | |
- name: Test run (build projection using Windows.winmd) | |
run: | | |
curl -o Windows.winmd -L https://github.com/microsoft/windows-rs/raw/master/crates/libs/metadata/default/Windows.winmd | |
install/bin/cppwinrt -in Windows.winmd -out /tmp/cppwinrt -verbose | |
- id: setup-llvm | |
name: Set up llvm-mingw | |
if: matrix.cross_toolchain == 'llvm-mingw' | |
uses: ./.github/actions/setup-llvm-mingw | |
- name: Install GCC cross compiler | |
if: matrix.cross_toolchain == 'gcc' | |
run: | | |
pacman --needed --noconfirm -S mingw-w64-gcc | |
- name: Cross-build tests using projection | |
run: | | |
cmake -S test -B build/cross-tests --toolchain "$PWD/cross-mingw-toolchain.cmake" \ | |
-DCMAKE_SYSTEM_PROCESSOR=${{ matrix.cross_arch }} \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DCMAKE_CXX_FLAGS="-static" \ | |
-DCPPWINRT_PROJECTION_INCLUDE_DIR=/tmp/cppwinrt \ | |
-DDOWNLOAD_WINDOWSNUMERICS=TRUE \ | |
-DUSE_ANSI_COLOR=TRUE | |
cmake --build build/cross-tests -j2 | |
- name: Upload built tests | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-native-cppwinrt-cross-build-tests-${{ matrix.cross_toolchain }}-${{ matrix.cross_arch }}-bin | |
path: build/cross-tests/*.exe | |
test-linux-native-cppwinrt-cross-tests: | |
name: 'linux: Run llvm-mingw cross-build tests' | |
needs: build-linux-native-cppwinrt | |
strategy: | |
fail-fast: false | |
matrix: | |
# TODO: Enable gcc build test when it is buildable | |
# cross_toolchain: [gcc, llvm-mingw] | |
cross_toolchain: [llvm-mingw] | |
cross_arch: [i686, x86_64] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fetch test executables | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux-native-cppwinrt-cross-build-tests-${{ matrix.cross_toolchain }}-${{ matrix.cross_arch }}-bin | |
path: ./ | |
- name: Run tests | |
run: | | |
$test_exes = ls *.exe -Name | |
$has_failed_tests = 0 | |
foreach ($test_exe in $test_exes) { | |
echo "::group::Run '$test_exe'" | |
& .\$test_exe --use-colour yes | |
echo "::endgroup::" | |
if ($LastExitCode -ne 0) { | |
echo "::error::Test '$test_exe' failed!" | |
$has_failed_tests = 1 | |
} | |
} | |
if ($has_failed_tests -ne 0) { | |
exit 1 | |
} | |
build-macos-native-cppwinrt: | |
name: 'macOS: GCC native build' | |
runs-on: macos-latest | |
defaults: | |
run: | |
shell: bash | |
env: | |
CMAKE_COLOR_DIAGNOSTICS: 1 | |
CLICOLOR_FORCE: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build cppwinrt | |
run: | | |
cmake -S . -B build/native/ \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DCMAKE_INSTALL_PREFIX=$PWD/install/ | |
cmake --build build/native/ --target install -j2 | |
- name: Test run (cppwinrt -?) | |
run: | | |
install/bin/cppwinrt -? | |
- name: Test run (build projection using Windows.winmd) | |
run: | | |
curl -o Windows.winmd -L https://github.com/microsoft/windows-rs/raw/master/crates/libs/metadata/default/Windows.winmd | |
install/bin/cppwinrt -in Windows.winmd -out build/out -verbose | |
build-msvc-natvis: | |
name: 'Build natvis' | |
strategy: | |
matrix: | |
arch: [x86, x64, arm64] | |
config: [Release] | |
Deployment: [Component, Standalone] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download nuget | |
run: | | |
mkdir ".\.nuget" | |
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile ".\.nuget\nuget.exe" | |
- name: Find VsDevCmd.bat | |
run: | | |
$VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat | |
if (!$VSDevCmd) { exit 1 } | |
echo "Using VSDevCmd: ${VSDevCmd}" | |
Add-Content $env:GITHUB_ENV "VSDevCmd=$VSDevCmd" | |
- name: Prepare build flags | |
run: | | |
$target_configuration = "${{ matrix.config }}" | |
$target_platform = "${{ matrix.arch }}" | |
$target_version = "1.2.3.4" | |
Add-Content $env:GITHUB_ENV "msbuild_config_props=/p:Configuration=$target_configuration,Platform=$target_platform,CppWinRTBuildVersion=$target_version" | |
- name: Restore nuget packages | |
run: | | |
cmd /c "$env:VSDevCmd" "&" nuget restore natvis\cppwinrtvisualizer.sln | |
- name: Build natvis | |
run: | | |
cmd /c "$env:VSDevCmd" "&" msbuild /m /clp:ForceConsoleColor "$env:msbuild_config_props" /p:Deployment=${{ matrix.Deployment }} natvis\cppwinrtvisualizer.sln | |
build-msvc-nuget-test: | |
name: 'Build nuget test' | |
needs: test-msvc-cppwinrt-build | |
strategy: | |
matrix: | |
arch: [x86, x64] | |
config: [Release] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fetch cppwinrt executables | |
uses: actions/download-artifact@v3 | |
with: | |
name: msvc-build-${{ matrix.arch }}-${{ matrix.config }}-bin | |
path: _build/${{ matrix.arch }}/${{ matrix.config }}/ | |
- name: Download nuget | |
run: | | |
mkdir ".\.nuget" | |
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile ".\.nuget\nuget.exe" | |
- name: Find VsDevCmd.bat | |
run: | | |
$VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat | |
if (!$VSDevCmd) { exit 1 } | |
echo "Using VSDevCmd: ${VSDevCmd}" | |
Add-Content $env:GITHUB_ENV "VSDevCmd=$VSDevCmd" | |
- name: Prepare build flags | |
run: | | |
$target_configuration = "${{ matrix.config }}" | |
$target_platform = "${{ matrix.arch }}" | |
$target_version = "1.2.3.4" | |
Add-Content $env:GITHUB_ENV "msbuild_config_props=/p:Configuration=$target_configuration,Platform=$target_platform,CppWinRTBuildVersion=$target_version" | |
- name: Restore nuget packages | |
run: | | |
cmd /c "$env:VSDevCmd" "&" nuget restore test\nuget\NugetTest.sln | |
- name: Run cppwinrt to build projection | |
run: | | |
$target_configuration = "${{ matrix.config }}" | |
$target_platform = "${{ matrix.arch }}" | |
& "_build\$target_platform\$target_configuration\cppwinrt.exe" -in local -out _build\$target_platform\$target_configuration -verbose | |
- name: Run nuget test | |
run: | | |
cmd /c "$env:VSDevCmd" "&" msbuild /m /clp:ForceConsoleColor "$env:msbuild_config_props" test\nuget\NugetTest.sln | |
if ($LastExitCode -ne 0) { | |
echo "::warning::nuget test failed" | |
} | |
# FIXME: This build was failing from the start | |
exit 0 | |
build-nuget: | |
name: Build nuget package with MSVC | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Package | |
run: | | |
$VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat | |
if (!$VSDevCmd) { exit 1 } | |
echo "Using VSDevCmd: ${VSDevCmd}" | |
cmd /c "${VSDevCmd}" "&" nuget.exe restore cppwinrt.sln | |
cmd /c "${VSDevCmd}" "&" build_nuget.cmd | |
if (!(Test-Path "*.nupkg")) { | |
echo "::error::Output nuget package not found!" | |
exit 1 | |
} | |
- name: Upload nuget package artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: package | |
path: "*.nupkg" |