From 90bb8210f4680c795adbadc0e7a703d83b897c66 Mon Sep 17 00:00:00 2001 From: Joe Romano Date: Mon, 25 Jan 2021 14:24:22 -0500 Subject: [PATCH] Pass all unit tests on Raspberry Pi --- tests/unit/requirements-rpi.txt | 4 ++++ tests/unit/rpi.Dockerfile | 39 ++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 tests/unit/requirements-rpi.txt diff --git a/tests/unit/requirements-rpi.txt b/tests/unit/requirements-rpi.txt new file mode 100644 index 000000000..a7fa3f931 --- /dev/null +++ b/tests/unit/requirements-rpi.txt @@ -0,0 +1,4 @@ +coverage==5.3 +nose==1.3.7 +nose-htmloutput==0.6.0 +parameterized==0.7.0 \ No newline at end of file diff --git a/tests/unit/rpi.Dockerfile b/tests/unit/rpi.Dockerfile index f04fee9e6..0b951e24b 100644 --- a/tests/unit/rpi.Dockerfile +++ b/tests/unit/rpi.Dockerfile @@ -1,34 +1,53 @@ -FROM python:3.7.4-stretch +FROM ubuntu:bionic + +RUN apt-get update && apt-get install -y wget xz-utils curl #nodejs -RUN wget --quiet https://nodejs.org/dist/v11.14.0/node-v11.14.0-linux-x64.tar.xz -O ~/node.tar.xz && \ +RUN wget --quiet https://nodejs.org/dist/v11.14.0/node-v11.14.0-linux-arm64.tar.xz -O ~/node.tar.xz && \ tar -xvf ~/node.tar.xz -C /opt/ && \ rm ~/node.tar.xz -ENV PATH /opt/node-v11.14.0-linux-x64/bin:$PATH +ENV PATH /opt/node-v11.14.0-linux-arm64/bin:$PATH RUN apt-get update --fix-missing \ && apt-get install -y --no-install-recommends \ - graphviz dos2unix && \ + graphviz dos2unix python3-numpy libatlas-base-dev gfortran libgfortran5 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +# Ensure specific python version +# See: https://stackoverflow.com/a/58562728/1730417 +# and: https://askubuntu.com/a/1176271/260220 +RUN apt-get update && apt-get install -y software-properties-common +RUN add-apt-repository ppa:deadsnakes/ppa +RUN apt-get update +RUN apt-get install -y python3.7 python3.7-dev python3.7-distutils +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 +RUN update-alternatives --set python /usr/bin/python3.7 +RUN curl -s https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python get-pip.py --force-reinstall && \ + rm get-pip.py + RUN npm install -g mocha RUN pip install --upgrade pip ## tests -COPY /tests/unit/requirements.txt /root/test_requirements.txt +COPY /tests/unit/requirements-rpi.txt /root/test_requirements.txt RUN pip install --no-cache-dir -r /root/test_requirements.txt ## machine and lab container -COPY /docker/lab/files/requirements.txt /root/lab_requirements.txt -RUN pip install --no-cache-dir -r /root/lab_requirements.txt +RUN mkdir /root/wheel +COPY /docker/pennai-arm64-deps/lab/wheel/*.whl /root/wheel/ +COPY /docker/pennai-arm64-deps/machine/wheel/*.whl /root/wheel/ +COPY /docker/lab/files/requirements-raspberrypi.txt /root/lab_requirements.txt +RUN pip3 install --no-index --find-links=/root/wheel -r /root/lab_requirements.txt -COPY /docker/machine/files/requirements.txt /root/mach_requirements.txt -RUN pip install --no-cache-dir -r /root/mach_requirements.txt +COPY /docker/machine/files/requirements-raspberrypi.txt /root/mach_requirements.txt +RUN pip install --no-index --find-links=/root/wheel -r /root/mach_requirements.txt ### Bill's surprise fork -RUN pip install --no-cache-dir git+https://github.com/lacava/surprise.git@1.0.8.3 +#RUN pip install --verbose --verbose --verbose --no-cache-dir git+https://github.com/lacava/surprise.git@1.0.8.3 +RUN pip install --no-index --find-links=/root/wheel scikit_surprise # install lab/node_modules to an anon volume