mirror of
https://github.com/Mozilla-Actions/sccache-action.git
synced 2026-04-08 17:42:13 +08:00
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -32,4 +32,6 @@ jobs:
|
||||
|
||||
- name: Run sccache stat for check
|
||||
shell: bash
|
||||
run: ${SCCACHE_PATH} --stat
|
||||
run: |
|
||||
ls /opt/hostedtoolcache/sccache/0.3.3/x64/ -lh
|
||||
${SCCACHE_PATH} --stat
|
||||
|
||||
14
dist/index.js
vendored
14
dist/index.js
vendored
@@ -46,14 +46,22 @@ function setup() {
|
||||
// TODO: we can support install latest version by default if version
|
||||
// is not input.
|
||||
const version = core.getInput('version');
|
||||
console.log('try to setup for version: ', version);
|
||||
console.log('try to setup sccache version: ', version);
|
||||
const downloadUrl = `https://github.com/mozilla/sccache/releases/download/${version}/${getFilename(version)}`;
|
||||
console.log('try to setup from url: ', downloadUrl);
|
||||
console.log('sccache download from url: ', downloadUrl);
|
||||
// Download and extract.
|
||||
const sccachePackage = yield (0, tool_cache_1.downloadTool)(downloadUrl);
|
||||
const sccachePath = yield (0, tool_cache_1.extractTar)(sccachePackage);
|
||||
var sccachePath;
|
||||
if (getExtension() == 'zip') {
|
||||
sccachePath = yield (0, tool_cache_1.extractTar)(sccachePackage);
|
||||
}
|
||||
else {
|
||||
sccachePath = yield (0, tool_cache_1.extractTar)(sccachePackage);
|
||||
}
|
||||
console.log('sccache extracted to: ', sccachePath);
|
||||
// Cache sccache.
|
||||
const sccacheHome = yield (0, tool_cache_1.cacheDir)(sccachePath, 'sccache', version);
|
||||
console.log('sccache cached to: ', sccacheHome);
|
||||
// Add cached sccache into path.
|
||||
core.addPath(`${sccacheHome}`);
|
||||
// Expose the sccache path as env.
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import * as core from '@actions/core';
|
||||
import {downloadTool, extractTar, cacheDir} from '@actions/tool-cache';
|
||||
import {
|
||||
downloadTool,
|
||||
extractTar,
|
||||
extractZip,
|
||||
cacheDir
|
||||
} from '@actions/tool-cache';
|
||||
import {exec} from 'child_process';
|
||||
import * as fs from 'fs';
|
||||
import {promisify} from 'util';
|
||||
@@ -8,19 +13,28 @@ async function setup() {
|
||||
// TODO: we can support install latest version by default if version
|
||||
// is not input.
|
||||
const version = core.getInput('version');
|
||||
console.log('try to setup for version: ', version);
|
||||
console.log('try to setup sccache version: ', version);
|
||||
|
||||
const downloadUrl = `https://github.com/mozilla/sccache/releases/download/${version}/${getFilename(
|
||||
version
|
||||
)}`;
|
||||
console.log('try to setup from url: ', downloadUrl);
|
||||
console.log('sccache download from url: ', downloadUrl);
|
||||
|
||||
// Download and extract.
|
||||
const sccachePackage = await downloadTool(downloadUrl);
|
||||
const sccachePath = await extractTar(sccachePackage);
|
||||
|
||||
var sccachePath;
|
||||
if (getExtension() == 'zip') {
|
||||
sccachePath = await extractTar(sccachePackage);
|
||||
} else {
|
||||
sccachePath = await extractTar(sccachePackage);
|
||||
}
|
||||
console.log('sccache extracted to: ', sccachePath);
|
||||
|
||||
// Cache sccache.
|
||||
const sccacheHome = await cacheDir(sccachePath, 'sccache', version);
|
||||
console.log('sccache cached to: ', sccacheHome);
|
||||
|
||||
// Add cached sccache into path.
|
||||
core.addPath(`${sccacheHome}`);
|
||||
// Expose the sccache path as env.
|
||||
|
||||
Reference in New Issue
Block a user