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