Skip to content

Commit

Permalink
ci: use the latest python available on windows
Browse files Browse the repository at this point in the history
This commit changes our Windows CI to always use the latest Python
interpreter available in the GHA tool cache instead of hardcoding Python
3.7.6. This is needed because occasionally GitHub bumps the installed
version, deleting the previous one.
  • Loading branch information
pietroalbini authored and Mark-Simulacrum committed May 11, 2020
1 parent 92dcc9a commit 51c901e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ci/scripts/install-msys2-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ if isWindows; then
pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar \
binutils

# Detect the native Python version installed on the agent. On GitHub
# Actions, the C:\hostedtoolcache\windows\Python directory contains a
# subdirectory for each installed Python version.
#
# The -V flag of the sort command sorts the input by version number.
native_python_version="$(ls /c/hostedtoolcache/windows/Python | sort -Vr | head -n 1)"

# Make sure we use the native python interpreter instead of some msys equivalent
# one way or another. The msys interpreters seem to have weird path conversions
# baked in which break LLVM's build system one way or another, so let's use the
# native version which keeps everything as native as possible.
python_home="C:/hostedtoolcache/windows/Python/3.7.6/x64"
python_home="/c/hostedtoolcache/windows/Python/${native_python_version}/x64"
cp "${python_home}/python.exe" "${python_home}/python3.exe"
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\3.7.6\\x64"
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64"
ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64\\Scripts"
fi

0 comments on commit 51c901e

Please sign in to comment.