-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path.azure-pipelines.yml
188 lines (183 loc) · 7.92 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
180
181
182
183
184
185
186
187
188
trigger:
branches:
include: ['*']
tags:
include: ['*']
stages:
- stage: Tests
jobs:
- job:
strategy:
matrix:
windows-stable:
imageName: 'windows-latest'
rustup_toolchain: stable
target: 'x86_64-pc-windows-msvc'
mac-stable:
imageName: 'macOS-latest'
rustup_toolchain: stable
target: 'x86_64-apple-darwin'
linux-stable:
imageName: 'ubuntu-latest'
rustup_toolchain: stable
target: 'x86_64-unknown-linux-gnu'
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-toolchain %RUSTUP_TOOLCHAIN% --default-host x86_64-pc-windows-msvc
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Windows install rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: cargo build --all
displayName: Cargo build
- script: cargo test --all
displayName: Cargo test
- stage: Release
dependsOn: Tests
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
jobs:
- job:
strategy:
matrix:
windows-stable:
imageName: 'windows-latest'
rustup_toolchain: stable
target: 'x86_64-pc-windows-msvc'
mac-stable:
imageName: 'macOS-latest'
rustup_toolchain: stable
target: 'x86_64-apple-darwin'
linux-stable:
imageName: 'ubuntu-latest'
rustup_toolchain: stable
target: 'x86_64-unknown-linux-gnu'
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: |
cargo install cargo-deb
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: Install build dependencies
- script: |
set CARGO_HOME=%USERPROFILE%\.cargo
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% --default-host x86_64-pc-windows-msvc
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Windows install rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: |
rustup target add $TARGET
cargo build --release --target $TARGET
strip '$(Build.SourcesDirectory)/target/$(TARGET)/release/stringsext'
condition: ne( variables['Agent.OS'], 'Windows_NT' )
displayName: Build
- script: |
sudo apt-get install pandoc docbook5-xml docbook-xsl-ns xsltproc fop xmlto libxml2-utils xmlstarlet
cd '$(Build.SourcesDirectory)/doc/'
'./make--all'
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: Build documentation
- script: |
cargo deb --target $TARGET
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: Build deb package
- script: |
rustup target add %TARGET%
cargo build --release --target %TARGET%
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Build on Windows
- task: CopyFiles@2
displayName: Copy documentation assets
condition: eq( variables['Agent.OS'], 'Linux' )
inputs:
sourceFolder: '$(Build.SourcesDirectory)/doc/build/pdf'
contents: '*.pdf'
targetFolder: '$(Build.ArtifactStagingDirectory)/'
- task: CopyFiles@2
displayName: Copy assets
condition: ne( variables['Agent.OS'], 'Windows_NT' )
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
contents: stringsext
targetFolder: '$(Build.BinariesDirectory)/'
- task: CopyFiles@2
displayName: Copy deb package
condition: eq( variables['Agent.OS'], 'Linux' )
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/debian'
contents: '*.deb'
targetFolder: '$(Build.ArtifactStagingDirectory)/'
- task: CopyFiles@2
displayName: Copy assets on Windows
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
contents: stringsext.exe
targetFolder: '$(Build.BinariesDirectory)/'
- task: ArchiveFiles@2
displayName: Gather assets
condition: ne( variables['Agent.OS'], 'Windows_NT' )
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/stringsext'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/stringsext-$(Build.SourceBranchName)-$(TARGET).tar.gz'
- task: ArchiveFiles@2
displayName: Gather assets
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/stringsext.exe'
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/stringsext-$(Build.SourceBranchName)-$(TARGET).zip'
- task: GithubRelease@0
condition: eq( variables['Agent.OS'], 'Linux' )
inputs:
gitHubConnection: 'github.com_getreu'
repositoryName: 'getreu/stringsext'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(Build.SourceBranchName)'
assets: '$(Build.ArtifactStagingDirectory)/*'
title: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
addChangeLog: false
- task: GithubRelease@0
condition: eq( variables['Agent.OS'], 'Darwin' )
inputs:
gitHubConnection: 'github.com_getreu'
repositoryName: 'getreu/stringsext'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(Build.SourceBranchName)'
assets: '$(Build.ArtifactStagingDirectory)/stringsext-$(Build.SourceBranchName)-$(TARGET).tar.gz'
title: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
addChangeLog: false
- task: GithubRelease@0
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
gitHubConnection: 'github.com_getreu'
repositoryName: 'getreu/stringsext'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(Build.SourceBranchName)'
assets: '$(Build.ArtifactStagingDirectory)/stringsext-$(Build.SourceBranchName)-$(TARGET).zip'
title: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
addChangeLog: false