]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
build.yaml: Make installation of CUDA actually work
authorJoel Rosdahl <joel@rosdahl.net>
Fri, 21 Aug 2020 12:16:47 +0000 (14:16 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 22 Aug 2020 18:05:32 +0000 (20:05 +0200)
.github/workflows/build.yaml
ci/install-cuda [new file with mode: 0755]

index c115f326dd8e0bb233cc4d20d2f5212e3409d749..0d943aca88972340ebe07d7b338d1aee3b9c5f0e 100644 (file)
@@ -193,7 +193,9 @@ jobs:
 
     - name: Install CUDA
       if: matrix.config.CUDA != ''
-      run: sudo sh ./ci/install-cuda.sh
+      run: sudo --preserve-env=CUDA ci/install-cuda
+      env:
+        CUDA: ${{ matrix.config.CUDA }}
 
     - name: Run Apt-Get
       if: matrix.config.apt_get != ''
diff --git a/ci/install-cuda b/ci/install-cuda
new file mode 100755 (executable)
index 0000000..97f098d
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# Version is given in the CUDA variable.
+
+set -eu
+
+retry() {
+    local i=0
+    while [ $i -lt 3 ]; do
+        if "$@"; then
+            return 0
+        fi
+        i=$((i + 1))
+    done
+    return 1
+}
+
+echo "Installing CUDA support"
+
+retry wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_${CUDA}_amd64.deb
+retry sudo dpkg -i cuda-repo-ubuntu1804_${CUDA}_amd64.deb
+retry sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
+retry sudo apt-get update -qq
+
+cuda_prefix=${CUDA:0:4}
+cuda_prefix=${cuda_prefix/./-}
+retry sudo apt-get install --allow-unauthenticated -y cuda-command-line-tools-${cuda_prefix}
+retry sudo apt-get clean
+
+cuda_home=/usr/local/cuda-${CUDA:0:4}
+$cuda_home/bin/nvcc --version
+echo "::set-env name=PATH::${cuda_home}/bin:${PATH}"