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.

azure-pipelines.yml 5.9KB

4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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.39:
  22. imageName: 'ubuntu-16.04'
  23. rustup_toolchain: 1.39.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% --default-host x86_64-pc-windows-msvc
  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. set CARGO_HOME=%USERPROFILE%\.cargo
  71. curl -sSf -o rustup-init.exe https://win.rustup.rs
  72. rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% --default-host x86_64-pc-windows-msvc
  73. set PATH=%PATH%;%USERPROFILE%\.cargo\bin
  74. echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
  75. displayName: Windows install rust
  76. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  77. - script: |
  78. rustup target add $TARGET
  79. cargo build --release --target $TARGET
  80. condition: ne( variables['Agent.OS'], 'Windows_NT' )
  81. displayName: Build
  82. - script: |
  83. rustup target add %TARGET%
  84. cargo build --release --target %TARGET%
  85. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  86. displayName: Build on Windows
  87. - task: CopyFiles@2
  88. displayName: Copy assets
  89. condition: ne( variables['Agent.OS'], 'Windows_NT' )
  90. inputs:
  91. sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
  92. contents: zola
  93. targetFolder: '$(Build.BinariesDirectory)/'
  94. - task: CopyFiles@2
  95. displayName: Copy assets on Windows
  96. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  97. inputs:
  98. sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
  99. contents: zola.exe
  100. targetFolder: '$(Build.BinariesDirectory)/'
  101. - task: ArchiveFiles@2
  102. displayName: Gather assets
  103. condition: ne( variables['Agent.OS'], 'Windows_NT' )
  104. inputs:
  105. rootFolderOrFile: '$(Build.BinariesDirectory)/zola'
  106. archiveType: 'tar'
  107. tarCompression: 'gz'
  108. archiveFile: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).tar.gz'
  109. - task: ArchiveFiles@2
  110. displayName: Gather assets
  111. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  112. inputs:
  113. rootFolderOrFile: '$(Build.BinariesDirectory)/zola.exe'
  114. archiveType: 'zip'
  115. archiveFile: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).zip'
  116. - task: GithubRelease@0
  117. condition: ne( variables['Agent.OS'], 'Windows_NT' )
  118. inputs:
  119. gitHubConnection: 'zola'
  120. repositoryName: 'getzola/zola'
  121. action: 'edit'
  122. target: '$(build.sourceVersion)'
  123. tagSource: 'manual'
  124. tag: '$(Build.SourceBranchName)'
  125. assets: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).tar.gz'
  126. title: '$(Build.SourceBranchName)'
  127. assetUploadMode: 'replace'
  128. addChangeLog: true
  129. - task: GithubRelease@0
  130. condition: eq( variables['Agent.OS'], 'Windows_NT' )
  131. inputs:
  132. gitHubConnection: 'zola'
  133. repositoryName: 'getzola/zola'
  134. action: 'edit'
  135. target: '$(build.sourceVersion)'
  136. tagSource: 'manual'
  137. tag: '$(Build.SourceBranchName)'
  138. assets: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).zip'
  139. title: '$(Build.SourceBranchName)'
  140. assetUploadMode: 'replace'
  141. addChangeLog: true