You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
5.1KB

  1. trigger:
  2. branches:
  3. include: ['*']
  4. tags:
  5. include: ['*']
  6. stages:
  7. - stage: Tests
  8. jobs:
  9. - job:
  10. strategy:
  11. matrix:
  12. windows-stable:
  13. imageName: 'vs2017-win2016'
  14. rustup_toolchain: stable
  15. mac-stable:
  16. imageName: 'macos-10.14'
  17. rustup_toolchain: stable
  18. linux-stable:
  19. imageName: 'ubuntu-16.04'
  20. rustup_toolchain: stable
  21. linux-1.35:
  22. imageName: 'ubuntu-16.04'
  23. rustup_toolchain: 1.35.0
  24. pool:
  25. vmImage: $(imageName)
  26. steps:
  27. - script: |
  28. curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
  29. echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
  30. displayName: Install rust
  31. condition: ne( variables['Agent.OS'], 'Windows_NT' )
  32. - script: |
  33. curl -sSf -o rustup-init.exe https://win.rustup.rs
  34. rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
  35. echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
  36. displayName: Windows install rust
  37. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  38. - script: cargo build --all
  39. displayName: Cargo build
  40. - script: cargo test --all
  41. displayName: Cargo test
  42. - stage: Release
  43. dependsOn: Tests
  44. condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
  45. jobs:
  46. - job:
  47. strategy:
  48. matrix:
  49. windows-stable:
  50. imageName: 'vs2017-win2016'
  51. rustup_toolchain: stable
  52. target: 'x86_64-pc-windows-msvc'
  53. mac-stable:
  54. imageName: 'macos-10.14'
  55. rustup_toolchain: stable
  56. target: 'x86_64-apple-darwin'
  57. linux-stable:
  58. imageName: 'ubuntu-16.04'
  59. rustup_toolchain: stable
  60. target: 'x86_64-unknown-linux-gnu'
  61. pool:
  62. vmImage: $(imageName)
  63. steps:
  64. - script: |
  65. curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
  66. echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
  67. displayName: Install rust
  68. condition: ne( variables['Agent.OS'], 'Windows_NT' )
  69. - script: |
  70. curl -sSf -o rustup-init.exe https://win.rustup.rs
  71. rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
  72. echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
  73. displayName: Windows install rust
  74. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  75. - script: |
  76. rustup target add $TARGET
  77. cargo build --release --target $TARGET
  78. condition: ne( variables['Agent.OS'], 'Windows_NT' )
  79. displayName: Build
  80. - script: |
  81. rustup target add %TARGET%
  82. cargo build --release --target %TARGET%
  83. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  84. displayName: Build on Windows
  85. - task: CopyFiles@2
  86. displayName: Copy assets
  87. condition: ne( variables['Agent.OS'], 'Windows_NT' )
  88. inputs:
  89. sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
  90. contents: zola
  91. targetFolder: '$(Build.BinariesDirectory)/'
  92. - task: CopyFiles@2
  93. displayName: Copy assets on Windows
  94. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  95. inputs:
  96. sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
  97. contents: zola.exe
  98. targetFolder: '$(Build.BinariesDirectory)/'
  99. - task: ArchiveFiles@2
  100. displayName: Gather assets
  101. condition: ne( variables['Agent.OS'], 'Windows_NT' )
  102. inputs:
  103. rootFolderOrFile: '$(Build.BinariesDirectory)/zola'
  104. archiveType: 'tar'
  105. tarCompression: 'gz'
  106. archiveFile: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).tar.gz'
  107. - task: ArchiveFiles@2
  108. displayName: Gather assets
  109. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  110. inputs:
  111. rootFolderOrFile: '$(Build.BinariesDirectory)/zola.exe'
  112. archiveType: 'tar'
  113. tarCompression: 'gz'
  114. archiveFile: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).tar.gz'
  115. - task: GithubRelease@0
  116. inputs:
  117. gitHubConnection: 'zola'
  118. repositoryName: 'getzola/zola'
  119. action: 'edit'
  120. target: '$(build.sourceVersion)'
  121. tagSource: 'manual'
  122. tag: '$(Build.SourceBranchName)'
  123. assets: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).tar.gz'
  124. title: '$(Build.SourceBranchName)'
  125. assetUploadMode: 'replace'
  126. addChangeLog: true