|
| 1 | +name: MSVC Tests |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + test-cppwinrt: |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + arch: [x86, x64, arm64] |
| 13 | + config: [Debug, Release] |
| 14 | + exclude: |
| 15 | + - arch: arm64 |
| 16 | + config: Debug |
| 17 | + runs-on: windows-latest |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Test all |
| 22 | + run: | |
| 23 | + $VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat |
| 24 | + if (!$VSDevCmd) { return 1 } |
| 25 | + echo "Using VSDevCmd: ${VSDevCmd}" |
| 26 | + cmd /c "${VSDevCmd}" "&" build_test_all.cmd ${{ matrix.arch }} ${{ matrix.config }} |
| 27 | +
|
| 28 | + - name: Upload test log |
| 29 | + if: matrix.arch != 'arm64' |
| 30 | + uses: actions/upload-artifact@v3 |
| 31 | + with: |
| 32 | + name: test-output-${{ matrix.arch }}-${{ matrix.config }} |
| 33 | + path: "*_results.txt" |
| 34 | + |
| 35 | + - name: Check test failure |
| 36 | + if: matrix.arch != 'arm64' |
| 37 | + run: | |
| 38 | + if (Test-Path "test_failures.txt") { |
| 39 | + Get-Content "test_failures.txt" | ForEach-Object { |
| 40 | + Write-Error "error: Test '$_' failed!" |
| 41 | + } |
| 42 | + return 1 |
| 43 | + } |
| 44 | + if (!(Test-Path "*_results.txt")) { |
| 45 | + Write-Error "error: No test output found!" |
| 46 | + return 1 |
| 47 | + } |
| 48 | +
|
| 49 | + build-nuget: |
| 50 | + runs-on: windows-latest |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v3 |
| 53 | + |
| 54 | + - name: Package |
| 55 | + run: | |
| 56 | + $VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat |
| 57 | + if (!$VSDevCmd) { return 1 } |
| 58 | + echo "Using VSDevCmd: ${VSDevCmd}" |
| 59 | + cmd /c "${VSDevCmd}" "&" nuget.exe restore cppwinrt.sln |
| 60 | + cmd /c "${VSDevCmd}" "&" build_nuget.cmd |
| 61 | + if (!(Test-Path "*.nupkg")) { |
| 62 | + Write-Error "error: Output nuget package not found!" |
| 63 | + return 1 |
| 64 | + } |
| 65 | +
|
| 66 | + - name: Upload nuget package artifact |
| 67 | + uses: actions/upload-artifact@v3 |
| 68 | + with: |
| 69 | + name: package |
| 70 | + path: "*.nupkg" |
0 commit comments