mirror of
https://github.com/Mozilla-Actions/sccache-action.git
synced 2026-04-08 17:42:13 +08:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbf689686c | ||
|
|
b08827a805 | ||
|
|
c41c02b356 | ||
|
|
1b907c38b9 | ||
|
|
17f1652a56 | ||
|
|
9d29337feb | ||
|
|
91401894d5 | ||
|
|
09ad278de7 | ||
|
|
bafd42bd91 | ||
|
|
031a5729cc | ||
|
|
944c5dd5a3 | ||
|
|
0ee70161fd | ||
|
|
f3c286174b | ||
|
|
9b4b4271a2 | ||
|
|
362fd1f28a | ||
|
|
306a86b3f6 | ||
|
|
afdb6b9946 | ||
|
|
f136be3826 | ||
|
|
8690384f78 | ||
|
|
bb39a37bf6 | ||
|
|
4097539ece | ||
|
|
e54ef79281 | ||
|
|
b15a83f9da | ||
|
|
21fd90ad71 | ||
|
|
5418419c3e | ||
|
|
80b4af770d | ||
|
|
407a484056 | ||
|
|
7d986dd989 | ||
|
|
c3f03b40d2 | ||
|
|
213d335d8b |
12
.github/workflows/CI.yml
vendored
12
.github/workflows/CI.yml
vendored
@@ -21,9 +21,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: npm
|
||||
@@ -52,10 +52,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: npm
|
||||
@@ -77,10 +77,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: npm
|
||||
|
||||
@@ -16,7 +16,7 @@ Just copy and paste the following in your GitHub action:
|
||||
|
||||
```
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.8
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
```
|
||||
|
||||
### Conditionally run cache and enable it
|
||||
@@ -24,7 +24,7 @@ Just copy and paste the following in your GitHub action:
|
||||
```
|
||||
- name: Run sccache-cache only on non-release runs
|
||||
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
||||
uses: mozilla-actions/sccache-action@v0.0.8
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
- name: Set Rust caching env vars only on non-release runs
|
||||
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
||||
run: |
|
||||
@@ -38,7 +38,7 @@ Versions prior to sccache v0.10.0 probably will not work.
|
||||
|
||||
```
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.8
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
with:
|
||||
version: "v0.10.0"
|
||||
```
|
||||
@@ -103,7 +103,7 @@ When using the action on GitHub Enterprise Server installations a valid GitHub.c
|
||||
|
||||
```
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.8
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
with:
|
||||
token: ${{ secrets.MY_GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
6
dist/setup/index.js
vendored
6
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
6
dist/show_stats/index.js
vendored
6
dist/show_stats/index.js
vendored
File diff suppressed because one or more lines are too long
1512
package-lock.json
generated
1512
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sccache-action",
|
||||
"version": "0.0.8",
|
||||
"version": "0.0.9",
|
||||
"description": "Github Action for Sccache",
|
||||
"main": "dist/setup/index.js",
|
||||
"engines": {
|
||||
@@ -29,24 +29,24 @@
|
||||
"homepage": "https://github.com/mozilla-actions/sccache-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/io": "^1.1.3",
|
||||
"@actions/github": "^6.0.1",
|
||||
"@actions/io": "^2.0.0",
|
||||
"@actions/tool-cache": "^2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^22.13.0",
|
||||
"@types/node": "^22.13.17",
|
||||
"@typescript-eslint/eslint-plugin": "^7.16.1",
|
||||
"@typescript-eslint/parser": "^7.11.0",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jest": "^28.11.0",
|
||||
"eslint-plugin-prettier": "^5.2.3",
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"prettier": "^3.4.2",
|
||||
"ts-jest": "^29.2.6",
|
||||
"typescript": "^5.7.2"
|
||||
"prettier": "^3.5.3",
|
||||
"ts-jest": "^29.4.6",
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
10
src/setup.ts
10
src/setup.ts
@@ -66,6 +66,9 @@ async function setup() {
|
||||
// Expose the sccache path as env.
|
||||
core.exportVariable('SCCACHE_PATH', `${sccacheHome}/sccache`);
|
||||
|
||||
// Force the github action v2
|
||||
core.exportVariable('ACTIONS_CACHE_SERVICE_V2', `on`);
|
||||
|
||||
// Expose the gha cache related variable to make it easier for users to
|
||||
// integrate with gha support.
|
||||
core.exportVariable(
|
||||
@@ -157,12 +160,7 @@ function getPlatform(): Error | string {
|
||||
}
|
||||
|
||||
function getExtension(): string {
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
return 'zip';
|
||||
default:
|
||||
return 'tar.gz';
|
||||
}
|
||||
return 'tar.gz';
|
||||
}
|
||||
|
||||
setup().catch(err => {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
import * as core from '@actions/core';
|
||||
import {context} from '@actions/github';
|
||||
import * as exec from '@actions/exec';
|
||||
import {SummaryTableRow} from '@actions/core/lib/summary';
|
||||
|
||||
@@ -50,8 +51,9 @@ async function show_stats() {
|
||||
const formatted_stats = format_json_stats(stats);
|
||||
|
||||
core.notice(formatted_stats.notice, {
|
||||
title: 'sccache stats'
|
||||
title: `sccache stats - ${context.job}`
|
||||
});
|
||||
|
||||
core.info('\nFull human-readable stats:');
|
||||
core.info(human_stats);
|
||||
|
||||
@@ -131,7 +133,10 @@ function format_json_stats(stats: Stats): {
|
||||
stats.stats.compiler_write_duration
|
||||
);
|
||||
|
||||
const notice = `${ratio}% - ${cache_hit_count} hits, ${cache_miss_count} misses, ${cache_error_count} errors`;
|
||||
const notice_hit = plural(cache_hit_count, 'hit');
|
||||
const notice_miss = plural(cache_miss_count, 'miss', 'misses');
|
||||
const notice_error = plural(cache_error_count, 'error');
|
||||
const notice = `${ratio}% - ${notice_hit}, ${notice_miss}, ${notice_error}`;
|
||||
|
||||
const table = [
|
||||
[{data: 'Cache hit %', header: true}, {data: `${ratio}%`}],
|
||||
@@ -167,3 +172,7 @@ function format_json_stats(stats: Stats): {
|
||||
function percentage(x: number, y: number): number {
|
||||
return Math.round((x / y) * 100 || 0);
|
||||
}
|
||||
|
||||
function plural(count: number, base: string, plural = base + 's'): string {
|
||||
return `${count} ${count === 1 ? base : plural}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user