From 9d5fa0967bdc4358c705bfca6fa14dde79709a23 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Tue, 19 Oct 2021 15:06:46 -0500 Subject: [PATCH] add workflow to test conda installs Signed-off-by: Eli Uriegas --- .github/scripts/test_conda_install.sh | 33 +++++++++++++++++++++++ .github/workflows/test_conda_installs.yml | 32 ++++++++++++++++++++++ TEST_VERSIONS | 2 ++ 3 files changed, 67 insertions(+) create mode 100755 .github/scripts/test_conda_install.sh create mode 100644 .github/workflows/test_conda_installs.yml create mode 100644 TEST_VERSIONS diff --git a/.github/scripts/test_conda_install.sh b/.github/scripts/test_conda_install.sh new file mode 100755 index 0000000..806d27a --- /dev/null +++ b/.github/scripts/test_conda_install.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -eux -o pipefail + +case ${GPUARCH_PKG} in + cpuonly) + GPUARCH_IDENTIFIER="cpu" + ;; + cudatoolkit=11.3) + GPUARCH_IDENTIFIER='cu.*11\?.3' + ;; +esac + +TMPFILE=$(mktemp) + +EXTRA_CONDA_CHANNEL_FLAGS=${EXTRA_CONDA_CHANNEL_FLAGS:-} +EXTRA_CONDA_PKGS=${EXTRA_CONDA_PKGS:-} +PYTORCH_CONDA_INSTALL_CHANNEL=${PYTORCH_CONDA_INSTALL_CHANNEL:-pytorch-test} + +conda create -y \ + -n testenv \ + --dry-run \ + -c "${PYTORCH_CONDA_INSTALL_CHANNEL}" \ + ${EXTRA_CONDA_CHANNEL_FLAGS} \ + python=${PYTHON_VERSION} \ + ${EXTRA_CONDA_PKGS} \ + "pytorch=${PYTORCH_VERSION}" \ + "torchvision=${TORCHVISION_VERSION}" \ + "${GPUARCH_PKG}" | tee "${TMPFILE}" + +# If the pkg wasn't resolved correctly it'll fail out here +grep "${PYTORCH_CONDA_INSTALL_CHANNEL}/linux-64::pytorch-${PYTORCH_VERSION}.*${GPUARCH_IDENTIFIER}" "${TMPFILE}" +grep "${PYTORCH_CONDA_INSTALL_CHANNEL}/linux-64::torchvision-${TORCHVISION_VERSION}.*${GPUARCH_IDENTIFIER}" "${TMPFILE}" diff --git a/.github/workflows/test_conda_installs.yml b/.github/workflows/test_conda_installs.yml new file mode 100644 index 0000000..2bc69b8 --- /dev/null +++ b/.github/workflows/test_conda_installs.yml @@ -0,0 +1,32 @@ +name: Test Conda Installations + +on: + workflow_dispatch: + pull_request: + paths: + - .github/workflows/test_conda_installs.yml + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + gpuarch_pkg: [cpuonly, cudatoolkit=11.3] + container: continuumio/miniconda3 + env: + GPUARCH_PKG: ${{ matrix.gpuarch_pkg }} + PYTHON_VERSION: 3.7 # TODO: Update this to include more versions + steps: + - uses: actions/checkout@v2 + - name: Populate test versions into env + run: + cat TEST_VERSIONS >> "${GITHUB_ENV}" + - name: Test + run: | + .github/scripts/test_conda_install.sh + - name: Test with conda-forge + run: | + EXTRA_CONDA_CHANNEL_FLAGS="-c conda-forge" .github/scripts/test_conda_install.sh + - name: Test with conda-forge and extra pkgs (opencv, dlib) + run: | + EXTRA_CONDA_CHANNEL_FLAGS="-c conda-forge" EXTRA_CONDA_PKGS="opencv dlib" .github/scripts/test_conda_install.sh diff --git a/TEST_VERSIONS b/TEST_VERSIONS new file mode 100644 index 0000000..789399e --- /dev/null +++ b/TEST_VERSIONS @@ -0,0 +1,2 @@ +PYTORCH_VERSION=1.10.0 +TORCHVISION_VERSION=0.11.0