-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: remove prints * misc: changelog * fix: changelog * misc: use 13.0.1 on windows * bump: use catch2 via extern * fix: delete commented lines in cmake
- Loading branch information
1 parent
245b9ee
commit b475164
Showing
22 changed files
with
313 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,78 @@ | ||
const core = require('@actions/core'); | ||
const exec = require('@actions/exec'); | ||
const tc = require('@actions/tool-cache'); | ||
const path = require('path'); | ||
|
||
const isWindows = process.platform == "win32" | ||
const isMacOS = process.platform == "darwin" | ||
const isLinux = process.platform == "linux" | ||
|
||
export async function execute(cmd) { | ||
let myOutput = ''; | ||
let myError = ''; | ||
await exec.exec(cmd, [], { | ||
listeners: { | ||
stdout: (data) => { | ||
myOutput += data.toString().trim(); | ||
}, | ||
stderr: (data) => { | ||
myError += data.toString().trim(); | ||
} | ||
} | ||
}); | ||
|
||
if (myError) { | ||
throw new Error(myError); | ||
} | ||
return myOutput; | ||
} | ||
|
||
(async () => { | ||
try { | ||
if (isLinux) { | ||
const installScript = path.join(__dirname, "../../../../scripts/install-llvm.sh"); | ||
await exec.exec(`sudo ${installScript}`); | ||
} else if (isMacOS) { | ||
await exec.exec("brew install llvm@12") | ||
let llvmPath = await execute("brew --prefix llvm@12"); | ||
core.addPath(`${llvmPath}/bin`) | ||
} else if (isWindows) { | ||
const downloadUrl = "https://github.com/mun-lang/llvm-package-windows/releases/download/v12.0.1/llvm-12.0.1-windows-x64-msvc16-mt.7z" | ||
core.info(`downloading LLVM from '${downloadUrl}'`) | ||
const downloadLocation = await tc.downloadTool(downloadUrl); | ||
|
||
core.info("Succesfully downloaded LLVM release, extracting...") | ||
const llvmPath = "C:\\llvm"; | ||
const _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe'); | ||
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.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); | ||
} | ||
})(); | ||
const core = require('@actions/core'); | ||
const exec = require('@actions/exec'); | ||
const tc = require('@actions/tool-cache'); | ||
const path = require('path'); | ||
|
||
const isWindows = process.platform == "win32" | ||
const isMacOS = process.platform == "darwin" | ||
const isLinux = process.platform == "linux" | ||
|
||
export async function execute(cmd) { | ||
let myOutput = ''; | ||
let myError = ''; | ||
await exec.exec(cmd, [], { | ||
listeners: { | ||
stdout: (data) => { | ||
myOutput += data.toString().trim(); | ||
}, | ||
stderr: (data) => { | ||
myError += data.toString().trim(); | ||
} | ||
} | ||
}); | ||
|
||
if (myError) { | ||
throw new Error(myError); | ||
} | ||
return myOutput; | ||
} | ||
|
||
(async () => { | ||
try { | ||
if (isLinux) { | ||
const installScript = path.join(__dirname, "../../../../scripts/install-llvm.sh"); | ||
await exec.exec(`sudo ${installScript}`); | ||
} else if (isMacOS) { | ||
await exec.exec("brew install llvm@13") | ||
let llvmPath = await execute("brew --prefix llvm@13"); | ||
core.addPath(`${llvmPath}/bin`) | ||
} else if (isWindows) { | ||
const downloadUrl = "https://github.com/mun-lang/llvm-package-windows/releases/download/v13.0.1/llvm-13.0.1-windows-x64-msvc16-mt.7z" | ||
core.info(`downloading LLVM from '${downloadUrl}'`) | ||
const downloadLocation = await tc.downloadTool(downloadUrl); | ||
|
||
core.info("Succesfully downloaded LLVM release, extracting...") | ||
const llvmPath = "C:\\llvm"; | ||
const _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe'); | ||
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.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); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.