forked from pavpanchekha/setup-z3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
25 lines (22 loc) · 992 Bytes
/
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
const core = require('@actions/core');
const tc = require('@actions/tool-cache');
function z3URL(architecture, version) {
let distribution = "ubuntu-16.04";
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');
const version = core.getInput('version');
const url = z3URL(architecture, version);
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");
} catch (error) {
core.setFailed(error.message);
}
})();