|
| 1 | +steps: |
| 2 | +- powershell: | |
| 3 | + # test_find_program exercises some behaviour which relies on .py being in PATHEXT |
| 4 | + $env:PATHEXT += ';.py' |
| 5 | +
|
| 6 | + where.exe python |
| 7 | +
|
| 8 | + python ./skip_ci.py --base-branch-env=SYSTEM_PULLREQUEST_TARGETBRANCH --is-pull-env=SYSTEM_PULLREQUEST_PULLREQUESTID --base-branch-origin |
| 9 | + if ($LastExitCode -ne 0) { |
| 10 | + throw ('error in skip_ci.py') |
| 11 | + } |
| 12 | +
|
| 13 | + # remove MinGW from path, so we don't find gfortran and try to use it |
| 14 | + $env:Path = ($env:Path.Split(';') | Where-Object { $_ -notlike '*mingw*' }) -join ';' |
| 15 | +
|
| 16 | + # download and install prerequisites |
| 17 | + function DownloadFile([String] $Source, [String] $Destination) { |
| 18 | + $retries = 10 |
| 19 | + for ($i = 1; $i -le $retries; $i++) { |
| 20 | + try { |
| 21 | + (New-Object net.webclient).DownloadFile($Source, $Destination) |
| 22 | + break # succeeded |
| 23 | + } catch [net.WebException] { |
| 24 | + if ($i -eq $retries) { |
| 25 | + throw # fail on last retry |
| 26 | + } |
| 27 | + $backoff = (10 * $i) # backoff 10s, 20s, 30s... |
| 28 | + echo ('{0}: {1}' -f $Source, $_.Exception.Message) |
| 29 | + echo ('Retrying in {0}s...' -f $backoff) |
| 30 | + Start-Sleep -m ($backoff * 1000) |
| 31 | + } |
| 32 | + } |
| 33 | + } |
| 34 | +
|
| 35 | + DownloadFile -Source 'https://github.com/mesonbuild/cidata/raw/master/ninja.exe' -Destination $(System.WorkFolder)\ninja.exe |
| 36 | + DownloadFile -Source 'http://nirbheek.in/files/binaries/pkg-config/win32/pkg-config.exe' -Destination $(System.WorkFolder)\pkg-config.exe |
| 37 | + DownloadFile -Source 'https://download.microsoft.com/download/D/B/B/DBB64BA1-7B51-43DB-8BF1-D1FB45EACF7A/msmpisdk.msi' -Destination msmpisdk.msi |
| 38 | + DownloadFile -Source 'https://download.microsoft.com/download/D/B/B/DBB64BA1-7B51-43DB-8BF1-D1FB45EACF7A/MSMpiSetup.exe' -Destination MSMpiSetup.exe |
| 39 | + Start-Process msiexec.exe -ArgumentList '/i msmpisdk.msi /quiet' -Wait |
| 40 | + Start-Process .\MSMpiSetup.exe -ArgumentList '-unattend -full' -Wait |
| 41 | +
|
| 42 | + # add downloads to PATH |
| 43 | + $env:Path = "$env:SYSTEM_WORKFOLDER;$env:Path" |
| 44 | +
|
| 45 | + # import visual studio variables |
| 46 | + Set-PSRepository -Name PSGallery -InstallationPolicy Trusted |
| 47 | + Install-Module Pscx -Scope CurrentUser -AllowClobber |
| 48 | + Install-Module VSSetup -Scope CurrentUser |
| 49 | + $vsver = $env:compiler.Replace('msvc', '') |
| 50 | + Import-VisualStudioVars -VisualStudioVersion $vsver -Architecture $(arch) |
| 51 | +
|
| 52 | + if ($env:backend -eq 'ninja') { |
| 53 | + ninja --version |
| 54 | + } else { |
| 55 | + MSBuild /version |
| 56 | + } |
| 57 | +
|
| 58 | + python run_tests.py --backend $(backend) |
| 59 | +
|
| 60 | + echo "##vso[task.setvariable variable=test_status]$LastExitCode" |
| 61 | +
|
| 62 | + continueOnError: true |
| 63 | + |
| 64 | +- task: PublishTestResults@2 |
| 65 | + inputs: |
| 66 | + testResultsFiles: meson-test-run.xml |
| 67 | + testRunTitle: $(System.JobName) |
| 68 | + publishRunAttachments: true |
| 69 | + |
| 70 | +- task: CopyFiles@2 |
| 71 | + inputs: |
| 72 | + contents: 'meson-test-run.*' |
| 73 | + targetFolder: $(Build.ArtifactStagingDirectory) |
| 74 | + |
| 75 | +- task: PublishBuildArtifacts@1 |
| 76 | + inputs: |
| 77 | + artifactName: $(System.JobName) |
| 78 | + |
| 79 | +- powershell: | |
| 80 | + # after publishing test results, even if some failed |
| 81 | + # exit with the test status |
| 82 | + exit $(test_status) |
0 commit comments