From e2c9082d9d0fe623280ffb16782d6503363baea8 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Thu, 21 Jan 2021 00:55:53 +0100 Subject: [PATCH 1/2] fix: manually extract llvm release to get more output --- .github/actions/install-llvm/dist/index.js | 19 +++++++++++++++---- .github/actions/install-llvm/index.js | 19 +++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/actions/install-llvm/dist/index.js b/.github/actions/install-llvm/dist/index.js index e4bed06b3..ec83d43c0 100644 --- a/.github/actions/install-llvm/dist/index.js +++ b/.github/actions/install-llvm/dist/index.js @@ -1189,20 +1189,31 @@ async function execute(cmd) { core.addPath(`${llvmPath}/bin`) } else if(isWindows) { const downloadUrl = "https://github.com/mun-lang/llvm-package-windows/releases/download/v8.0.1/llvm-8.0.1-windows-x64-msvc16.7z" - core.info(`downloading LLVM from '${downloadUrl}'`) + core.info(`Downloading LLVM from '${downloadUrl}'`) const downloadLocation = await tc.downloadTool(downloadUrl); - core.info("succesfully downloaded llvm release, extracting...") + core.info("Succesfully downloaded LLVM release, extracting...") + const llvmPath = path.resolve("llvm"); const _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe'); - const llvmPath = await tc.extract7z(downloadLocation, null, _7zPath) + const args = [ + "-bsp1", // output log info + "x", // extract + downloadLocation, + `-o${llvmPath}` + ] + const exit = await exec.exec(_7zPath, args); + if(exit !== 0) { + throw new Error("Could not extract LLVM and Clang binaries."); + } - core.info("succesfully extracted llvm release") + core.info("Succesfully extracted LLVM release") core.addPath(`${llvmPath}/bin`) core.exportVariable('LIBCLANG_PATH', `${llvmPath}/bin`) } else { core.setFailed(`unsupported platform '${process.platform}'`) } } catch(error) { + console.error(error.stack); core.setFailed(error.message); } })(); diff --git a/.github/actions/install-llvm/index.js b/.github/actions/install-llvm/index.js index f793316e3..9f8efac75 100644 --- a/.github/actions/install-llvm/index.js +++ b/.github/actions/install-llvm/index.js @@ -37,20 +37,31 @@ export async function execute(cmd) { core.addPath(`${llvmPath}/bin`) } else if(isWindows) { const downloadUrl = "https://github.com/mun-lang/llvm-package-windows/releases/download/v8.0.1/llvm-8.0.1-windows-x64-msvc16.7z" - core.info(`downloading LLVM from '${downloadUrl}'`) + core.info(`Downloading LLVM from '${downloadUrl}'`) const downloadLocation = await tc.downloadTool(downloadUrl); - core.info("succesfully downloaded llvm release, extracting...") + core.info("Succesfully downloaded LLVM release, extracting...") + const llvmPath = path.resolve("llvm"); const _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe'); - const llvmPath = await tc.extract7z(downloadLocation, null, _7zPath) + const args = [ + "-bsp1", // output log info + "x", // extract + downloadLocation, + `-o${llvmPath}` + ] + const exit = await exec.exec(_7zPath, args); + if(exit !== 0) { + throw new Error("Could not extract LLVM and Clang binaries."); + } - core.info("succesfully extracted llvm release") + core.info("Succesfully extracted LLVM release") core.addPath(`${llvmPath}/bin`) core.exportVariable('LIBCLANG_PATH', `${llvmPath}/bin`) } else { core.setFailed(`unsupported platform '${process.platform}'`) } } catch(error) { + console.error(error.stack); core.setFailed(error.message); } })(); From 9f8be24be6febd2824c5906cc6dc3acc533461a2 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Fri, 22 Jan 2021 10:55:13 +0100 Subject: [PATCH 2/2] feat: added extraction retry --- .github/actions/install-llvm/dist/index.js | 30 ++++++++++++++-------- .github/actions/install-llvm/index.js | 30 ++++++++++++++-------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/.github/actions/install-llvm/dist/index.js b/.github/actions/install-llvm/dist/index.js index ec83d43c0..485afc5fd 100644 --- a/.github/actions/install-llvm/dist/index.js +++ b/.github/actions/install-llvm/dist/index.js @@ -1195,18 +1195,28 @@ async function execute(cmd) { core.info("Succesfully downloaded LLVM release, extracting...") const llvmPath = path.resolve("llvm"); const _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe'); - const args = [ - "-bsp1", // output log info - "x", // extract - downloadLocation, - `-o${llvmPath}` - ] - const exit = await exec.exec(_7zPath, args); - if(exit !== 0) { - throw new Error("Could not extract LLVM and Clang binaries."); + let attempt = 1; + while(true) { + const args = [ + "x", // extract + downloadLocation, + `-o${llvmPath}` + ] + const exit = await exec.exec(_7zPath, args); + if(exit === 2 && attempt <= 4) { + attempt += 1; + console.error(`Error extracting LLVM release, retrying attempt #${attempt} after 1s..`) + await new Promise(resolve => setTimeout(resolve, 1000)); + } + else if (exit !== 0) { + throw new Error("Could not extract LLVM and Clang binaries."); + } + else { + core.info("Succesfully extracted LLVM release") + break; + } } - core.info("Succesfully extracted LLVM release") core.addPath(`${llvmPath}/bin`) core.exportVariable('LIBCLANG_PATH', `${llvmPath}/bin`) } else { diff --git a/.github/actions/install-llvm/index.js b/.github/actions/install-llvm/index.js index 9f8efac75..475ef0e06 100644 --- a/.github/actions/install-llvm/index.js +++ b/.github/actions/install-llvm/index.js @@ -43,18 +43,28 @@ export async function execute(cmd) { core.info("Succesfully downloaded LLVM release, extracting...") const llvmPath = path.resolve("llvm"); const _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe'); - const args = [ - "-bsp1", // output log info - "x", // extract - downloadLocation, - `-o${llvmPath}` - ] - const exit = await exec.exec(_7zPath, args); - if(exit !== 0) { - throw new Error("Could not extract LLVM and Clang binaries."); + let attempt = 1; + while(true) { + const args = [ + "x", // extract + downloadLocation, + `-o${llvmPath}` + ] + const exit = await exec.exec(_7zPath, args); + if(exit === 2 && attempt <= 4) { + attempt += 1; + console.error(`Error extracting LLVM release, retrying attempt #${attempt} after 1s..`) + await new Promise(resolve => setTimeout(resolve, 1000)); + } + else if (exit !== 0) { + throw new Error("Could not extract LLVM and Clang binaries."); + } + else { + core.info("Succesfully extracted LLVM release") + break; + } } - core.info("Succesfully extracted LLVM release") core.addPath(`${llvmPath}/bin`) core.exportVariable('LIBCLANG_PATH', `${llvmPath}/bin`) } else {