31 Commits

Author SHA1 Message Date
Sylvestre Ledru
89e9040de8 new upstream release 2024-06-17 13:38:29 +02:00
Sylvestre Ledru
e87392bdf6 prepare sccache-action 0.0.5 2024-06-17 13:17:49 +02:00
Sylvestre Ledru
b4427f4656 Merge pull request #121 from Mozilla-Actions/dependabot/npm_and_yarn/prettier-3.3.2
Bump prettier from 3.2.5 to 3.3.2
2024-06-17 13:11:41 +02:00
dependabot[bot]
e759f84286 Bump prettier from 3.2.5 to 3.3.2
Bumps [prettier](https://github.com/prettier/prettier) from 3.2.5 to 3.3.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.2.5...3.3.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 09:59:17 +00:00
Sylvestre Ledru
b12911431e Merge pull request #118 from Mozilla-Actions/dependabot/npm_and_yarn/ts-jest-29.1.4
Bump ts-jest from 29.1.2 to 29.1.4
2024-06-17 11:58:17 +02:00
Sylvestre Ledru
fb41e19ae3 Merge pull request #120 from Mozilla-Actions/dependabot/npm_and_yarn/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3
2024-06-17 11:58:10 +02:00
dependabot[bot]
83e296b04b Bump braces from 3.0.2 to 3.0.3
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 09:56:37 +00:00
Sylvestre Ledru
511fd3c7f0 Merge pull request #117 from Mozilla-Actions/dependabot/npm_and_yarn/typescript-eslint/parser-7.11.0
Bump @typescript-eslint/parser from 7.8.0 to 7.11.0
2024-06-17 11:56:19 +02:00
Sylvestre Ledru
d4fcccfce3 Merge pull request #115 from Mozilla-Actions/dependabot/npm_and_yarn/types/node-20.13.0
Bump @types/node from 20.12.11 to 20.13.0
2024-06-17 11:56:11 +02:00
Sylvestre Ledru
aece89f750 Merge pull request #113 from orf/add-notice-output
Output sccache stats as a notice and a summary table
2024-06-17 11:55:57 +02:00
dependabot[bot]
0c4d1a08d8 Bump ts-jest from 29.1.2 to 29.1.4
Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 29.1.2 to 29.1.4.
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/kulshekhar/ts-jest/compare/v29.1.2...v29.1.4)

