Skip to content

Commit

Permalink
add disable_annotations options to disable stats report (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 authored Nov 27, 2024
1 parent c83ccfe commit 25839b6
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion dist/show_stats/index.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/show_stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit 25839b6

Please sign in to comment.