Skip to content

Commit

Permalink
Resolve toolchain installation random issue in CI
Browse files Browse the repository at this point in the history
Fix #644

Signed-off-by: Wei Liu <wei3.liu@intel.com>
  • Loading branch information
liuw1 committed Jan 2, 2024
1 parent 3789296 commit 763395d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/integration-tdx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ jobs:
submodules: recursive

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: ${{ env.TOOLCHAIN_PROFILE }}
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
components: rust-src, llvm-tools-preview
run: bash sh_script/update_toolchain.sh ${{ env.RUST_TOOLCHAIN }}

- name: Run cargo install cargo-xbuild
uses: actions-rs/cargo@v1
Expand Down
24 changes: 24 additions & 0 deletions sh_script/update_toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

TOOLCHAIN_VER=$1
TRY_TIMES=5
echo ${TOOLCHAIN_VER}

while [ $TRY_TIMES -gt 0 ]
do
exist=`rustup toolchain list | grep ${TOOLCHAIN_VER} | wc -l`
if [[ ${exist} == 0 ]]
then
rustup toolchain install ${TOOLCHAIN_VER} --component rust-src
else
echo "Toolchain ${TOOLCHAIN_VER} is installed."
break
fi
let "TRY_TIMES--"
done

if [[ ${TRY_TIMES} == 0 ]]
then
echo "Install toolchian ${TOOLCHAIN_VER} failed."
exit 1
fi

0 comments on commit 763395d

Please sign in to comment.