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

Update workflows to use real build cache #2196

Merged
merged 4 commits into from
Oct 9, 2024

Conversation

Swiddis
Copy link
Collaborator

@Swiddis Swiddis commented Oct 9, 2024

Description

Following opensearch-project/OpenSearch-Dashboards#8472 and #2188, this PR switches the cache to the actual build target directories to speed up caching dramatically.

Issues Resolved

Resolves #2188
Avenges #925

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Yarn Cache
uses: actions/cache@v4
Copy link
Member

Choose a reason for hiding this comment

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

why removing yarn cache? do they actually work? i remember trying to set it up long time ago but didn't work for some reason

Copy link
Collaborator Author

@Swiddis Swiddis Oct 9, 2024

Choose a reason for hiding this comment

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

In the unit tests they have no performance diff still -- the compilation is implicit to jest/babel

Optimizing jest will need separate work since even if the cache is there it won't get used (you see it when you run yarn test with any specific file). Something about Babel and jest-ts not cooperating very well. I had historic success trying the fixes discussed at https://stackoverflow.com/questions/45087018/jest-simple-tests-are-slow, maybe I'll try to make a benchmarked PR out of it

Copy link
Member

Choose a reason for hiding this comment

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

there are two caches, npm packages and transpiled/optimized javascript. does cache for npm packages work in this workflow?

Copy link
Collaborator Author

@Swiddis Swiddis Oct 9, 2024

Choose a reason for hiding this comment

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

You would expect so, but it doesn't look like it. Bootstrap also doesn't have a noticeable speedup by caching just the packages.

Copy link
Member

Choose a reason for hiding this comment

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

yeah i think i saw similar results when i tried it, not sure why

Copy link
Collaborator

@TackAdam TackAdam left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
@Swiddis Swiddis merged commit c146bc8 into opensearch-project:main Oct 9, 2024
11 of 18 checks passed
@Swiddis Swiddis deleted the feature/real-build-cache branch October 9, 2024 21:06
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/dashboards-observability/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/dashboards-observability/backport-2.x
# Create a new branch
git switch --create backport/backport-2196-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 c146bc85ec24144799fe438da9ed6c7fd91eab37
# Push it to GitHub
git push --set-upstream origin backport/backport-2196-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/dashboards-observability/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-2196-to-2.x.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 9, 2024
* Update workflows to use real build cache

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>

* Update snapshots

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>

* Update snapshots

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>

* Are You There Snapshots? It's Me, Margaret.

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>

---------

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
(cherry picked from commit c146bc8)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
RyanL1997 pushed a commit that referenced this pull request Oct 18, 2024
* Update workflows to use real build cache



* Update snapshots



* Update snapshots



* Are You There Snapshots? It's Me, Margaret.



---------


(cherry picked from commit c146bc8)

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

[FEATURE] [CI] Cache build artifacts to reduce build times
4 participants