Make sure we have a recent enough rustc to build packages

This commit is contained in:
Pedro Algarvio 2024-05-08 18:13:51 +01:00
parent 605947d4a1
commit bd99bb0b7b
2 changed files with 28 additions and 0 deletions

View file

@ -183,6 +183,19 @@ jobs:
# Checkout here so we can easily use custom actions
- uses: actions/checkout@v4
# We need a more recent rustc
- name: Install a more recent `rustc`
if: ${{ inputs.source == 'src' }}
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Set rust environment variables
if: ${{ inputs.source == 'src' }}
run: |
CARGO_HOME=${CARGO_HOME:-${HOME}/.cargo}
export CARGO_HOME
echo "CARGO_HOME=${CARGO_HOME}" | tee -a "${GITHUB_ENV}"
echo "${CARGO_HOME}/bin" | tee -a "${GITHUB_PATH}"
# Checkout here for the build process
- name: Checkout in build directory
uses: actions/checkout@v4

View file

@ -8,6 +8,7 @@ from __future__ import annotations
import json
import logging
import os
import os.path
import pathlib
import shutil
import tarfile
@ -90,6 +91,20 @@ def debian(
os.environ[key] = value
env_args.extend(["-e", key])
cargo_home = os.environ.get("CARGO_HOME")
user_cargo_bin = os.path.expanduser("~/.cargo/bin")
if os.path.exists(user_cargo_bin):
ctx.info(
f"The path '{user_cargo_bin}' exists so adding --prepend-path={user_cargo_bin}"
)
env_args.append(f"--prepend-path={user_cargo_bin}")
elif cargo_home is not None:
cargo_home_bin = os.path.join(cargo_home, "bin")
ctx.info(
f"The 'CARGO_HOME' environment variable is set, so adding --prepend-path={cargo_home_bin}"
)
env_args.append(f"--prepend-path={cargo_home_bin}")
env = os.environ.copy()
env["PIP_CONSTRAINT"] = str(
tools.utils.REPO_ROOT / "requirements" / "constraints.txt"