Skip to content

Commit 86432fe

Browse files
authored
Merge pull request #3 from calcit-lang/debug
debug cache
2 parents 0940221 + 74f3795 commit 86432fe

File tree

6 files changed

+189
-62
lines changed

6 files changed

+189
-62
lines changed

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ inputs:
66
description: Version of Calcit install
77
required: true
88
default: 0.8.38
9+
910
runs:
1011
using: node20
1112
main: dist/index.js

dist/index.js

Lines changed: 16 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,23 @@ const fs = require("fs");
33
const core = require("@actions/core");
44
const tc = require("@actions/tool-cache");
55

6-
let getCrDownloadUrl = (version) => {
7-
return `https://github.com/calcit-lang/calcit/releases/download/${version}/cr`;
8-
};
9-
10-
let getCapsDownloadUrl = (version) => {
11-
return `https://github.com/calcit-lang/calcit/releases/download/${version}/caps`;
12-
};
13-
146
const version = core.getInput("version");
157

16-
async function setup() {
8+
const binFolder = `/home/runner/bin/`;
9+
10+
async function setup(bin) {
1711
try {
1812
// Get version of tool to be installed
1913

20-
const pathToCr = await tc.downloadTool(
21-
getCrDownloadUrl(version),
22-
"/home/runner/bin/cr"
23-
);
24-
const pathToCaps = await tc.downloadTool(
25-
getCapsDownloadUrl(version),
26-
"/home/runner/bin/caps"
27-
);
28-
29-
// TODO cache
30-
// https://github.com/actions/toolkit/tree/main/packages/tool-cache#cache
31-
32-
// Expose the tool by adding it to the PATH
33-
fs.chmodSync(pathToCr, 0o755);
34-
core.addPath(path.dirname(pathToCr));
14+
let url = `https://github.com/calcit-lang/calcit/releases/download/${version}/${bin}`;
15+
let binPath = `${binFolder}${bin}`;
3516

36-
console.log(`add to path: ${pathToCr}`);
17+
const pathToCr = await tc.downloadTool(url, binPath);
18+
console.log(`downloaded to: ${pathToCr}`);
3719

38-
fs.chmodSync(pathToCaps, 0o755);
39-
core.addPath(path.dirname(pathToCaps));
40-
console.log(`add to path: ${pathToCaps}`);
20+
fs.chmodSync(binPath, 0o755);
21+
core.addPath(binFolder);
22+
console.log(`add binary to path: ${binPath}`);
4123
} catch (e) {
4224
core.setFailed(e);
4325
}
@@ -47,5 +29,6 @@ module.exports = setup;
4729

4830
if (require.main === module) {
4931
console.log(`Setting up Calcit ${version}`);
50-
setup();
32+
setup("cr");
33+
setup("caps");
5134
}

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
{
22
"name": "setup-cr",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Setup Calcit runtime",
55
"main": "./index.js",
66
"repository": "[email protected]:calcit-lang/setup-cr.git",
77
"author": "tiye <[email protected]>",
88
"license": "MIT",
99
"scripts": {
10-
"dist": "ncc build index.js -o dist --source-map"
10+
"dist": "ncc build index.js -o dist --source-map",
11+
"stage-dist": "git add -v dist"
1112
},
13+
"pre-commit": [
14+
"dist",
15+
"stage-dist"
16+
],
1217
"dependencies": {
1318
"@actions/core": "^1.10.1",
1419
"@actions/tool-cache": "^2.0.1"
1520
},
1621
"devDependencies": {
17-
"@vercel/ncc": "^0.38.1"
22+
"@vercel/ncc": "^0.38.1",
23+
"pre-commit": "^1.2.2"
1824
}
1925
}

yarn.lock

Lines changed: 150 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)