11# # @file
22# Azure Pipelines step to run common Cargo commands.
33#
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.
59#
610# Copyright (c) Microsoft Corporation. All rights reserved.
711# SPDX-License-Identifier: BSD-2-Clause-Patent
812# #
913
1014parameters :
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
2319- name : container_build
2420 displayName : Flag for whether a container is being used
2521 type : boolean
2622 default : false
2723
2824steps :
2925
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+
3032- task : CmdLine@2
3133 displayName : Setup Cargo Dir Permissions (Linux)
3234 target : host
@@ -39,25 +41,11 @@ steps:
3941 condition : and(eq('${{ parameters.container_build }}', 'true'), eq(variables['Agent.OS'], 'Linux'))
4042
4143- 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'
5947 inputs :
60- script : ${{ parameters.build_command }}
61- workingDirectory : ' $(System.DefaultWorkingDirectory )'
48+ script : cargo make all
49+ workingDirectory : ' $(Build.SourcesDirectory )'
6250 failOnStandardError : true
6351 condition : succeeded()
0 commit comments