1
1
# # @file
2
2
# Azure Pipelines step to run common Cargo commands.
3
3
#
4
- # Cargo should be installed on the system prior to invoking this template.
4
+ # Environment Assumptions:
5
+ #
6
+ # - Cargo should be installed on the system prior to invoking this template.
7
+ # - Cargo make should be installed on the system prior to invoking this template.
8
+ # - An `all` task should be defined in the `Makefile.toml` file.
5
9
#
6
10
# Copyright (c) Microsoft Corporation. All rights reserved.
7
11
# SPDX-License-Identifier: BSD-2-Clause-Patent
8
12
# #
9
13
10
14
parameters :
11
- - name : format_command
12
- displayName : Rust Format Command
13
- type : string
14
- default : " cargo fmt --all --check"
15
- - name : test_command
16
- displayName : Rust Test Command
17
- type : string
18
- default : " cargo make test"
19
- - name : build_command
20
- displayName : Rust Build Command
21
- type : string
22
- default : " cargo make build"
15
+ - name : checkout_self
16
+ displayName : Perform self checkout step
17
+ type : boolean
18
+ default : false
23
19
- name : container_build
24
20
displayName : Flag for whether a container is being used
25
21
type : boolean
26
22
default : false
27
23
28
24
steps :
29
25
26
+ - ${{ if eq(parameters.checkout_self, true) }} :
27
+ # Repos with local Rust configuration files need to do a self checkout so they are available.
28
+ - checkout : self
29
+ clean : true
30
+ fetchDepth : 0
31
+
30
32
- task : CmdLine@2
31
33
displayName : Setup Cargo Dir Permissions (Linux)
32
34
target : host
@@ -39,25 +41,11 @@ steps:
39
41
condition : and(eq('${{ parameters.container_build }}', 'true'), eq(variables['Agent.OS'], 'Linux'))
40
42
41
43
- task : CmdLine@2
42
- displayName : cargo fmt
43
- inputs :
44
- script : ${{ parameters.format_command }}
45
- workingDirectory : ' $(System.DefaultWorkingDirectory)'
46
- failOnStandardError : true
47
- condition : succeeded()
48
-
49
- - task : CmdLine@2
50
- displayName : cargo make test
51
- inputs :
52
- script : ${{ parameters.test_command }}
53
- workingDirectory : ' $(System.DefaultWorkingDirectory)'
54
- failOnStandardError : true
55
- condition : succeeded()
56
-
57
- - task : CmdLine@2
58
- displayName : cargo make build
44
+ displayName : Cargo Make Checks
45
+ env :
46
+ RUSTC_BOOTSTRAP : ' 1'
59
47
inputs :
60
- script : ${{ parameters.build_command }}
61
- workingDirectory : ' $(System.DefaultWorkingDirectory )'
48
+ script : cargo make all
49
+ workingDirectory : ' $(Build.SourcesDirectory )'
62
50
failOnStandardError : true
63
51
condition : succeeded()
0 commit comments