Skip to content

Conversation

@david-luna
Copy link
Contributor

@david-luna david-luna commented Oct 29, 2025

Which problem is this PR solving?

Improve compilation times by adding a compilation cache which contains the artefacts form the last commit in main. Ref: #3136 (comment)

Short description of the changes

  • add a global compilation cache with the cache action https://github.com/actions/cache so its available for all workflow runs
  • compilation step restores that cache and uses it for compilation.
  • if build happens in main branch (push event) workflow updates the global cache
  • on PRs workflow uploads specific cache for test jobs as it was done before

@david-luna david-luna requested a review from a team as a code owner October 29, 2025 18:42
Comment on lines +30 to +32
# Note: we restore the last compilation form main branch
# so NX will only compile what has changed since then.
# Cache action is used because can be restores from dfferen workfow runs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Note: we restore the last compilation form main branch
# so NX will only compile what has changed since then.
# Cache action is used because can be restores from dfferen workfow runs
# Restore the nx compilation cache for the latest commit to main.
# The subsequent 'npm run compile' should only need to compile changed packages.

# so NX will only compile what has changed since then.
# Cache action is used because can be restores from dfferen workfow runs
- name: Compile Cache Lookup
uses: actions/cache/restore@v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to consider not using the cache for pushes to "main"?
IIUC, the way it is now, that compile-cache-main will never start fresh. After a year, it will have a year of possible cruft in it, right? I realize that would mean doing a full clean npm run compile for pushes to main, but we'd still get the benefit of the cache for the more common updates to PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants