Skip to content

Commit 0b846f9

Browse files
Fix os-llvm-sycl-build workflow
Since some sycl-nightly tags do no thave associated binaries attached the workflow was failing. This commit enhances the download logic to go through recent tags until one is where where binary file is available.
1 parent a197a1d commit 0b846f9

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

.github/workflows/os-llvm-sycl-build.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,35 @@ jobs:
4141
cd /home/runner/work
4242
mkdir -p sycl_bundle
4343
cd sycl_bundle
44-
export LATEST_LLVM_TAG=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/intel/llvm.git | grep sycl-nightly | tail --lines=1)
45-
export LATEST_LLVM_TAG_SHA=$(echo ${LATEST_LLVM_TAG} | awk '{print $1}')
46-
export NIGHTLY_TAG=$(python3 -c "import sys, urllib.parse as ul; print (ul.quote_plus(sys.argv[1]))" \
47-
$(echo ${LATEST_LLVM_TAG} | awk '{gsub(/^refs\/tags\//, "", $2)} {print $2}'))
48-
if [[ -f bundle_id.txt && ( "$(cat bundle_id.txt)" == "${LATEST_LLVM_TAG_SHA}" ) ]]; then
49-
echo "Using cached download of ${LATEST_LLVM_TAG}"
44+
# get list of shas and tags from remote, filter sycl-nightly tags and reverse order
45+
export LLVM_TAGS=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/intel/llvm.git | \
46+
grep sycl-nightly | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }')
47+
# initialize
48+
unset DEPLOY_NIGHTLY_TAG
49+
unset DEPLOY_NIGHTLY_TAG_SHA
50+
51+
# go through tags and find the most recent one where nighly build binary is available
52+
while IFS= read -r NEXT_LLVM_TAG; do
53+
export NEXT_LLVM_TAG_SHA=$(echo ${NEXT_LLVM_TAG} | awk '{print $1}')
54+
export NEXT_NIGHTLY_TAG=$(python3 -c "import sys, urllib.parse as ul; print (ul.quote_plus(sys.argv[1]))" \
55+
$(echo ${NEXT_LLVM_TAG} | awk '{gsub(/^refs\/tags\//, "", $2)} {print $2}'))
56+
if [[ `wget -S --spider ${DOWNLOAD_URL_PREFIX}/${NEXT_NIGHTLY_TAG}/dpcpp-compiler.tar.gz 2>&1 | grep 'HTTP/1.1 200 OK'` ]];
57+
then
58+
export DEPLOY_NIGHTLY_TAG=${NEXT_NIGHTLY_TAG}
59+
export DEPLOY_LLVM_TAG_SHA=${NEXT_LLVM_TAG_SHA}
60+
break
61+
fi
62+
done <<< "${LLVM_TAGS}"
63+
64+
[[ -n "${DEPLOY_NIGHTLY_TAG}" ]] || exit 1
65+
[[ -n "${DEPLOY_LLVM_TAG_SHA}" ]] || exit 1
66+
echo "Using ${m} corresponding to intel/llvm at ${DEPLOY_LLVM_TAG_SHA}"
67+
68+
if [[ -f bundle_id.txt && ( "$(cat bundle_id.txt)" == "${DEPLOY_LLVM_TAG_SHA}" ) ]]; then
69+
echo "Using cached download of ${DEPLOY_LLVM_TAG_SHA}"
5070
else
5171
rm -rf dpcpp-compiler.tar.gz
52-
wget ${DOWNLOAD_URL_PREFIX}/${NIGHTLY_TAG}/dpcpp-compiler.tar.gz && echo ${LATEST_LLVM_TAG_SHA} > bundle_id.txt || rm -rf bundle_id.txt
72+
wget ${DOWNLOAD_URL_PREFIX}/${DEPLOY_NIGHTLY_TAG}/dpcpp-compiler.tar.gz && echo ${DEPLOY_LLVM_TAG_SHA} > bundle_id.txt || rm -rf bundle_id.txt
5373
[ -f ${OCLCPUEXP_FN} ] || wget ${DOWNLOAD_URL_PREFIX}/${DRIVER_PATH}/${OCLCPUEXP_FN} || rm -rf bundle_id.txt
5474
[ -f ${FPGAEMU_FN} ] || wget ${DOWNLOAD_URL_PREFIX}/${DRIVER_PATH}/${FPGAEMU_FN} || rm -rf bundle_id.txt
5575
[ -f ${TBB_FN} ] || wget ${TBB_URL}/${TBB_FN} || rm -rf bundle_id.txt

0 commit comments

Comments
 (0)