From ced77466054c76405e3e924a4d81bf0ebddec36c Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Tue, 2 Jan 2024 16:28:09 +0800 Subject: [PATCH] Resolve toolchain installation random issue in CI Fix #644 Signed-off-by: Wei Liu --- .github/workflows/integration-tdx.yml | 9 ++------- sh_script/update_toolchain.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 sh_script/update_toolchain.sh diff --git a/.github/workflows/integration-tdx.yml b/.github/workflows/integration-tdx.yml index c3eed473..dd333118 100644 --- a/.github/workflows/integration-tdx.yml +++ b/.github/workflows/integration-tdx.yml @@ -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 @@ -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 diff --git a/sh_script/update_toolchain.sh b/sh_script/update_toolchain.sh new file mode 100644 index 00000000..0eaa76b9 --- /dev/null +++ b/sh_script/update_toolchain.sh @@ -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 \ No newline at end of file