Skip to content

Commit 8a4720d

Browse files
committed
[CI] Enabled logging of sccache diagnostics.
1 parent cdfadc8 commit 8a4720d

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/ClangSharp.Pathogen.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ jobs:
8282

8383
- name: Load LLVM sccache
8484
id: cached-sccache
85-
if: steps.cached-llvm.outputs.cache-hit != 'true'
85+
# Always save the (potentially partial) sccache database so it can be used to accelerate subsequent builds when an intermittent failure occurs
86+
if: steps.cached-llvm.outputs.cache-hit != 'true' && always()
8687
uses: actions/cache@v2
8788
# If you change this configuration make sure to update keep-cache-warm.yml as well.
8889
with:
@@ -105,8 +106,17 @@ jobs:
105106
run: ${{matrix.build-command}}
106107

107108
- name: Show sccache statistics
108-
if: steps.cached-llvm.outputs.cache-hit != 'true'
109-
run: sccache --show-stats
109+
if: steps.cached-llvm.outputs.cache-hit != 'true' && always()
110+
run: sccache --show-stats 2>&1 | tee ${{steps.sccache.outputs.root-directory}}/sccache-stats.txt
111+
112+
- name: Save sccache logs
113+
uses: actions/upload-artifact@v2
114+
if: steps.cached-llvm.outputs.cache-hit != 'true' && always()
115+
with:
116+
name: llvm-${{matrix.rid}}-sccache-logs
117+
path: |
118+
${{steps.sccache.outputs.log-file-path}}
119+
${{steps.sccache.outputs.root-directory}}/sccache-stats.txt
110120
111121
# The GitHub Actions cache gets confused by the symlink so we need to remove it
112122
- name: Unsymlink libclang

.github/workflows/install-sccache.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@
4646
# The binary is placed in a subdirectory of its download hash to ensure we don't re-use an old version.
4747
sccache_root = os.path.join(os.getcwd(), "build-sccache")
4848
sccache_cache_directory = os.path.join(sccache_root, "cache")
49+
sccache_cache_log_file_path = os.path.join(sccache_root, "sccache.log")
4950

5051
sccache_directory = os.path.join(sccache_root, expected_hash)
5152
sccache_binary_location = os.path.join(sccache_directory, binary_name)
5253
os.makedirs(sccache_directory, exist_ok=True)
5354

5455
# Add sccache to the workspace path and configure sccache's cache directory
5556
gha.set_output('root-directory', sccache_root)
57+
gha.set_output('log-file-path', sccache_cache_log_file_path)
5658
gha.set_environment_variable('SCCACHE_DIR', sccache_cache_directory)
59+
gha.set_environment_variable('SCCACHE_ERROR_LOG', sccache_cache_log_file_path)
60+
gha.set_environment_variable('SCCACHE_LOG', 'info')
5761
gha.add_path(sccache_directory)
5862

5963
# If the output path already exists, no need to download

0 commit comments

Comments
 (0)