-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
27 lines (24 loc) · 1.3 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const core = require('@actions/core');
const tc = require('@actions/tool-cache');
function z3URL(architecture, version, distribution) {
let path = "https://github.com/Z3Prover/z3/releases/download/z3-" + version;
let file = "z3-" + version + "-" + architecture + "-" + distribution + ".zip";
return { path: path, file: file };
}
(async function () {
try {
const architecture = core.getInput('architecture', { required: true });
const distribution = core.getInput('distribution', { required: true });
const version = core.getInput('version', { required: true });
const url = z3URL(architecture, version, distribution);
const path = await tc.downloadTool(url.path + "/" + url.file);
const dir = await tc.extractZip(path)
const cachedPath = await tc.cacheDir(dir, 'z3', version);
core.addPath(cachedPath + "/" + url.file.replace(/\.zip$/, "") + "/bin");
core.exportVariable("CPATH", cachedPath + "/" + url.file.replace(/\.zip$/, "") + "/include");
core.exportVariable("LIBRARY_PATH", cachedPath + "/" + url.file.replace(/\.zip$/, "") + "/bin");
core.exportVariable("Z3_SYS_Z3_HEADER", cachedPath + "/" + url.file.replace(/\.zip$/, "") + "/include/z3.h");
} catch (error) {
core.setFailed(error.message);
}
})();