From 5fff1a5a7f7fe0f00b439de3b5167214c739a0bc Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Thu, 5 Oct 2023 11:58:21 -0700 Subject: [PATCH 1/3] fix Docker and Bazel CIs --- .github/workflows/bazeltest.yml | 4 ++++ install/tests/Dockerfile | 8 +++++++- pybind_interface/Dockerfile | 16 ++++++++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bazeltest.yml b/.github/workflows/bazeltest.yml index 6eb6a261..b893362d 100644 --- a/.github/workflows/bazeltest.yml +++ b/.github/workflows/bazeltest.yml @@ -60,6 +60,10 @@ jobs: - name: Install requirements run: | python3 -m pip install -r requirements.txt + - name: Upgrade libc + # An LLVM update broke this test, fix per is https://bugs.llvm.org/show_bug.cgi?id=27310. + run: | + sudo apt-get upgrade libc-bin=2.31-0ubuntu9.9 - name: Run C++ tests run: | bazel test --config=avx --config=openmp \ diff --git a/install/tests/Dockerfile b/install/tests/Dockerfile index 9998e654..f51eb8f9 100644 --- a/install/tests/Dockerfile +++ b/install/tests/Dockerfile @@ -3,9 +3,15 @@ FROM debian # Install requirements RUN apt-get update -RUN apt-get install -y python3-dev python3-pip +RUN apt-get install -y python3-dev python3-pip python3-venv RUN apt-get install -y cmake git +# Create venv to avoid collision between system packages (e.g. numpy) and Cirq's deps. +RUN python3 -m venv test_env + +# Activate venv. +ENV PATH="test_env/bin:$PATH" + COPY ./ /qsim/ RUN pip3 install /qsim/ diff --git a/pybind_interface/Dockerfile b/pybind_interface/Dockerfile index b826d197..ffadd4a2 100644 --- a/pybind_interface/Dockerfile +++ b/pybind_interface/Dockerfile @@ -2,11 +2,16 @@ FROM qsim # Install additional requirements -RUN apt-get install -y python3-dev python3-pybind11 python3-pytest python3-pip +RUN apt-get install -y python3-dev python3-pybind11 python3-pip python3-venv -# The --force flag is used mainly so that the old numpy installation from pybind -# gets replaced with the one cirq requires -RUN pip3 install --prefer-binary cirq-core --force +# Create venv to avoid collision between system packages (e.g. numpy) and Cirq's deps. +RUN python3 -m venv test_env + +# Activate venv. +ENV PATH="test_env/bin:$PATH" + +# break-system-packages flag to override system packages (e.g. numpy) with Cirq's deps. +RUN pip3 install --prefer-binary cirq-core # Copy relevant files COPY ./pybind_interface/ /qsim/pybind_interface/ @@ -18,5 +23,8 @@ WORKDIR /qsim/ # Build pybind code early to cache the results RUN make -C /qsim/ pybind +# Install pytest +RUN pip3 install pytest + # Compile and run qsim tests ENTRYPOINT make -C /qsim/ run-py-tests From dddae7e0c2f67b57a54d2f32b2e02302bf08dc3b Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Thu, 5 Oct 2023 14:07:19 -0700 Subject: [PATCH 2/3] run kokoro From c0630c1ca1113913d6ca77878daebc660e89bd4d Mon Sep 17 00:00:00 2001 From: Nour Yosri Date: Tue, 17 Oct 2023 15:11:13 -0700 Subject: [PATCH 3/3] run kokoro