-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
89 lines (75 loc) · 2.37 KB
/
azure-pipelines.yml
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
89
# https://aka.ms/yaml
# Much of this is from
# https://nbsoftsolutions.com/blog/azure-pipelines-for-rust-projects
trigger:
branches:
include:
- master
tags:
include: ['*']
strategy:
matrix:
linux:
target: 'x86_64-unknown-linux-gnu'
imageName: 'ubuntu-latest'
mac:
target: 'x86_64-apple-darwin'
imageName: 'macos-10.14'
windows:
target: 'x86_64-pc-windows-msvc'
imageName: 'windows-2019'
pool:
vmImage: $(imageName)
steps:
- bash: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
condition: not(eq( variables['Agent.OS'], 'Windows_NT' ))
displayName: 'Install Rust (Mac/Linux)'
- powershell: |
$url = "https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe"
$outpath = "$PSScriptRoot/rustup-init.exe"
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $outpath)
Start-Process -Filepath $outpath
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: 'Install Rust (Windows)'
- bash: |
cargo build --release --target $TARGET
displayName: 'Build'
- 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"
- task: CopyFiles@2
displayName: Copy assets
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
contents: |
prj
prj.exe
targetFolder: '$(Build.BinariesDirectory)/prj'
- task: ArchiveFiles@2
displayName: Gather assets
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/prj'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/prj-$(build.my_tag)-$(TARGET).tar.gz'
- task: GithubRelease@0
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
gitHubConnection: 'github.com_jordwest'
repositoryName: 'jordwest/prj'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(build.my_tag)'
assets: '$(Build.ArtifactStagingDirectory)/prj-$(build.my_tag)-$(TARGET).tar.gz'
title: '$(build.my_tag) - $(build.date)'
assetUploadMode: 'replace'
addChangeLog: false