Skip to content

Commit d0d619a

Browse files
authored
add workflow to test conda installs (#21)
1 parent 24c5148 commit d0d619a

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

.github/scripts/test_conda_install.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux -o pipefail
4+
5+
case ${GPUARCH_PKG} in
6+
cpuonly)
7+
GPUARCH_IDENTIFIER="cpu"
8+
;;
9+
cudatoolkit=11.3)
10+
GPUARCH_IDENTIFIER='cu.*11\?.3'
11+
;;
12+
esac
13+
14+
TMPFILE=$(mktemp)
15+
16+
EXTRA_CONDA_CHANNEL_FLAGS=${EXTRA_CONDA_CHANNEL_FLAGS:-}
17+
EXTRA_CONDA_PKGS=${EXTRA_CONDA_PKGS:-}
18+
PYTORCH_CONDA_INSTALL_CHANNEL=${PYTORCH_CONDA_INSTALL_CHANNEL:-pytorch-test}
19+
20+
conda create -y \
21+
-n testenv \
22+
--dry-run \
23+
-c "${PYTORCH_CONDA_INSTALL_CHANNEL}" \
24+
${EXTRA_CONDA_CHANNEL_FLAGS} \
25+
python=${PYTHON_VERSION} \
26+
${EXTRA_CONDA_PKGS} \
27+
"pytorch=${PYTORCH_VERSION}" \
28+
"torchvision=${TORCHVISION_VERSION}" \
29+
"${GPUARCH_PKG}" | tee "${TMPFILE}"
30+
31+
# If the pkg wasn't resolved correctly it'll fail out here
32+
grep "${PYTORCH_CONDA_INSTALL_CHANNEL}/linux-64::pytorch-${PYTORCH_VERSION}.*${GPUARCH_IDENTIFIER}" "${TMPFILE}"
33+
grep "${PYTORCH_CONDA_INSTALL_CHANNEL}/linux-64::torchvision-${TORCHVISION_VERSION}.*${GPUARCH_IDENTIFIER}" "${TMPFILE}"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Test Conda Installations
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- .github/workflows/test_conda_installs.yml
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
gpuarch_pkg: [cpuonly, cudatoolkit=11.3]
15+
container: continuumio/miniconda3
16+
env:
17+
GPUARCH_PKG: ${{ matrix.gpuarch_pkg }}
18+
PYTHON_VERSION: 3.7 # TODO: Update this to include more versions
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Populate test versions into env
22+
run:
23+
cat TEST_VERSIONS >> "${GITHUB_ENV}"
24+
- name: Test
25+
run: |
26+
.github/scripts/test_conda_install.sh
27+
- name: Test with conda-forge
28+
run: |
29+
EXTRA_CONDA_CHANNEL_FLAGS="-c conda-forge" .github/scripts/test_conda_install.sh
30+
- name: Test with conda-forge and extra pkgs (opencv, dlib)
31+
run: |
32+
EXTRA_CONDA_CHANNEL_FLAGS="-c conda-forge" EXTRA_CONDA_PKGS="opencv dlib" .github/scripts/test_conda_install.sh

TEST_VERSIONS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PYTORCH_VERSION=1.10.0
2+
TORCHVISION_VERSION=0.11.0

0 commit comments

Comments
 (0)