Skip to content

Commit

Permalink
clear fake cache feature; preparing 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Mar 8, 2024
1 parent 6b48b76 commit 74f3795
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 72 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,6 @@ jobs:
with:
version: ${{ matrix.version }}

- name: Try Calcit
run: |
cr -e "range 20"
- name: Clear bin
run: |
rm -rfv /home/runner/bin/
- name: Setup Calcit skip cache
uses: ./
with:
version: ${{ matrix.version }}
skipCache: true

- name: Try Calcit
run: |
cr -e "range 20"
- name: Clear bin
run: |
rm -rfv /home/runner/bin/
- name: Setup Calcit with cache
uses: ./
with:
version: ${{ matrix.version }}
skipCache: false

- name: Capture Calcit
run: |
cr --help
Expand Down
5 changes: 1 addition & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ inputs:
description: Version of Calcit install
required: true
default: 0.8.38
skipCache:
description: Disable Cache
required: false
default: false

runs:
using: node20
main: dist/index.js
Expand Down
22 changes: 3 additions & 19 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

22 changes: 3 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const core = require("@actions/core");
const tc = require("@actions/tool-cache");

const version = core.getInput("version");
const skipCache = core.getInput("skipCache");

const binFolder = `/home/runner/bin/`;

Expand All @@ -13,26 +12,11 @@ async function setup(bin) {
// Get version of tool to be installed

let url = `https://github.com/calcit-lang/calcit/releases/download/${version}/${bin}`;

let prevCr = tc.find(bin, version, "ubuntu");
let binPath = `${binFolder}${bin}`;

console.log(`cache is: ${prevCr}`);
if (prevCr && !skipCache) {
fs.copyFileSync(prevCr, binPath);
console.log(`use cached: ${prevCr}`);
} else {
const pathToCr = await tc.downloadTool(url, binPath);
console.log(`downloaded to: ${pathToCr}`);
const cachedPath = await tc.cacheFile(
pathToCr,
bin,
bin,
version,
"ubuntu"
);
console.log(`cached to: ${cachedPath}`);
}
const pathToCr = await tc.downloadTool(url, binPath);
console.log(`downloaded to: ${pathToCr}`);

fs.chmodSync(binPath, 0o755);
core.addPath(binFolder);
console.log(`add binary to path: ${binPath}`);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-cr",
"version": "0.0.2",
"version": "0.0.3",
"description": "Setup Calcit runtime",
"main": "./index.js",
"repository": "[email protected]:calcit-lang/setup-cr.git",
Expand Down

0 comments on commit 74f3795

Please sign in to comment.