Skip to content

Commit

Permalink
Build dev-version wheel only once
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelishman committed Oct 4, 2024
1 parent 763491b commit 0d8f905
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions test/qpy_compat/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
set -e
set -o pipefail
set -x
shopt -s nullglob

# Set fixed hash seed to ensure set orders are identical between saving and
# loading.
Expand All @@ -23,11 +24,22 @@ echo "PYTHONHASHSEED=$PYTHONHASHSEED"
our_dir="$(realpath -- "$(dirname -- "${BASH_SOURCE[0]}")")"
repo_root="$(realpath -- "$our_dir/../..")"

# First, prepare a wheel file for the dev version. We install several venvs with this, and while
# cargo will cache some rust artefacts, it still has to re-link each time, so the wheel build takes
# a little while.
wheel_dir="$(pwd -P)/wheels"
python -m pip wheel --no-deps --wheel-dir "$wheel_dir" "$repo_root"
all_wheels=("$wheel_dir"/*.whl)
qiskit_dev_wheel="${all_wheels[0]}"

# Now set up a "base" development-version environment, which we'll use for most of the backwards
# compatibility checks.
qiskit_venv="$(pwd -P)/venvs/dev"
qiskit_python="$qiskit_venv/bin/python"
python -m venv "$qiskit_venv"

# `packaging` is needed for the `get_versions.py` script.
"$qiskit_venv/bin/pip" install -c "$repo_root/constraints.txt" "$repo_root" packaging
"$qiskit_venv/bin/pip" install -c "$repo_root/constraints.txt" "$qiskit_dev_wheel" packaging

# Run all of the tests of cross-Qiskit-version compatibility.
"$qiskit_python" "$our_dir/get_versions.py" | parallel --colsep=" " bash "$our_dir/process_version.sh" -p "$qiskit_python"
Expand Down Expand Up @@ -58,7 +70,7 @@ for i in "${!symengine_versions[@]}"; do
symengine_venv="$symengine_venv_prefix$i"
files_dir="$symengine_files_prefix$i"
python -m venv "$symengine_venv"
"$symengine_venv/bin/pip" install -c "$repo_root/constraints.txt" "$repo_root" "symengine$specifier"
"$symengine_venv/bin/pip" install -c "$repo_root/constraints.txt" "$qiskit_dev_wheel" "symengine$specifier"
mkdir -p "$files_dir"
pushd "$files_dir"
"$symengine_venv/bin/python" -c 'import symengine; print(symengine.__version__)' > "SYMENGINE_VERSION"
Expand Down

0 comments on commit 0d8f905

Please sign in to comment.