steps: - powershell: | # test_find_program exercises some behaviour which relies on .py being in PATHEXT $env:PATHEXT += ';.py' where.exe python python ./skip_ci.py --base-branch-env=SYSTEM_PULLREQUEST_TARGETBRANCH --is-pull-env=SYSTEM_PULLREQUEST_PULLREQUESTID --base-branch-origin if ($LastExitCode -ne 0) { throw ('error in skip_ci.py') } # remove MinGW from path, so we don't find gfortran and try to use it $env:Path = ($env:Path.Split(';') | Where-Object { $_ -notlike '*mingw*' }) -join ';' # download and install prerequisites function DownloadFile([String] $Source, [String] $Destination) { $retries = 10 for ($i = 1; $i -le $retries; $i++) { try { (New-Object net.webclient).DownloadFile($Source, $Destination) break # succeeded } catch [net.WebException] { if ($i -eq $retries) { throw # fail on last retry } $backoff = (10 * $i) # backoff 10s, 20s, 30s... echo ('{0}: {1}' -f $Source, $_.Exception.Message) echo ('Retrying in {0}s...' -f $backoff) Start-Sleep -m ($backoff * 1000) } } } DownloadFile -Source 'https://github.com/mesonbuild/cidata/raw/master/ninja.exe' -Destination $(System.WorkFolder)\ninja.exe DownloadFile -Source 'http://nirbheek.in/files/binaries/pkg-config/win32/pkg-config.exe' -Destination $(System.WorkFolder)\pkg-config.exe DownloadFile -Source 'https://download.microsoft.com/download/D/B/B/DBB64BA1-7B51-43DB-8BF1-D1FB45EACF7A/msmpisdk.msi' -Destination msmpisdk.msi DownloadFile -Source 'https://download.microsoft.com/download/D/B/B/DBB64BA1-7B51-43DB-8BF1-D1FB45EACF7A/MSMpiSetup.exe' -Destination MSMpiSetup.exe Start-Process msiexec.exe -ArgumentList '/i msmpisdk.msi /quiet' -Wait Start-Process .\MSMpiSetup.exe -ArgumentList '-unattend -full' -Wait # import ms-mpi env vars (set by installer) foreach ($p in "MSMPI_INC", "MSMPI_LIB32", "MSMPI_LIB64") { $v = [Environment]::GetEnvironmentVariable($p, "Machine") Set-Content "env:$p" "$v" } # add downloads to PATH $env:Path = "$env:SYSTEM_WORKFOLDER;$env:Path" $origPath = $env:Path # import visual studio variables if ($env:compiler -eq 'msvc2015') { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" } else { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" } ## ask cmd.exe to output the environment table after the batch file completes $tempFile = [IO.Path]::GetTempFileName() cmd /c " `"$vcvars`" $env:arch && set > `"$tempFile`" " ## go through the environment variables in the temp file. ## for each of them, set the variable in our local environment. Get-Content $tempFile | Foreach-Object { if($_ -match "^(.*?)=(.*)$") { Set-Content "env:\$($matches[1])" $matches[2] } } Remove-Item $tempFile if ($env:compiler -eq 'clang-cl') { # drop visual studio from PATH # (but leave INCLUDE, LIB and WindowsSdkDir environment variables set) $env:Path = $origPath # install llvm for clang-cl builds DownloadFile -Source 'http://releases.llvm.org/7.0.0/LLVM-7.0.0-win64.exe' -Destination LLVM-7.0.0-win64.exe Start-Process .\LLVM-7.0.0-win64.exe -ArgumentList '/S' -Wait $env:Path = "C:\Program Files\LLVM\bin;$env:Path" $env:CC = "clang-cl" $env:CXX = "clang-cl" # and use Windows SDK tools $env:Path = "$env:WindowsSdkDir\bin\$env:Arch;$env:Path" } # add .NET framework tools to path for resgen for C# tests # (always use 32-bit tool, as there doesn't seem to be a 64-bit tool) if ((Get-Command "resgen.exe" -ErrorAction SilentlyContinue) -eq $null) { $env:Path = "$env:WindowsSDK_ExecutablePath_x86;$env:Path" } if ($env:backend -eq 'ninja') { ninja --version } else { MSBuild /version } python run_tests.py --backend $(backend) echo "##vso[task.setvariable variable=test_status]$LastExitCode" continueOnError: true - task: PublishTestResults@2 inputs: testResultsFiles: meson-test-run.xml testRunTitle: $(System.JobName) publishRunAttachments: true - task: CopyFiles@2 inputs: contents: 'meson-test-run.*' targetFolder: $(Build.ArtifactStagingDirectory) - task: PublishBuildArtifacts@1 inputs: artifactName: $(System.JobName) # publishing artifacts from PRs from a fork is currently blocked condition: eq(variables['system.pullrequest.isfork'], false) - powershell: | # after publishing test results, even if some failed # exit with the test status exit $(test_status)