From 29572bb9816ef677f560c38ac7f86f483439c6c1 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Mon, 12 Aug 2024 18:38:15 +0300 Subject: [PATCH] ci/windows-docker: Move rustup install into a ps1 script We will need this in order to be able to add conditionals depending on the rustc version, like we do on the linux script. Part-of: --- ci/windows-docker/Dockerfile | 8 +++----- ci/windows-docker/install_cargo_utils.ps1 | 14 ++++++++++++++ ci/windows-docker/install_rust.ps1 | 17 +++++++++++++++++ 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 ci/windows-docker/install_cargo_utils.ps1 create mode 100644 ci/windows-docker/install_rust.ps1 diff --git a/ci/windows-docker/Dockerfile b/ci/windows-docker/Dockerfile index a5247dbeb..00b27da61 100644 --- a/ci/windows-docker/Dockerfile +++ b/ci/windows-docker/Dockerfile @@ -13,10 +13,8 @@ RUN choco install -y pkgconfiglite nasm llvm openssl RUN setx PATH '%PATH%;C:\Program Files\NASM;C:\gst-install\bin' ENV PKG_CONFIG_PATH="C:\gst-install\lib\pkgconfig" -COPY install_gst.ps1 install_dav1d.ps1 C:\ +COPY install_gst.ps1 install_dav1d.ps1 install_rust.ps1 install_cargo_utils.ps1 C:\ RUN C:\install_gst.ps1 RUN C:\install_dav1d.ps1 - -RUN Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile C:\rustup-init.exe -RUN C:\rustup-init.exe -y --profile minimal --default-toolchain $env:RUST_VERSION -RUN cargo install --locked cargo-c --version 0.9.22+cargo-0.72 +RUN C:\install_rust.ps1 +RUN C:\install_cargo_utils.ps1 diff --git a/ci/windows-docker/install_cargo_utils.ps1 b/ci/windows-docker/install_cargo_utils.ps1 new file mode 100644 index 000000000..2dd87a4b4 --- /dev/null +++ b/ci/windows-docker/install_cargo_utils.ps1 @@ -0,0 +1,14 @@ +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; + +rustup --version +rustc --version +cargo --version + +cargo install --locked cargo-c --version 0.9.26+cargo-0.72 + +if (!$?) { + Write-Host "Failed to install cargo-c" + Exit 1 +} + +cargo-cbuild --version diff --git a/ci/windows-docker/install_rust.ps1 b/ci/windows-docker/install_rust.ps1 new file mode 100644 index 000000000..9929e9516 --- /dev/null +++ b/ci/windows-docker/install_rust.ps1 @@ -0,0 +1,17 @@ +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; + +$rustup_url = 'https://win.rustup.rs/x86_64' + +Invoke-WebRequest -Uri $rustup_url -OutFile C:\rustup-init.exe + +if (!$?) { + Write-Host "Failed to download rustup" + Exit 1 +} + +C:\rustup-init.exe -y --profile minimal --default-toolchain $env:RUST_VERSION + +if (!$?) { + Write-Host "Failed to install rust" + Exit 1 +}