forked from ian-hamlin/pitufo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
153 lines (147 loc) · 5.04 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
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-10.13
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"
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_macOS_binary
displayName: "Create release binaries for MacOS"
pool:
vmImage: macOS-10.13
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_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/pitufo
archiveType: 'zip'
archiveFile: $(System.DefaultWorkingDirectory)/x86_64-unknown-linux-musl.zip
- task: DownloadPipelineArtifact@0
displayName: "Download release - Windows"
inputs:
artifactName: dist_windows
targetPath: $(System.DefaultWorkingDirectory)/windows
- task: ArchiveFiles@2
displayName: Gather assets Windows
inputs:
rootFolderOrFile: $(System.DefaultWorkingDirectory)/windows/pitufo.exe
archiveType: 'zip'
archiveFile: $(System.DefaultWorkingDirectory)/x86_64-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/pitufo
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: 'github.com_ian-hamlin'
repositoryName: 'ian-hamlin/pitufo'
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