Skip to content

refactor(ci): fix fetch-depth and add some caching #5563

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

Merged
merged 4 commits into from
Sep 19, 2022
Merged

Conversation

jsjoeio
Copy link
Contributor

@jsjoeio jsjoeio commented Sep 16, 2022

This adds caching for the node_modules in platform steps, quilt and fixes the fetch-depth so checkouts are faster.

Also renames ci.yaml -> build.yaml.

Fixes N/A

@jsjoeio jsjoeio self-assigned this Sep 16, 2022
@jsjoeio jsjoeio requested a review from a team as a code owner September 16, 2022 18:23
@github-actions
Copy link

github-actions bot commented Sep 16, 2022

✨ code-server docs for PR #5563 is ready! It will be updated on every commit.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Sep 16, 2022

Ah, right, we have node_modules in /test so I need to cache those too.

@jsjoeio jsjoeio marked this pull request as draft September 16, 2022 19:30
@jsjoeio jsjoeio temporarily deployed to npm September 16, 2022 19:47 Inactive
@github-actions
Copy link

github-actions bot commented Sep 16, 2022

✨ code-server dev build published to npm for PR #5563!

  • Last publish status: success
  • Commit: 79d0ea2

To install in a local project, run:

npm install @coder/code-server-pr@5563

To install globally, run:

npm install -g @coder/code-server-pr@5563

@codecov
Copy link

codecov bot commented Sep 16, 2022

Codecov Report

Merging #5563 (79d0ea2) into main (987c68a) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5563   +/-   ##
=======================================
  Coverage   72.44%   72.44%           
=======================================
  Files          30       30           
  Lines        1673     1673           
  Branches      366      366           
=======================================
  Hits         1212     1212           
  Misses        398      398           
  Partials       63       63           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 987c68a...79d0ea2. Read the comment docs.

@jsjoeio jsjoeio temporarily deployed to npm September 16, 2022 21:41 Inactive
@jsjoeio jsjoeio force-pushed the jsjoeio/cache-money branch from e0e014f to 733dac4 Compare September 16, 2022 22:31
@jsjoeio jsjoeio changed the title feat(ci): cache submodules refactor(ci): fix fetch-depth and add some caching Sep 16, 2022
@@ -40,9 +37,14 @@ jobs:

- name: Install helm
uses: azure/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes warning from helm. Token needed for v3 and later.

token: ${{ secrets.GITHUB_TOKEN }}

- name: Install helm kubeval plugin
run: helm plugin install https://github.com/instrumenta/helm-kubeval
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need this for our lint.sh to actually lint the Helm chart.

@jsjoeio jsjoeio marked this pull request as ready for review September 16, 2022 22:34
@jsjoeio jsjoeio temporarily deployed to npm September 16, 2022 22:54 Inactive
@jsjoeio jsjoeio temporarily deployed to npm September 16, 2022 23:15 Inactive
@jsjoeio jsjoeio enabled auto-merge (squash) September 17, 2022 04:09
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Love seeing that yaml file finally renamed.

submodules: true

- name: Install quilt
run: sudo apt update && sudo apt install quilt
uses: awalsh128/cache-apt-pkgs-action@latest
Copy link
Member

Choose a reason for hiding this comment

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

Neat action!

Comment on lines +265 to +272
- name: Fetch dependencies from cache
id: cache-node-modules
uses: actions/cache@v3
with:
path: "**/node_modules"
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-build-
Copy link
Member

Choose a reason for hiding this comment

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

It looks like we could add this block to the package-linux-cross step as well.

I think we might want to add platform keys so we cache separately for different platforms. The reason being is that I vaguely recall seeing native modules not rebuild if they already exist even if they are for the wrong platform.

So something like:

          key: yarn-build-linux-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            yarn-build-linux-

Also the yarn release:standalone script runs npm install and it would be nice to cache those modules as well but we could handle that in another PR. But broadly speaking I think we could remove the standalone script and put those steps straight into the yaml instead that way we can gate the install behind the cache hit. I also think we could just do it straight in release instead of copying everything to a release-standalone directory first.

Copy link
Member

Choose a reason for hiding this comment

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

Alternatively we could remove just the npm install line and put that in the yaml. Or make yarn release:standalone take an argument for whether to install.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good thinking! I'm going to add this to my todo list since I didn't get to it here. I'm thinking we do the approach you suggested and move the platform steps out of build.yaml so maybe I can tackle this with that!

Comment on lines +407 to +414
- name: Fetch dependencies from cache
id: cache-node-modules
uses: actions/cache@v3
with:
path: "**/node_modules"
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-build-
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as previous except yarn-build-macos-.

@jsjoeio jsjoeio merged commit 4223cf6 into main Sep 19, 2022
@jsjoeio jsjoeio deleted the jsjoeio/cache-money branch September 19, 2022 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants