run.ps1 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. python ./skip_ci.py --base-branch-env=SYSTEM_PULLREQUEST_TARGETBRANCH --is-pull-env=SYSTEM_PULLREQUEST_PULLREQUESTID --base-branch-origin
  2. if ($LastExitCode -ne 0) {
  3. exit 0
  4. }
  5. # remove Chocolately, MinGW, Strawberry Perl from path, so we don't find gcc/gfortran and try to use it
  6. $env:Path = ($env:Path.Split(';') | Where-Object { $_ -notmatch 'mingw|Strawberry|Chocolatey' }) -join ';'
  7. # Rust puts its shared stdlib in a secret place, but it is needed to run tests.
  8. $env:Path += ";$HOME/.rustup/toolchains/stable-x86_64-pc-windows-msvc/bin"
  9. # Set the CI env var for the meson test framework
  10. $env:CI = '1'
  11. # download and install prerequisites
  12. function DownloadFile([String] $Source, [String] $Destination) {
  13. $retries = 10
  14. echo "Downloading $Source"
  15. for ($i = 1; $i -le $retries; $i++) {
  16. try {
  17. (New-Object net.webclient).DownloadFile($Source, $Destination)
  18. break # succeeded
  19. } catch [net.WebException] {
  20. if ($i -eq $retries) {
  21. throw # fail on last retry
  22. }
  23. $backoff = (10 * $i) # backoff 10s, 20s, 30s...
  24. echo ('{0}: {1}' -f $Source, $_.Exception.Message)
  25. echo ('Retrying in {0}s...' -f $backoff)
  26. Start-Sleep -m ($backoff * 1000)
  27. }
  28. }
  29. }
  30. if ($env:backend -eq 'ninja') { $dmd = $true } else { $dmd = $false }
  31. DownloadFile -Source https://github.com/mesonbuild/cidata/releases/download/ci2/ci_data.zip -Destination $env:AGENT_WORKFOLDER\ci_data.zip
  32. echo "Extracting ci_data.zip"
  33. Expand-Archive $env:AGENT_WORKFOLDER\ci_data.zip -DestinationPath $env:AGENT_WORKFOLDER\ci_data
  34. & "$env:AGENT_WORKFOLDER\ci_data\install.ps1" -Arch $env:arch -Compiler $env:compiler -Boost $true -DMD $dmd
  35. echo "=== PATH BEGIN ==="
  36. echo ($env:Path).Replace(';',"`n")
  37. echo "=== PATH END ==="
  38. echo ""
  39. $progs = @("python","ninja","pkg-config","cl","rc","link")
  40. foreach ($prog in $progs) {
  41. echo ""
  42. echo "Locating ${prog}:"
  43. where.exe $prog
  44. }
  45. echo ""
  46. echo "Ninja / MSBuld version:"
  47. if ($env:backend -eq 'ninja') {
  48. ninja --version
  49. } else {
  50. MSBuild /version
  51. }
  52. echo ""
  53. echo "Python version:"
  54. python --version
  55. # Needed for running unit tests in parallel.
  56. echo ""
  57. python -m pip --disable-pip-version-check install --upgrade pefile pytest-xdist jsonschema
  58. echo ""
  59. echo "=== Start running tests ==="
  60. # Starting from VS2019 Powershell(?) will fail the test run
  61. # if it prints anything to stderr. Python's test runner
  62. # does that by default so we need to forward it.
  63. cmd /c 'python 2>&1' run_tests.py --backend $env:backend