diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2018-10-06 18:09:56 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-10-14 16:01:22 +0100 |
commit | 7bdb39668bd2efd579d94e7d69a0b429e026499b (patch) | |
tree | 8b2507af902dcfec0381302c4e3dc4994feb809a | |
parent | a0a0c244e2a062ceba357f05d4852cd063f0b0cd (diff) | |
download | meson-7bdb39668bd2efd579d94e7d69a0b429e026499b.zip meson-7bdb39668bd2efd579d94e7d69a0b429e026499b.tar.gz meson-7bdb39668bd2efd579d94e7d69a0b429e026499b.tar.bz2 |
Add an azure-pipelines.yml
v1:
Add an azure-pipelines.yml
Don't check source line endings if autocrlf is on
Handle origin-only refs in skip_ci
Add .py to PATHEXT for the benefit of test_find_program()
Publish logs as build artifacts and publish test results
v2:
Use .gitattributes to override autocrlf
Move tmpdir, so it's not a subdir of source directory, otherwise it gets
included in line-ending checks.
Use serial build numbers, rather than date.dailybuildnumber
Workaround for #3239 is no longer needed now a fix has been commited
Tweak test results and artefact naming
Wait for MS-MPI installers to complete
Publish test results even if tests had an error
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | azure-pipelines.yml | 49 | ||||
-rw-r--r-- | ci/azure-steps.yml | 82 | ||||
-rwxr-xr-x | skip_ci.py | 4 |
4 files changed, 136 insertions, 1 deletions
diff --git a/.gitattributes b/.gitattributes index de66d2b..5c53af9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,3 @@ .gitignore export-ignore .gitattributes export-ignore - +* text eol=lf diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..8c36abd --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,49 @@ +name: $(BuildID) + +trigger: + branches: + include: + - 'master' + +variables: + MESON_FIXED_NINJA: 1 + CI: 1 + +jobs: +#- job: vs2015 +# pool: +# vmImage: vs2015-win2012r2 +# +# strategy: +# maxParallel: 10 +# matrix: +# vc2015x86ninja: +# arch: x86 +# compiler: msvc2015 +# backend: ninja +# vc2015x86vs: +# arch: x86 +# compiler: msvc2015 +# backend: vs2015 +# +# steps: +# - template: ci/azure-steps.yml + +- job: vs2017 + pool: + vmImage: VS2017-Win2016 + + strategy: + maxParallel: 10 + matrix: + vc2017x64ninja: + arch: x64 + compiler: msvc2017 + backend: ninja + vc2017x64vs: + arch: x64 + compiler: msvc2017 + backend: vs2017 + + steps: + - template: ci/azure-steps.yml diff --git a/ci/azure-steps.yml b/ci/azure-steps.yml new file mode 100644 index 0000000..6126115 --- /dev/null +++ b/ci/azure-steps.yml @@ -0,0 +1,82 @@ +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 + + # add downloads to PATH + $env:Path = "$env:SYSTEM_WORKFOLDER;$env:Path" + + # import visual studio variables + Set-PSRepository -Name PSGallery -InstallationPolicy Trusted + Install-Module Pscx -Scope CurrentUser -AllowClobber + Install-Module VSSetup -Scope CurrentUser + $vsver = $env:compiler.Replace('msvc', '') + Import-VisualStudioVars -VisualStudioVersion $vsver -Architecture $(arch) + + 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) + +- powershell: | + # after publishing test results, even if some failed + # exit with the test status + exit $(test_status) @@ -54,9 +54,13 @@ def main(): help='Branch push is targeted to') parser.add_argument('--is-pull-env', required=True, help='Variable set if it is a PR') + parser.add_argument('--base-branch-origin', action='store_true', + help='Base branch reference is only in origin remote') args = parser.parse_args() check_pr(args.is_pull_env) base = get_base_branch(args.base_branch_env) + if args.base_branch_origin: + base = 'origin/' + base if all(is_documentation(f) for f in get_git_files(base)): print("Don't run CI for documentation-only changes, add '[skip ci]' to commit title.") print('See http://mesonbuild.com/Contributing.html#skipping-integration-tests') |