Skip to content

Install tests

Install tests #1289

Workflow file for this run

name: Install tests
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
workflow_dispatch:
jobs:
installtest:
strategy:
matrix:
python3-minor-version: [7,8,9,10]
platform: [ubuntu-18.04]
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- name: Set Python Version
run: |
echo "python-version=3.${{ matrix.python3-minor-version }}" >> "$GITHUB_ENV"
- name: Setup Python ${{ env.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.python-version }}
architecture: x64
- name: Checkout MultiPy
uses: actions/checkout@v2
with:
submodules: true
- name: Install runtime build dependencies
run: |
set -eux
sudo apt update
xargs sudo apt install -y -qq --no-install-recommends < build-requirements-debian.txt
git -c fetch.parallel=0 -c submodule.fetchJobs=0 submodule update --init --recursive
- name: Update cmake
run: |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo gpg --dearmor -o /usr/share/keyrings/magic-key.gpg
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/magic-key.gpg] https://apt.kitware.com/ubuntu/ bionic main" | sudo tee -a /etc/apt/sources.list
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install -y binutils cmake
- name: Set up virtual environment
run: |
set -eux
pip3 install virtualenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
export CFLAGS="-fPIC -g"
declare -A py_version_dict
py_version_dict[7]='3.7.10'
py_version_dict[8]='3.8.13'
py_version_dict[9]='3.9.13'
py_version_dict[10]='3.10.6'
py_install_version=${py_version_dict[${{ matrix.python3-minor-version }}]}
~/.pyenv/bin/pyenv install --force ${py_install_version}
virtualenv -p ~/.pyenv/versions/${py_install_version}/bin/python3 ~/venvs/multipy
- name: Install dependencies
run: |
set -eux
source "$HOME/venvs/multipy/bin/activate"
python -m pip install -r dev-requirements.txt
pip3 install --pre torch
deactivate
- name: Run lightweight pip install within virtualenv
run: |
set -eux
source "$HOME/venvs/multipy/bin/activate"
INSTALL_PYTHON_ONLY=1 python -m pip install -e .
deactivate
- name: Run pip editable install within virtualenv
run: |
set -eux
source "$HOME/venvs/multipy/bin/activate"
rm -rf multipy/runtime/build*
pip install -e .
deactivate
- name: Run setup.py install within virtualenv
run: |
set -eux
source "$HOME/venvs/multipy/bin/activate"
python setup.py install
test -e ~/venvs/multipy/lib/python3.${{ matrix.python3-minor-version }}/site-packages/multipy/runtime/build/libtorch_deploy.a
deactivate
- name: Install sdist
run: |
set -eux
source "$HOME/venvs/multipy/bin/activate"
python setup.py sdist
pip install dist/*.tar.gz --force-reinstall
test -e ~/venvs/multipy/lib/python3.${{ matrix.python3-minor-version }}/site-packages/multipy/runtime/build/libtorch_deploy.a
deactivate
- name: Install bdist_wheel
run: |
set -eux
source "$HOME/venvs/multipy/bin/activate"
python setup.py bdist_wheel
pip install dist/*.whl --force-reinstall
test -e ~/venvs/multipy/lib/python3.${{ matrix.python3-minor-version }}/site-packages/multipy/runtime/build/libtorch_deploy.a
deactivate
- name: Install bdist_wheel with cuda tests
run: |
set -eux
source "$HOME/venvs/multipy/bin/activate"
python setup.py bdist_wheel
BUILD_CUDA_TESTS=1 pip install dist/*.whl "--force-reinstall"
test -e ~/venvs/multipy/lib/python3.${{ matrix.python3-minor-version }}/site-packages/multipy/runtime/build/libtorch_deploy.a
deactivate
- name: Install dependencies with conda for 3.8+
run: |
set -eux
if [[ ${{ matrix.python3-minor-version }} -gt 7 ]]; then \
curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda install -y python=${{ env.python-version }} mkl mkl-include conda-build pyyaml numpy ipython && \
/opt/conda/bin/conda install -y -c conda-forge libpython-static=${{ env.python-version }} && \
/opt/conda/bin/conda install -y pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch-nightly && \
/opt/conda/bin/conda clean -ya; \
fi
- name: Run pip install with conda for 3.8+
run: |
set -eux
if [[ ${{ matrix.python3-minor-version }} -gt 7 ]]; then
source /opt/conda/bin/activate
pip install -e .
fi