add disable_annotations options to disable stats report (#162)

This commit is contained in:
Trim21
2024-11-27 21:16:18 +08:00
committed by GitHub
parent c83ccfeb86
commit 25839b6484
5 changed files with 44 additions and 1 deletions

View File

@@ -71,3 +71,28 @@ jobs:
- name: Run sccache for check
shell: bash
run: ${SCCACHE_PATH} --start-server
test_disable_annotations:
name: Test disable_annotations version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: npm
- name: npm install
run: npm install
- name: Run sccache-cache
uses: ./
with:
disable_annotations: true
- name: Run sccache for check
shell: bash
run: ${SCCACHE_PATH} --start-server

View File

@@ -52,6 +52,15 @@ Note that using the previous declaration will automatically create a
run: ${SCCACHE_PATH} --show-stats
```
### disable stats report
```
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.6
with:
disable_annotations: true
```
### Rust code
For Rust code, the following environment variables should be set:

View File

@@ -8,6 +8,9 @@ inputs:
token:
description: "Used to pull the latest release from sccache. When running this action outside of github.com, you have to pass a personal access token for github.com."
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
disable_annotations:
description: "Disable annotation generation in post-run."
default: 'false'
runs:
using: "node20"
main: "dist/setup/index.js"

File diff suppressed because one or more lines are too long

View File

@@ -29,6 +29,12 @@ async function get_output(command: string, args: string[]): Promise<string> {
}
async function show_stats() {
const disable_annotations = core.getBooleanInput('disable_annotations');
if (disable_annotations) {
core.debug('annotations generation disabled');
return;
}
core.debug('start sccache show starts');
const human_stats = await core.group('Get human-readable stats', async () => {
return get_output(`${process.env.SCCACHE_PATH}`, ['--show-stats']);