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 <[email protected]>
  • Loading branch information
liuw1 authored and jyao1 committed Jan 3, 2024
1 parent 3789296 commit 077ca0c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/integration-tdx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
system_compile:
name: Run TDX Integration Test
runs-on: [self-hosted, tdx]
timeout-minutes: 30
timeout-minutes: 45

steps:
# Install first since it's needed to build NASM
Expand All @@ -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
26 changes: 26 additions & 0 deletions sh_script/update_toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/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
rustup component add rust-src
echo "Toolchain ${TOOLCHAIN_VER} is installed."
break
fi
sleep 30
let "TRY_TIMES--"
done

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

0 comments on commit 077ca0c

Please sign in to comment.