forked from crate-ci/typos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
303 lines (301 loc) · 9.85 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
trigger:
branches:
include: ['master']
tags:
include: ['v*']
pr:
branches:
include:
- master
paths:
exclude:
- "*.md"
- "docs/*"
- "LICENSE-*"
schedules:
- cron: "3 3 3 * *"
displayName: Monthly Build
branches:
include:
- master
variables:
minrust: 1.49.0
codecov_token: $(CODECOV_TOKEN_SECRET)
windows_vm: vs2017-win2016
mac_vm: macos-10.14
linux_vm: ubuntu-16.04
stages:
- stage: check
displayName: Compilation Check
jobs:
- job: cargo_check
displayName: cargo check
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: stable
- script: cargo check --workspace --locked
displayName: Check that Cargo.lock is satisfiable
- script: cargo check --workspace --all-targets
displayName: Default features
- script: cargo check --all-targets --no-default-features
displayName: No features
- script: cargo check --all-targets --all-features
displayName: All features
- stage: test
displayName: Test
jobs:
- job: test
displayName: Test
strategy:
matrix:
windows:
imageName: ${{ variables.windows_vm }}
target: 'x86_64-pc-windows-msvc'
channel: stable
mac:
imageName: ${{ variables.mac_vm }}
target: 'x86_64-apple-darwin'
channel: stable
linux:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: stable
# Check for upcoming platform-specific compiler breakages
windows_beta:
imageName: ${{ variables.windows_vm }}
target: 'x86_64-pc-windows-msvc'
channel: beta
mac_beta:
imageName: ${{ variables.mac_vm }}
target: 'x86_64-apple-darwin'
channel: beta
linux_beta:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: beta
# Check for compiler breakages
linux_nightly:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: nightly
continueOnError: $[ne(variables.channel, 'stable')]
pool:
vmImage: $(imageName)
steps:
- template: install-rust.yml@templates
parameters:
rust: $(channel)
targets: ["$(TARGET)"]
- script: cargo test --target $(TARGET) --workspace
displayName: cargo test
- script: cargo doc --target $(TARGET) --workspace --no-deps
displayName: cargo doc
- job: msrv
displayName: "${{ format('Minimum supported Rust version: {0}', variables.minrust) }}"
dependsOn: []
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: ${{ variables.minrust }}
- script: cargo check --all --bins --examples --tests
displayName: cargo check
- stage: style
displayName: Style checks
dependsOn: []
jobs:
- job: "Committed"
displayName: Linting commit history
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- checkout: self
- template: v1/azdo-step.yml@gh-install
parameters:
git: crate-ci/committed
target: 'x86_64-unknown-linux-gnu'
to: $(Build.StagingDirectory)/tools
- script: |
echo "Linting commits:"
git log --graph --oneline HEAD~..HEAD^2
echo "Against 'committed.toml':"
$(Build.StagingDirectory)/tools/committed --dump-config -
echo ""
echo "If this fails, don't sweat it. We're trying to encourage clear communication and not hinder contributions."
echo "If it is a reasonable issue and you lack time or feel uncomfortable fixing it yourself,"
echo "let us know and we can mentor or fix it."
$(Build.StagingDirectory)/tools/committed HEAD~..HEAD^2 --no-merge-commit -vv
displayName: Lint commit history
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
- job: style
displayName: Style checking
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: stable
components:
- rustfmt
- script: cargo fmt --all -- --check
displayName: rustfmt
- job: lint
displayName: Linting
strategy:
matrix:
current:
channel: ${{ variables.minrust }}
next:
channel: stable
continueOnError: $[eq(variables.channel, 'stable')]
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: $(channel)
components:
- clippy
- script: cargo check --workspace --all-targets --all-features
displayName: Warnings
env:
RUSTFLAGS: "-D warnings"
- script: cargo clippy --workspace --all-features --all-targets -- -D warnings
displayName: clippy
- ${{ if ne('', variables.codecov_token) }}:
- stage: coverage
displayName: Code coverage
dependsOn: test
jobs:
- template: coverage.yml@templates
parameters:
token: ${{ variables.codecov_token }}
- stage: codegen
displayName: Verify Code-gen
dependsOn: ["check"]
jobs:
- job: codegen
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
- script: |
cargo run --package typos-dict-codegen -- --output crates/typos-dict/src/dict_codegen.rs --check
displayName: Verify typos-dict
- script: |
cargo run --package typos-vars-codegen -- --output crates/typos-vars/src/vars_codegen.rs --check
displayName: Verify typos-vars
- script: |
cargo run --package typos-dict-verify -- --input crates/typos-dict/assets/words.csv --output crates/typos-dict/assets/words.csv --check
displayName: Verify typos-dict-verify
- script: |
cargo run --package codespell-codegen -- --output crates/codespell-dict/src/dict_codegen.rs --check
displayName: Verify codespell-dict
- script: |
cargo run --package misspell-codegen -- --output crates/misspell-dict/src/dict_codegen.rs --check
displayName: Verify misspell-dict
- script: |
cargo run --package wikipedia-codegen -- --output crates/wikipedia-dict/src/dict_codegen.rs --check
displayName: Verify wikipedia-dict
- script: |
cargo run --package varcon-codegen -- --output crates/varcon/src/codegen.rs --check
displayName: Verify varcon-dict
- stage: release
displayName: Release
dependsOn: []
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
jobs:
- job:
strategy:
matrix:
windows:
imageName: ${{ variables.windows_vm }}
target: 'x86_64-pc-windows-msvc'
crate_name: typos
mac:
imageName: ${{ variables.mac_vm }}
target: 'x86_64-apple-darwin'
crate_name: typos
linux:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
crate_name: typos
pool:
vmImage: $(imageName)
steps:
- template: install-rust.yml@templates
parameters:
rust: stable
targets: ["$(TARGET)"]
- script: |
cargo build --target $(TARGET) --release --bin $(CRATE_NAME)
displayName: Build
- task: CopyFiles@2
displayName: Stage assets
condition: ne( variables['Agent.OS'], 'Windows_NT' )
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
contents: $(crate_name)
targetFolder: '$(Build.BinariesDirectory)/'
- task: CopyFiles@2
displayName: Stage assets on Windows
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
contents: $(crate_name).exe
targetFolder: '$(Build.BinariesDirectory)/'
- task: ArchiveFiles@2
displayName: Tarball assets
condition: ne( variables['Agent.OS'], 'Windows_NT' )
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/$(crate_name)'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(crate_name)-$(Build.SourceBranchName)-$(TARGET).tar.gz'
- task: GithubRelease@0
condition: ne( variables['Agent.OS'], 'Windows_NT' )
inputs:
gitHubConnection: 'crate-ci-token'
repositoryName: 'crate-ci/typos'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(Build.SourceBranchName)'
assets: '$(Build.ArtifactStagingDirectory)/$(crate_name)-$(Build.SourceBranchName)-$(TARGET).tar.gz'
title: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
addChangeLog: true
- task: ArchiveFiles@2
displayName: Zip assets
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/$(crate_name).exe'
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(crate_name)-$(Build.SourceBranchName)-$(TARGET).zip'
- task: GithubRelease@0
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
gitHubConnection: 'crate-ci-token'
repositoryName: 'crate-ci/typos'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(Build.SourceBranchName)'
assets: '$(Build.ArtifactStagingDirectory)/$(crate_name)-$(Build.SourceBranchName)-$(TARGET).zip'
title: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
addChangeLog: true
resources:
repositories:
- repository: templates
type: github
name: crate-ci/azure-pipelines
endpoint: crate-ci
- repository: gh-install
type: github
name: crate-ci/gh-install
endpoint: crate-ci