-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathazure-pipelines.yml
179 lines (172 loc) · 5.95 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
trigger:
branches:
include:
- refs/heads/master
- refs/tags/*
jobs:
- job: run_rustfmt
displayName: "Run rust fmt"
pool:
vmImage: ubuntu-16.04
steps:
- template: ci/azure-install-rust.yml
- script: |
rustup component add rustfmt
displayName: Install rustfmt
- script: |
cargo fmt --all -- --check
displayName: Check formatting
- job: run_cargo_test
displayName: "cargo test"
strategy:
matrix:
Linux:
vmImage: ubuntu-16.04
MacOS:
vmImage: macOS-latest
Windows:
vmImage: windows-2019
pool:
vmImage: $(vmImage)
steps:
- template: ci/azure-install-rust.yml
- script: cargo test
displayName: Cargo test
- job: create_linux_binary
displayName: "Create release binaries for Linux"
pool:
vmImage: ubuntu-16.04
steps:
- template: ci/azure-install-rust.yml
- script: rustup target add x86_64-unknown-linux-musl
displayName: Add unknown linux target
- script: |
sudo apt update -y
sudo apt install musl-tools -y
displayName: "Install musl-tools"
- script: cargo build --target x86_64-unknown-linux-musl --release
displayName: cargo build
- template: ci/azure-publish-artifact.yml
parameters:
artifacts: target/x86_64-unknown-linux-musl/release
name: dist_linux
- job: create_windows_binary
displayName: "Create release binaries for Windows x86_64"
pool:
vmImage: windows-2019
steps:
- template: ci/azure-install-rust.yml
- script: cargo build --release
displayName: cargo build
- template: ci/azure-publish-artifact.yml
parameters:
name: dist_windows
- job: create_windows_binary_i686_pc_windows_msvc
displayName: "Create release binaries for Windows i686"
pool:
vmImage: windows-2019
steps:
- template: ci/azure-install-rust.yml
parameters:
rust_version: stable-i686-pc-windows-msvc
- script: cargo build --release
displayName: cargo build
- template: ci/azure-publish-artifact.yml
parameters:
name: dist_windows_i686
- job: create_macOS_binary
displayName: "Create release binaries for MacOS"
pool:
vmImage: macOS-latest
steps:
- template: ci/azure-install-rust.yml
- script: cargo build --release
env:
MACOSX_DEPLOYMENT_TARGET: 10.7
displayName: cargo build
- template: ci/azure-publish-artifact.yml
parameters:
name: dist_macos
- job: deploy_release
displayName: "Deploy release"
dependsOn:
- run_rustfmt
- run_cargo_test
- create_linux_binary
- create_windows_binary
- create_windows_binary_i686_pc_windows_msvc
- create_macOS_binary
steps:
- task: DownloadPipelineArtifact@0
displayName: "Download release - Linux"
inputs:
artifactName: dist_linux
targetPath: $(System.DefaultWorkingDirectory)/linux
- task: ArchiveFiles@2
displayName: Gather assets Linux
inputs:
rootFolderOrFile: $(System.DefaultWorkingDirectory)/linux/qrgen
archiveType: "zip"
archiveFile: $(System.DefaultWorkingDirectory)/x86_64-unknown-linux-musl.zip
- task: DownloadPipelineArtifact@0
displayName: "Download release - Windows x86_64"
inputs:
artifactName: dist_windows
targetPath: $(System.DefaultWorkingDirectory)/windows
- task: ArchiveFiles@2
displayName: Gather assets Windows
inputs:
rootFolderOrFile: $(System.DefaultWorkingDirectory)/windows/qrgen.exe
archiveType: "zip"
archiveFile: $(System.DefaultWorkingDirectory)/x86_64-pc-windows-msvc.zip
- task: DownloadPipelineArtifact@0
displayName: "Download release - Windows i686"
inputs:
artifactName: dist_windows_i686
targetPath: $(System.DefaultWorkingDirectory)/windows_i686
- task: ArchiveFiles@2
displayName: Gather assets windows_i686
inputs:
rootFolderOrFile: $(System.DefaultWorkingDirectory)/windows_i686/qrgen.exe
archiveType: "zip"
archiveFile: $(System.DefaultWorkingDirectory)/i686-pc-windows-msvc.zip
- task: DownloadPipelineArtifact@0
displayName: "Download release - MacOS"
inputs:
artifactName: dist_macos
targetPath: $(System.DefaultWorkingDirectory)/macos
- task: ArchiveFiles@2
displayName: Gather assets MacOS
inputs:
rootFolderOrFile: $(System.DefaultWorkingDirectory)/macos/qrgen
archiveType: "zip"
archiveFile: $(System.DefaultWorkingDirectory)/x86_64-apple-darwin.zip
- script: dir
workingDirectory: $(System.DefaultWorkingDirectory)
displayName: List contents of a folder
- script: |
DATE="$(date +%Y-%m-%d)"
echo "##vso[task.setvariable variable=build.date]$DATE"
displayName: "Create date variable"
- script: |
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 my tag variable"
- script: dir
workingDirectory: $(System.DefaultWorkingDirectory)
displayName: List contents of a folder
- task: GithubRelease@0
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
gitHubConnection: "ian-hamlin-pat"
repositoryName: "ian-hamlin/qrgen"
action: "edit"
target: "$(build.sourceVersion)"
tagSource: "manual"
tag: "$(build.my_tag)"
assets: "$(System.DefaultWorkingDirectory)/*.zip"
title: "$(build.my_tag) - $(build.date)"
assetUploadMode: "replace"
addChangeLog: false