Skip to content

Commit 673cf93

Browse files
authored
Use cargo-binstall to sync rust tool versions (#319)
Update RustSetupSteps to download cargo-binstall and use it to download all other rust tools. This is to make it easy for CI to pass the updated RustEnvironmentCheck (microsoft/mu_basecore#737) by downloading the exact tool versions as specified in the rust-toolchain.toml file.
1 parent 6385554 commit 673cf93

File tree

3 files changed

+28
-30
lines changed

3 files changed

+28
-30
lines changed

.sync/Version.njk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#}
3131

3232
{# The git ref value that files dependent on this repo will use. #}
33-
{% set mu_devops = "v9.1.2" %}
33+
{% set mu_devops = "v9.1.5" %}
3434

3535
{# The latest Project Mu release branch value. #}
3636
{% set latest_mu_release_branch = "release/202311" %}
@@ -41,3 +41,7 @@
4141

4242
{# The Rust toolchain version to use. #}
4343
{% set rust_toolchain = "1.74.0" %}
44+
45+
{# Rust tool versions. #}
46+
{% set cargo_make = "0.37.9" %}
47+
{% set cargo_tarpaulin = "0.27.3" %}

.sync/azure_pipelines/RustSetupSteps.yml

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -93,52 +93,42 @@ steps:
9393

9494
- template: DownloadAzurePipelineArtifact.yml
9595
parameters:
96-
task_display_name: Download Cargo Make (Windows)
96+
task_display_name: Download Cargo Binstall (Windows)
9797
artifact_name: Binaries
98-
azure_pipeline_def_id: 166
99-
file_pattern: "**/cargo-make.exe"
98+
azure_pipeline_def_id: 169
99+
file_pattern: "**/cargo-binstall.exe"
100100
target_dir: "$(cargoBinPath)"
101101
target_os: "Windows_NT"
102102
work_dir: "$(Agent.TempDirectory)"
103103

104104
- template: DownloadAzurePipelineArtifact.yml
105105
parameters:
106-
task_display_name: Download Cargo Make (Linux)
106+
task_display_name: Download Cargo Binstall (Linux)
107107
artifact_name: Binaries
108-
azure_pipeline_def_id: 166
109-
file_pattern: "**/cargo-make"
108+
azure_pipeline_def_id: 169
109+
file_pattern: "**/cargo-binstall"
110110
target_dir: "$(Agent.TempDirectory)"
111111
target_os: "Linux"
112112
work_dir: "$(Agent.TempDirectory)"
113+
113114
- script: |
114-
cp $AGENT_TEMPDIRECTORY/cargo-make /.cargo/bin
115-
displayName: Copy cargo-make
115+
cp $AGENT_TEMPDIRECTORY/cargo-binstall /.cargo/bin
116+
displayName: Copy cargo-binstall
116117
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
117118

118-
- template: DownloadAzurePipelineArtifact.yml
119-
parameters:
120-
task_display_name: Download Cargo Tarpaulin (Windows)
121-
artifact_name: Binaries
122-
azure_pipeline_def_id: 167
123-
file_pattern: "**/cargo-tarpaulin.exe"
124-
target_dir: "$(cargoBinPath)"
125-
target_os: "Windows_NT"
126-
work_dir: "$(Agent.TempDirectory)"
127-
128-
- template: DownloadAzurePipelineArtifact.yml
129-
parameters:
130-
task_display_name: Download Cargo Tarpaulin (Linux)
131-
artifact_name: Binaries
132-
azure_pipeline_def_id: 167
133-
file_pattern: "**/cargo-tarpaulin"
134-
target_dir: "$(Agent.TempDirectory)"
135-
target_os: "Linux"
136-
work_dir: "$(Agent.TempDirectory)"
137119
- script: |
138-
cp $AGENT_TEMPDIRECTORY/cargo-tarpaulin /.cargo/bin
139-
displayName: Copy cargo-tarpaulin
120+
sudo chmod +x /.cargo/bin/cargo-binstall
121+
displayName: Make cargo-binstall executable
140122
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
141123

124+
- script: |
125+
cargo binstall -y cargo-make --version {{ sync_version.cargo_make_version }}
126+
displayName: Install cargo-make
127+
128+
- script: |
129+
cargo binstall -y cargo-tarpaulin --version {{ sync_version.cargo_tarpaulin_version }}
130+
displayName: Install cargo-tarpaulin
131+
142132
- script: rustup component add rustfmt rust-src --toolchain {{ sync_version.rust_toolchain }}-$(rust_target_triple)
143133
displayName: rustup add rust-src
144134
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))

.sync/rust_config/rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22

33
[toolchain]
44
channel = "{{ sync_version.rust_toolchain }}"
5+
6+
[tool]
7+
cargo-make = "{{ sync_version.cargo_make }}"
8+
cargo-tarpaulin = "{{ sync_version.cargo_tarpaulin }}"

0 commit comments

Comments
 (0)