Skip to content

Commit 1016411

Browse files
committed
BUG: Always start with clean CUDA_PATH when building cache
1 parent 9aa44f9 commit 1016411

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.github/actions/fetch_ctk/action.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ runs:
5151
shell: bash --noprofile --norc -xeuo pipefail {0}
5252
run: |
5353
CUDA_PATH="./cuda_toolkit"
54-
mkdir -p $CUDA_PATH
54+
rm -f $CUDA_PATH
55+
mkdir $CUDA_PATH
5556
5657
# The binary archives (redist) are guaranteed to be updated as part of the release posting.
5758
CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/"
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# URL to search
3+
URL="https://developer.download.nvidia.com/compute/cuda/redist/"
4+
5+
# Fetch the directory listing and extract the latest version number
6+
get_latest_version() {
7+
# Get the HTML content of the page
8+
local html_content=$(wget -q -O - "$URL")
9+
10+
# Extract links matching the pattern redistrib_?.?.?.json
11+
local files=$(echo "$html_content" | grep -oP 'redistrib_[0-9]+\.[0-9]+\.[0-9]+\.json' | cut -d'"' -f2)
12+
13+
# If files were found, extract the version numbers and find the latest
14+
if [ -n "$files" ]; then
15+
# Extract just the version numbers using regex
16+
local versions=$(echo "$files" | grep -oP 'redistrib_\K[0-9]+\.[0-9]+\.[0-9]+(?=\.json)')
17+
18+
# Sort the versions and get the latest
19+
local latest_version=$(echo "$versions" | sort -V | tail -n 1)
20+
echo "$latest_version"
21+
else
22+
echo "No files matching the pattern were found."
23+
return 1
24+
fi
25+
}
26+
27+
# Call the function and store the result
28+
latest_version=$(get_latest_version)

0 commit comments

Comments
 (0)