Browse Source

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
Jon Turney 1 year ago
parent
commit
7bdb39668b
No account linked to committer's email address
4 changed files with 136 additions and 1 deletions
  1. 1
    1
      .gitattributes
  2. 49
    0
      azure-pipelines.yml
  3. 82
    0
      ci/azure-steps.yml
  4. 4
    0
      skip_ci.py

+ 1
- 1
.gitattributes View File

@@ -1,3 +1,3 @@
1 1
 .gitignore export-ignore
2 2
 .gitattributes export-ignore
3
-
3
+* text eol=lf

+ 49
- 0
azure-pipelines.yml View File

@@ -0,0 +1,49 @@
1
+name: $(BuildID)
2
+
3
+trigger:
4
+  branches:
5
+    include:
6
+    - 'master'
7
+
8
+variables:
9
+  MESON_FIXED_NINJA: 1
10
+  CI: 1
11
+
12
+jobs:
13
+#- job: vs2015
14
+#  pool:
15
+#    vmImage: vs2015-win2012r2
16
+#
17
+#  strategy:
18
+#    maxParallel: 10
19
+#    matrix:
20
+#        vc2015x86ninja:
21
+#          arch: x86
22
+#          compiler: msvc2015
23
+#          backend: ninja
24
+#        vc2015x86vs:
25
+#          arch: x86
26
+#          compiler: msvc2015
27
+#          backend: vs2015
28
+#
29
+#  steps:
30
+#  - template: ci/azure-steps.yml
31
+
32
+- job: vs2017
33
+  pool:
34
+    vmImage: VS2017-Win2016
35
+
36
+  strategy:
37
+    maxParallel: 10
38
+    matrix:
39
+        vc2017x64ninja:
40
+          arch: x64
41
+          compiler: msvc2017
42
+          backend: ninja
43
+        vc2017x64vs:
44
+          arch: x64
45
+          compiler: msvc2017
46
+          backend: vs2017
47
+
48
+  steps:
49
+  - template: ci/azure-steps.yml

+ 82
- 0
ci/azure-steps.yml View File

@@ -0,0 +1,82 @@
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)

+ 4
- 0
skip_ci.py View File

@@ -54,9 +54,13 @@ def main():
54 54
                             help='Branch push is targeted to')
55 55
         parser.add_argument('--is-pull-env', required=True,
56 56
                             help='Variable set if it is a PR')
57
+        parser.add_argument('--base-branch-origin', action='store_true',
58
+                            help='Base branch reference is only in origin remote')
57 59
         args = parser.parse_args()
58 60
         check_pr(args.is_pull_env)
59 61
         base = get_base_branch(args.base_branch_env)
62
+        if args.base_branch_origin:
63
+            base = 'origin/' + base
60 64
         if all(is_documentation(f) for f in get_git_files(base)):
61 65
             print("Don't run CI for documentation-only changes, add '[skip ci]' to commit title.")
62 66
             print('See http://mesonbuild.com/Contributing.html#skipping-integration-tests')

Loading…
Cancel
Save