---
updated-dependencies:
- dependency-name: ts-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-01 22:50:03 +00:00
dependabot[bot]
103918ffd4 Bump @typescript-eslint/parser from 7.8.0 to 7.11.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 7.8.0 to 7.11.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.11.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-01 22:49:55 +00:00
dependabot[bot]
aa6abb83bc Bump @types/node from 20.12.11 to 20.13.0
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.12.11 to 20.13.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-01 22:49:34 +00:00
Thomas Forbes
ab76965574 Add % to cache hit table 2024-05-12 22:05:24 +01:00
Thomas Forbes
2f1ba39e7a Calculate percentage, add JSON stats output 2024-05-12 21:00:34 +01:00
Tom Forbes
d947000745 Output sccache stats as a notice and a summary table 2024-05-12 20:19:14 +01:00
Sylvestre Ledru
f2edb47f42 Merge pull request #114 from orf/bump-dependencies
Bump outdated CI workflows and packages
2024-05-12 21:06:22 +02:00
Tom Forbes
1e8091c415 Bump outdated CI workflows and packages 2024-05-12 13:07:40 +01:00
Sylvestre Ledru
9c0df0382a Merge pull request #109 from Alphare/my-first-contribution
chore: fix a typo in a comment
2024-04-23 11:19:42 +02:00
Raphaël Gomès
8ebd5a4380 chore: fix a typo in a comment 2024-04-23 11:04:15 +02:00
Sylvestre Ledru
7d0144b782 Merge pull request #103 from altendky/add_quotes
add missing quotes to `configure` example in readme
2024-03-05 15:19:48 +01:00
Kyle Altendorf
8272dac7aa add missing quotes to configure example in readme 2024-03-05 09:16:15 -05:00
dependabot[bot]
e1a9194714 Bump undici from 5.28.2 to 5.28.3 (#99)
Bumps [undici](https://github.com/nodejs/undici) from 5.28.2 to 5.28.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.2...v5.28.3)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-03 01:01:27 +08:00
dependabot[bot]
27a476c863 Bump eslint-plugin-jest from 27.6.0 to 27.9.0 (#101)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 27.6.0 to 27.9.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v27.6.0...v27.9.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-03 00:58:25 +08:00
dependabot[bot]
b3f939aca5 Bump @types/node from 20.10.6 to 20.11.24 (#102)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.10.6 to 20.11.24.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-03 00:58:18 +08:00
Sylvestre Ledru
6c6e91ca40 Merge pull request #97 from Mozilla-Actions/dependabot/npm_and_yarn/actions/github-6.0.0
Bump @actions/github from 5.1.1 to 6.0.0
2024-02-02 09:27:15 +01:00
dependabot[bot]
5320dad1f6 Bump @actions/github from 5.1.1 to 6.0.0
Bumps [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github) from 5.1.1 to 6.0.0.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

---
updated-dependencies:
- dependency-name: "@actions/github"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-02 07:54:10 +00:00
Sylvestre Ledru
9bdd511a9c Merge pull request #96 from Mozilla-Actions/dependabot/npm_and_yarn/eslint-config-prettier-9.1.0
Bump eslint-config-prettier from 9.0.0 to 9.1.0
2024-02-02 08:52:54 +01:00
Sylvestre Ledru
5b7824cab2 Merge pull request #95 from Mozilla-Actions/dependabot/npm_and_yarn/actions/core-1.10.1
Bump @actions/core from 1.10.0 to 1.10.1
2024-02-02 08:52:29 +01:00
dependabot[bot]
aff01f2a9b Bump eslint-config-prettier from 9.0.0 to 9.1.0
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 9.0.0 to 9.1.0.
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v9.0.0...v9.1.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 22:51:49 +00:00
dependabot[bot]
fb137f92c9 Bump @actions/core from 1.10.0 to 1.10.1
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.10.0 to 1.10.1.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 22:51:19 +00:00
8 changed files with 2246 additions and 10979 deletions

View File

@@ -21,11 +21,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x
cache: npm
- name: npm install
@@ -52,12 +52,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set Node.js 16.x
uses: actions/setup-node@v3
- name: Set Node.js
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x
cache: npm
- name: npm install

View File

@@ -81,9 +81,9 @@ With cmake, add the following argument:
With configure, call it with:
```
# With gcc
./configure CC="sccache gcc" CXX=sccache gcc"
./configure CC="sccache gcc" CXX="sccache gcc"
# With clang
./configure CC="sccache clang" CXX=sccache clang"
./configure CC="sccache clang" CXX="sccache clang"
```
## Prepare a new release

10
dist/setup/index.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

13010
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,11 @@
{
"name": "sccache-action",
"version": "0.0.3",
"version": "0.0.5",
"description": "Github Action for Sccache",
"main": "dist/setup/index.js",
"engines": {
"node": ">=16"
},
"scripts": {
"build-dist": "ncc build lib/setup.js -m -o dist/setup/ && ncc build lib/show_stats.js -m -o dist/show_stats",
"build": "prettier --write **/*.ts && tsc && npm run build-dist",
@@ -25,25 +28,25 @@
},
"homepage": "https://github.com/mozilla-actions/sccache-action#readme",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1"
},
"devDependencies": {
"@types/jest": "^27.4.1",
"@types/node": "^20.10.6",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@types/jest": "^29.5.12",
"@types/node": "^20.13.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.11.0",
"@vercel/ncc": "^0.38.1",
"eslint-config-prettier": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^27.5.1",
"eslint-plugin-jest": "^28.5.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"prettier": "^2.8.8",
"ts-jest": "^27.1.4",
"typescript": "^4.9.5"
"prettier": "^3.3.2",
"ts-jest": "^29.1.4",
"typescript": "^5.4.5"
}
}

View File

@@ -89,7 +89,7 @@ async function setup() {
// Expose the sccache path as env.
core.exportVariable('SCCACHE_PATH', `${sccacheHome}/sccache`);
// Expose the gha cache related variable to make users easier to
// Expose the gha cache related variable to make it easier for users to
// integrate with gha support.
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable(

View File

@@ -14,24 +14,150 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import {SummaryTableRow} from '@actions/core/lib/summary';
async function get_output(command: string, args: string[]): Promise<string> {
core.debug(`get_output: ${command} ${args.join(' ')}`);
const output = await exec.getExecOutput(command, args);
// --stats-format=json does not emit a newline, which messes up group
// processing. Here we add a newline if it's missing.
if (!output.stdout.endsWith('\n')) {
process.stdout.write('\n');
}
return output.stdout.toString();
}
async function show_stats() {
core.debug('start sccache show starts');
const defaultListener = {
stdout: (data: Buffer) => {
stdout.push(data.toString());
}
};
const stdout: string[] = [];
await exec.getExecOutput(`${process.env.SCCACHE_PATH}`, ['--show-stats'], {
listeners: defaultListener
const human_stats = await core.group('Get human-readable stats', async () => {
return get_output(`${process.env.SCCACHE_PATH}`, ['--show-stats']);
});
const json_stats = await core.group('Get JSON stats', async () => {
return get_output(`${process.env.SCCACHE_PATH}`, [
'--show-stats',
'--stats-format=json'
]);
});
const stats: Stats = JSON.parse(json_stats);
const formatted_stats = format_json_stats(stats);
core.notice(formatted_stats.notice, {
title: 'sccache stats'
});
core.info('\nFull human-readable stats:');
core.info(human_stats);
core.summary.addHeading('sccache stats', 2);
core.summary.addTable(formatted_stats.table);
core.summary.addDetails(
'Full human-readable stats',
'\n\n```\n' + human_stats + '\n```\n\n'
);
core.summary.addDetails(
'Full JSON Stats',
'\n\n```json\n' + JSON.stringify(stats, null, 2) + '\n```\n\n'
);
await core.summary.write();
}
show_stats().catch(err => {
core.error(err);
core.setFailed(err.message);
});
interface Duration {
secs: number;
nanos: number;
}
interface Counter {
counts: {
[key: string]: number;
};
adv_counts: {
[key: string]: number;
};
}
interface Stats {
stats: {
compile_requests: number;
requests_executed: number;
cache_errors: Counter;
cache_hits: Counter;
cache_misses: Counter;
cache_write_errors: number;
cache_writes: number;
cache_write_duration: Duration;
cache_read_hit_duration: Duration;
compiler_write_duration: Duration;
};
}
function sum_stats(stats: Counter): number {
return Object.values(stats.counts).reduce((acc, val) => acc + val, 0);
}
function format_duration(duration: Duration): string {
const ms = duration.nanos / 1e6;
return `${duration.secs}s ${ms}ms`;
}
function format_json_stats(stats: Stats): {
table: SummaryTableRow[];
notice: string;
} {
const cache_error_count = sum_stats(stats.stats.cache_errors);
const cache_hit_count = sum_stats(stats.stats.cache_hits);
const cache_miss_count = sum_stats(stats.stats.cache_misses);
const total_hits = cache_hit_count + cache_miss_count + cache_error_count;
const ratio = percentage(cache_hit_count, total_hits);
const write_duration = format_duration(stats.stats.cache_write_duration);
const read_duration = format_duration(stats.stats.cache_read_hit_duration);
const compiler_duration = format_duration(
stats.stats.compiler_write_duration
);
const notice = `${ratio}% - ${cache_hit_count} hits, ${cache_miss_count} misses, ${cache_error_count} errors`;
const table = [
[{data: 'Cache hit %', header: true}, {data: `${ratio}%`}],
[{data: 'Cache hits', header: true}, {data: cache_hit_count.toString()}],
[{data: 'Cache misses', header: true}, {data: cache_miss_count.toString()}],
[
{data: 'Cache errors', header: true},
{data: cache_error_count.toString()}
],
[
{data: 'Compile requests', header: true},
{data: stats.stats.compile_requests.toString()}
],
[
{data: 'Requests executed', header: true},
{data: stats.stats.requests_executed.toString()}
],
[
{data: 'Cache writes', header: true},
{data: stats.stats.cache_writes.toString()}
],
[
{data: 'Cache write errors', header: true},
{data: stats.stats.cache_write_errors.toString()}
],
[{data: 'Cache write duration', header: true}, {data: write_duration}],
[{data: 'Cache read hit duration', header: true}, {data: read_duration}],
[{data: 'Compiler write duration', header: true}, {data: compiler_duration}]
];
return {table, notice};
}
function percentage(x: number, y: number): number {
return Math.round((x / y) * 100 || 0);
}