Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add disable_annotations options to disable stats report #162

Merged
merged 4 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading