Skip to content

Add caching to the workflow#95

Merged
AlexanderLanin merged 6 commits into
eclipse-score:mainfrom
Aymen-Soussi-01:add-caching-to-the-workflow
Jun 26, 2025
Merged

Add caching to the workflow#95
AlexanderLanin merged 6 commits into
eclipse-score:mainfrom
Aymen-Soussi-01:add-caching-to-the-workflow

Conversation

@Aymen-Soussi-01
Copy link
Copy Markdown
Contributor

@Aymen-Soussi-01 Aymen-Soussi-01 commented Jun 24, 2025

As the experiment was done, I succeeded in reducing the build time after integrating the cache for different targets( bazel and python dependencies and rst files) into 2 workflows(format and test) from 5min 11s to 1min 48s. Note that the first workflow was a bit too long as it ran and stored the cache for the first time, but the normal runtime is 3min 40s, so we almost reduced it by half
I should mention that I couldn't currently integrate the caching into more workflows as the rest of them integrate reusable workflows from other repositories and we should put the cache into the original reusable workflow repositories if we want to integrate the cache for them.

close: #89

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 24, 2025

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //src:license-check

Status: ✅ Passed

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Invocation ID: a5579c54-d205-45de-a419-0edb6a907e4d
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: src
Loading: 0 packages loaded
    currently loading: src
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //src:license-check (96 packages loaded, 10 targets configured)

Analyzing: target //src:license-check (140 packages loaded, 882 targets configured)

Analyzing: target //src:license-check (148 packages loaded, 1990 targets configured)

Analyzing: target //src:license-check (157 packages loaded, 2682 targets configured)

Analyzing: target //src:license-check (158 packages loaded, 2682 targets configured)

Analyzing: target //src:license-check (161 packages loaded, 4815 targets configured)

INFO: Analyzed target //src:license-check (162 packages loaded, 4941 targets configured).
INFO: Found 1 target...
Target //src:license.check.license_check up-to-date:
  bazel-bin/src/license.check.license_check
  bazel-bin/src/license.check.license_check.jar
INFO: Elapsed time: 16.610s, Critical Path: 0.33s
INFO: 13 processes: 4 disk cache hit, 9 internal.
INFO: Build completed successfully, 13 total actions
INFO: Running command line: bazel-bin/src/license.check.license_check src/formatted.txt -review -project automotive.score -repo https://github.com/eclipse-score/docs-as-code -token otyhZ4eaRYK1tKLNNF-Y
[main] INFO Querying Eclipse Foundation for license data for 83 items.
[main] INFO Found 58 items.
[main] INFO Querying ClearlyDefined for license data for 25 items.
[main] INFO Found 25 items.
[main] INFO Vetted license information was found for all content. No further investigation is required.

@github-actions
Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

@AlexanderLanin
Copy link
Copy Markdown
Member

I guess that's a valid solution until we have bazel remote caching. And indeed it saves ~2 minutes per run, which is 80-90% of time when docs themselves are trivial as in this repo.

However it's only applicable when docs is the only thing the workflow is building, as cache would become huge otherwise.

The hash string is missing some files?! Maybe everything in src? MODULE.bazel? Top level BUILD file? All bzl files? etc

Bazel has a disk_cache parameter, did you look into that?

And last but not least in cicd-workflows we have this action, why does it not work as-is?

      - name: Setup Bazel with shared caching
        uses: bazel-contrib/setup-bazel@0.14.0
        with:
          disk-cache: true
          repository-cache: true
          bazelisk-cache: true

@Aymen-Soussi-01
Copy link
Copy Markdown
Contributor Author

Aymen-Soussi-01 commented Jun 26, 2025

You're right — Bazel remote caching would be the ideal long-term solution. For now, this local cache setup helps save around 2 minutes per run, which is especially helpful when the docs are the only thing being built.
I’ve now improved the cache key to include more relevant files:

  • All .bazel, .bzl, and BUILD files
  • The MODULE.bazel file
  • Everything under src/, including Python files and requirements.txt

I also considered bazelisk's built-in caching (disk_cache, repository_cache)

I even used the latest version of setup-bazel, which is now 0.15.0
@AlexanderLanin You can even check now from the Actions workflow that the timing of execution of format and test workflows has been reduced in case the target files to cache are not touched

@AlexanderLanin AlexanderLanin merged commit 995415a into eclipse-score:main Jun 26, 2025
9 checks passed
arnoox pushed a commit to arnoox/score-docs-as-code that referenced this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

try setting up github cache for accelerating docs build

2 participants