2019-07-19 08:35:31 +00:00
|
|
|
trigger:
|
|
|
|
branches:
|
|
|
|
include: ['*']
|
|
|
|
tags:
|
|
|
|
include: ['*']
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- stage: Tests
|
|
|
|
jobs:
|
|
|
|
- job:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
windows-stable:
|
2022-03-21 09:43:52 +00:00
|
|
|
imageName: 'windows-2019'
|
2019-07-19 08:35:31 +00:00
|
|
|
rustup_toolchain: stable
|
|
|
|
mac-stable:
|
2021-12-06 07:58:05 +00:00
|
|
|
imageName: 'macos-11'
|
2019-07-19 08:35:31 +00:00
|
|
|
rustup_toolchain: stable
|
|
|
|
linux-stable:
|
2020-09-27 12:15:44 +00:00
|
|
|
imageName: 'ubuntu-20.04'
|
2019-07-19 08:35:31 +00:00
|
|
|
rustup_toolchain: stable
|
2020-04-21 16:29:25 +00:00
|
|
|
linux-pinned:
|
2020-09-27 12:15:44 +00:00
|
|
|
imageName: 'ubuntu-20.04'
|
2023-01-27 21:14:36 +00:00
|
|
|
rustup_toolchain: 1.64.0
|
2019-07-19 08:35:31 +00:00
|
|
|
pool:
|
|
|
|
vmImage: $(imageName)
|
|
|
|
steps:
|
|
|
|
- script: |
|
|
|
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
|
|
|
|
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
|
|
|
|
displayName: Install rust
|
|
|
|
condition: ne( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
- script: |
|
|
|
|
curl -sSf -o rustup-init.exe https://win.rustup.rs
|
2020-02-03 20:17:20 +00:00
|
|
|
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% --default-host x86_64-pc-windows-msvc
|
2019-07-19 08:35:31 +00:00
|
|
|
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
|
|
|
|
displayName: Windows install rust
|
|
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
2021-08-18 13:32:34 +00:00
|
|
|
- script: cargo build --all --no-default-features --features=native-tls && cargo clean
|
|
|
|
displayName: Cargo build (Native TLS)
|
2019-07-19 08:35:31 +00:00
|
|
|
- script: cargo build --all
|
2021-08-18 13:32:34 +00:00
|
|
|
displayName: Cargo build (Rust TLS)
|
2019-07-19 08:35:31 +00:00
|
|
|
- script: cargo test --all
|
|
|
|
displayName: Cargo test
|
2022-11-14 20:23:30 +00:00
|
|
|
- script: cargo fmt --check
|
|
|
|
displayName: Cargo fmt
|
2023-03-19 19:06:20 +00:00
|
|
|
# - script: cargo clippy --workspace -- -Dwarnings
|
|
|
|
# displayName: Cargo clippy
|
2019-07-19 08:35:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
- stage: Release
|
|
|
|
dependsOn: Tests
|
|
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
|
|
|
jobs:
|
|
|
|
- job:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
windows-stable:
|
2022-08-14 14:39:40 +00:00
|
|
|
imageName: 'windows-2019'
|
2019-07-19 08:35:31 +00:00
|
|
|
rustup_toolchain: stable
|
|
|
|
target: 'x86_64-pc-windows-msvc'
|
|
|
|
mac-stable:
|
2021-12-08 19:42:11 +00:00
|
|
|
imageName: 'macos-11'
|
2019-07-19 08:35:31 +00:00
|
|
|
rustup_toolchain: stable
|
|
|
|
target: 'x86_64-apple-darwin'
|
|
|
|
linux-stable:
|
2021-07-19 18:12:41 +00:00
|
|
|
imageName: 'ubuntu-20.04'
|
2019-07-19 08:35:31 +00:00
|
|
|
rustup_toolchain: stable
|
|
|
|
target: 'x86_64-unknown-linux-gnu'
|
|
|
|
pool:
|
|
|
|
vmImage: $(imageName)
|
|
|
|
steps:
|
|
|
|
- script: |
|
|
|
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
|
|
|
|
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
|
|
|
|
displayName: Install rust
|
|
|
|
condition: ne( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
- script: |
|
2020-02-03 02:18:50 +00:00
|
|
|
set CARGO_HOME=%USERPROFILE%\.cargo
|
2019-07-19 08:35:31 +00:00
|
|
|
curl -sSf -o rustup-init.exe https://win.rustup.rs
|
2020-02-03 20:17:20 +00:00
|
|
|
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% --default-host x86_64-pc-windows-msvc
|
2020-02-03 02:18:50 +00:00
|
|
|
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
|
2019-07-19 08:35:31 +00:00
|
|
|
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
|
|
|
|
displayName: Windows install rust
|
|
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
rustup target add $TARGET
|
|
|
|
cargo build --release --target $TARGET
|
|
|
|
condition: ne( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
displayName: Build
|
|
|
|
- script: |
|
|
|
|
rustup target add %TARGET%
|
|
|
|
cargo build --release --target %TARGET%
|
|
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
displayName: Build on Windows
|
|
|
|
|
|
|
|
- task: CopyFiles@2
|
|
|
|
displayName: Copy assets
|
|
|
|
condition: ne( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
inputs:
|
|
|
|
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
|
|
|
|
contents: zola
|
|
|
|
targetFolder: '$(Build.BinariesDirectory)/'
|
|
|
|
- task: CopyFiles@2
|
|
|
|
displayName: Copy assets on Windows
|
|
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
inputs:
|
|
|
|
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
|
|
|
|
contents: zola.exe
|
|
|
|
targetFolder: '$(Build.BinariesDirectory)/'
|
|
|
|
|
|
|
|
- task: ArchiveFiles@2
|
|
|
|
displayName: Gather assets
|
|
|
|
condition: ne( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
inputs:
|
|
|
|
rootFolderOrFile: '$(Build.BinariesDirectory)/zola'
|
|
|
|
archiveType: 'tar'
|
|
|
|
tarCompression: 'gz'
|
|
|
|
archiveFile: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).tar.gz'
|
|
|
|
- task: ArchiveFiles@2
|
|
|
|
displayName: Gather assets
|
|
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
inputs:
|
|
|
|
rootFolderOrFile: '$(Build.BinariesDirectory)/zola.exe'
|
2019-10-01 22:30:06 +00:00
|
|
|
archiveType: 'zip'
|
|
|
|
archiveFile: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).zip'
|
2019-07-19 08:35:31 +00:00
|
|
|
|
|
|
|
- task: GithubRelease@0
|
2019-10-01 23:20:03 +00:00
|
|
|
condition: ne( variables['Agent.OS'], 'Windows_NT' )
|
2019-07-19 08:35:31 +00:00
|
|
|
inputs:
|
|
|
|
gitHubConnection: 'zola'
|
2019-09-28 18:32:36 +00:00
|
|
|
repositoryName: 'getzola/zola'
|
2019-07-19 08:35:31 +00:00
|
|
|
action: 'edit'
|
|
|
|
target: '$(build.sourceVersion)'
|
|
|
|
tagSource: 'manual'
|
|
|
|
tag: '$(Build.SourceBranchName)'
|
|
|
|
assets: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).tar.gz'
|
|
|
|
title: '$(Build.SourceBranchName)'
|
|
|
|
assetUploadMode: 'replace'
|
|
|
|
addChangeLog: true
|
2019-10-01 23:20:03 +00:00
|
|
|
- task: GithubRelease@0
|
|
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
inputs:
|
|
|
|
gitHubConnection: 'zola'
|
|
|
|
repositoryName: 'getzola/zola'
|
|
|
|
action: 'edit'
|
|
|
|
target: '$(build.sourceVersion)'
|
|
|
|
tagSource: 'manual'
|
|
|
|
tag: '$(Build.SourceBranchName)'
|
|
|
|
assets: '$(Build.ArtifactStagingDirectory)/zola-$(Build.SourceBranchName)-$(TARGET).zip'
|
|
|
|
title: '$(Build.SourceBranchName)'
|
|
|
|
assetUploadMode: 'replace'
|
2020-09-01 09:48:42 +00:00
|
|
|
addChangeLog: true
|