Fix rust version for windows builds

This commit is contained in:
fpinto 2024-06-14 11:09:34 +02:00 committed by hurl-bot
parent 7c02e4661f
commit 3c3d3dc0c3
No known key found for this signature in database
GPG Key ID: 1283A2B4A0DCAF8D
3 changed files with 30 additions and 12 deletions

View File

@ -493,17 +493,14 @@ jobs:
uses: actions/checkout@v4.1.7
with:
ref: ${{ inputs.branch }}
- name: Install Rust
run: |
.\bin\install_rust.ps1
- name: Manage vcpkg cache
uses: actions/cache@v4.0.2
with:
path: C:\vcpkg
key: ${{ runner.os }}-release-windows-x64
- name: Install Rust
uses: actions-rs/toolchain@v1.0.6
with:
toolchain: stable
override: true
profile: minimal
- name: Environment
run: .\bin\environment.ps1
- name: Install prerequisites

View File

@ -391,17 +391,14 @@ jobs:
uses: actions/checkout@v4.1.7
with:
ref: ${{ inputs.branch }}
- name: Install Rust
run: |
.\bin\install_rust.ps1
- name: Manage vcpkg cache
uses: actions/cache@v4.0.2
with:
path: C:\vcpkg
key: ${{ runner.os }}-test-windows-x64
- name: Install Rust
uses: actions-rs/toolchain@v1.0.6
with:
toolchain: stable
override: true
profile: minimal
- name: Environment
run: .\bin\environment.ps1
- name: Install Prerequisites

24
bin/install_rust.ps1 Normal file
View File

@ -0,0 +1,24 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
write-host -foregroundcolor Cyan "----- install rust -----"
echo "==== get rust version"
$rust_version = ((Get-Content packages/hurl/Cargo.toml) -match '^rust-version')[0].Split('"')[1]
echo "rust_version=$rust_version"
echo "==== get rustup-init.exe installer"
Invoke-WebRequest -Uri "https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe" -OutFile "rustup-init.exe"
echo "==== install rust"
Start-Process powershell ".\rustup-init.exe --default-toolchain $rust_version -y" -NoNewWindow -Wait -PassThru
echo "==== refresh env"
$env:Path += ";$env:USERPROFILE\.cargo\bin"
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::Process)
rustc --version
cargo --version
echo "==== remove tmp files"
Remove-Item -Path .\rustup-init.exe