blob: cb9ca6d6d9e1afac6d2028c93cd7e8d33e807fd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
trigger:
branches:
include: ['*']
tags:
include: ['*']
strategy:
matrix:
windows-stable:
imageName: 'vs2017-win2016'
target: 'x86_64-pc-windows-msvc'
rustup_toolchain: stable
mac-stable:
imageName: 'macOS-10.14'
target: 'x86_64-apple-darwin'
rustup_toolchain: stable
linux-stable:
imageName: 'ubuntu-16.04'
target: 'x86_64-unknown-linux-gnu'
rustup_toolchain: stable
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
rustup-init.exe -y --default-host %target% --default-toolchain %RUSTUP_TOOLCHAIN%
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Windows install rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: cargo build --release
displayName: Cargo build
- script: cargo test
displayName: Cargo test --all
- bash: |
MY_TAG="$(Build.SourceBranch)"
MY_TAG=${MY_TAG#refs/tags/}
echo $MY_TAG
echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG"
displayName: "Create tag variable"
- bash: |
DATE="$(date +%Y-%m-%d)"
echo "##vso[task.setvariable variable=build.date]$DATE"
displayName: "Create date variable"
- bash: |
echo "##vso[task.setvariable variable=build.binary_name]mft_dump.exe"
displayName: "Create date variable"
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- bash: |
echo "##vso[task.setvariable variable=build.binary_name]mft_dump"
displayName: "Create date variable"
condition: ne( variables['Agent.OS'], 'Windows_NT' )
- task: CopyFiles@2
displayName: Copy assets
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/release'
contents: |
$(build.binary_name)
targetFolder: '$(Build.BinariesDirectory)/$(build.binary_name)'
- task: ArchiveFiles@2
displayName: Gather assets
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/$(build.binary_name)'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/mft_dump-$(build.my_tag)-$(TARGET).tar.gz'
- task: GithubRelease@0
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
gitHubConnection: 'Github'
repositoryName: 'omerbenamram/mft'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(build.my_tag)'
assets: '$(Build.ArtifactStagingDirectory)/mft_dump-$(build.my_tag)-$(TARGET).tar.gz'
title: '$(build.my_tag) - $(build.date)'
assetUploadMode: 'replace'
addChangeLog: false
|