setup-node VS cache

Compare setup-node vs cache and see what are their differences.

setup-node

Set up your GitHub Actions workflow with a specific version of node.js (by actions)

cache

Cache dependencies and build outputs in GitHub Actions (by actions)
Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
setup-node cache
24 40
3,579 4,241
3.9% 2.2%
7.5 7.4
11 days ago 5 days ago
TypeScript TypeScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

setup-node

Posts with mentions or reviews of setup-node. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-12-22.
  • CI/CI deploy a static website to AWS S3 bucket through Github Actions
    5 projects | dev.to | 22 Dec 2023
    Setup environment with Nodejs and install dependencies with npm install, with Github Actions setup Node
  • VSCodium – Libre Open Source Software Binaries of VS Code
    10 projects | news.ycombinator.com | 4 Sep 2023
    No, PR review isn't the only thing that prevents these from being updated. In the yml it's set to a release branch. So it isn't especially fallible.

    https://github.com/actions/setup-node/tree/releases/v2

  • Disable Annotations in Github Actions
    5 projects | dev.to | 3 Sep 2023
  • A guide to using act with GitHub Actions
    5 projects | dev.to | 23 Mar 2023
    ➜ getting-started-with-act git:(master) act -j build WARN ⚠ You are using Apple M1 chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠ [Node.js CI/build] πŸš€ Start image=node:16-buster-slim [Node.js CI/build] 🐳 docker pull image=node:16-buster-slim platform= username= forcePull=false [Node.js CI/build] 🐳 docker create image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] [Node.js CI/build] 🐳 docker run image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] [Node.js CI/build] ☁ git clone 'https://github.com/actions/setup-node' # ref=v3 [Node.js CI/build] ☁ git clone 'https://github.com/actions/cache' # ref=v3 [Node.js CI/build] ☁ git clone 'https://github.com/actions/upload-artifact' # ref=v3 [Node.js CI/build] ⭐ Run Main actions/checkout@v3 [Node.js CI/build] 🐳 docker cp src=/Users/andrewevans/Documents/projects/getting-started-with-act/. dst=/Users/andrewevans/Documents/projects/getting-started-with-act [Node.js CI/build] βœ… Success - Main actions/checkout@v3 [Node.js CI/build] ⭐ Run Main Use Node.js 16.x [Node.js CI/build] 🐳 docker cp src=/Users/andrewevans/.cache/act/actions-setup-node@v3/ dst=/var/run/act/actions/actions-setup-node@v3/ [Node.js CI/build] 🐳 docker exec cmd=[node /var/run/act/actions/actions-setup-node@v3/dist/setup/index.js] user= workdir= [Node.js CI/build] πŸ’¬ ::debug::isExplicit: [Node.js CI/build] πŸ’¬ ::debug::explicit? false
  • Cheap Gatsby/Netlify-style Hosting?
    1 project | /r/gatsbyjs | 8 Oct 2022
    steps: # Check out the current repository code - uses: actions/checkout@v3 # 3. https://github.com/actions/setup-node#usage - name: Setup node and build Gatsby uses: actions/setup-node@v1 with: node-version: '16.x' cache: 'npm' - run: npm install # This triggers `gatsby build` script in "package.json" - run: npm run build # 4. Deploy the gatsby build to Netlify - name: Deploy to netlify uses: netlify/actions/cli@master env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} with: # 5. "gatsby build" creates "public" folder, which is what we are deploying args: deploy --dir=public --prod secrets: '["NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID"]'
  • 5 Ways to make development with GitHub Actions more efficient
    2 projects | dev.to | 27 Sep 2022
    If you see repeated build or preparation steps that do not change when your codebase changes, look into caching the results. Here is a straightforward guide to caching, but also be aware caching is built into a lot of marketplace actions anyway, e.g. actions/setup-node can cache npm dependencies.
  • Top 10 GitHub Actions You Should Use to set up your CI/CD Pipeline
    5 projects | dev.to | 12 Sep 2022
    The most popular ones are Node.js, Python, Java JDK, Go, .Net Core SDK.
  • The strongest principle of the blog's growth lies in the human choice to deploy it
    14 projects | dev.to | 3 Sep 2022
    diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml index 401fd33..3ddf6dd 100644 --- a/.github/workflows/gh-pages.yaml +++ b/.github/workflows/gh-pages.yaml @@ -11,42 +11,48 @@ on: jobs: deploy: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 + # Ensure that only a single job or workflow + # https://docs.github.com/en/actions/using-jobs/using-concurrency concurrency: + # workflow - The name of the workflow. + # ref - The branch or tag ref that triggered the workflow run. group: ${{ github.workflow }}-${{ github.ref }} steps: - uses: actions/checkout@v3 with: - submodules: true # Fetch Hugo themes (true OR recursive) fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + # https://github.com/peaceiris/actions-hugo - name: Setup Hugo uses: peaceiris/actions-hugo@v2 with: - hugo-version: '0.91.2' - # extended: true + hugo-version: '0.101.0' + # https://github.com/actions/setup-node - name: Setup Node uses: actions/setup-node@v3 with: - node-version: '14' - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - run: npm ci + node-version: '18.7.0' + cache: npm + # The action defaults to search for the dependency file (package-lock.json, + # npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its + # hash as a part of the cache key. + # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data + cache-dependency-path: ./blog/package-lock.json + + - name: Install npm dependencies + working-directory: ./blog/ + run: npm ci - name: Build - run: hugo --minify + working-directory: ./blog/ + run: npm run build + # https://github.com/peaceiris/actions-gh-pages - name: Deploy uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./public + publish_dir: ./blog/src/public
  • How Fastly manages its software with GitHub Actions
    15 projects | dev.to | 31 Aug 2022
    Well, let’s consider the scenario we had with the DevHub. We were using the third-party action setup-node to install and configure the Node.js programming language. This action lets you specify the node version to install but it can’t be a dynamically acquired value. You either have to hardcode it or interpolate the value.
  • GitHub Actions Is Down
    5 projects | news.ycombinator.com | 13 Jun 2022
    This is hitting workflows that use caching [1][2].

    - [1] https://github.com/actions/setup-node/issues/516

    - [2] https://github.com/actions/cache/issues/820

    As of now (11:28 UTC) the status page has been updated.

    https://www.githubstatus.com

cache

Posts with mentions or reviews of cache. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-09-22.
  • GitHub Actions could be so much better
    21 projects | news.ycombinator.com | 22 Sep 2023
    > with no persistent storage

    There's https://github.com/actions/cache though?

  • Optimizing GitHub Actions Performance: Enhance Workflows with Caching
    5 projects | dev.to | 19 Jun 2023
    Use Cache Actions: GitHub Actions provides cache actions that simplify caching implementation. The @actions/cache JavaScript library is a popular choice for managing caching in workflows. It offers flexible options for storing and retrieving cache artifacts based on keys, scopes, and paths.
  • Speeding up GitHub Actions with npm cache
    3 projects | dev.to | 1 Jun 2023
    GitHub maintain a set of repos called actions. One of which is called cache.
  • How I Sliced Deployment Times to a Fraction and Achieved Lightning-Fast Deployments with GitHub Actions
    5 projects | dev.to | 17 May 2023
    By utilizing the actions/cache action action, we implemented a strategy to store and retrieve dependencies, preventing redundant installations.
  • Use GitHub Actions to Make Your GitHub Profile Dynamic
    3 projects | news.ycombinator.com | 10 Apr 2023
    I do think it's good practice to enable caching, such that your script doesn't hit RubyGems / pip / npm / etc every time it runs.

    That way at least the automation activity stays entirely within the GitHub / Azure network.

    It looks like you can do that for Ruby by adding this:

    https://github.com/actions/cache/blob/master/examples.md#rub...

        - uses: ruby/setup-ruby@v1
  • A guide to using act with GitHub Actions
    5 projects | dev.to | 23 Mar 2023
    ➜ getting-started-with-act git:(master) act -j build WARN ⚠ You are using Apple M1 chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠ [Node.js CI/build] πŸš€ Start image=node:16-buster-slim [Node.js CI/build] 🐳 docker pull image=node:16-buster-slim platform= username= forcePull=false [Node.js CI/build] 🐳 docker create image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] [Node.js CI/build] 🐳 docker run image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] [Node.js CI/build] ☁ git clone 'https://github.com/actions/setup-node' # ref=v3 [Node.js CI/build] ☁ git clone 'https://github.com/actions/cache' # ref=v3 [Node.js CI/build] ☁ git clone 'https://github.com/actions/upload-artifact' # ref=v3 [Node.js CI/build] ⭐ Run Main actions/checkout@v3 [Node.js CI/build] 🐳 docker cp src=/Users/andrewevans/Documents/projects/getting-started-with-act/. dst=/Users/andrewevans/Documents/projects/getting-started-with-act [Node.js CI/build] βœ… Success - Main actions/checkout@v3 [Node.js CI/build] ⭐ Run Main Use Node.js 16.x [Node.js CI/build] 🐳 docker cp src=/Users/andrewevans/.cache/act/actions-setup-node@v3/ dst=/var/run/act/actions/actions-setup-node@v3/ [Node.js CI/build] 🐳 docker exec cmd=[node /var/run/act/actions/actions-setup-node@v3/dist/setup/index.js] user= workdir= [Node.js CI/build] πŸ’¬ ::debug::isExplicit: [Node.js CI/build] πŸ’¬ ::debug::explicit? false
  • duplicated cache by cache action
    2 projects | /r/github | 21 Feb 2023
  • runner image with MS office installed - do-able? is there a better way?
    2 projects | /r/github | 30 Dec 2022
    You could try to find some point in the process where you can set up Actions caches with actions/cache, otherwise Container customization for Self-Hosted Runners is currently in Beta.
  • [Question] Decrease Docker image's build time
    2 projects | /r/devops | 27 Sep 2022
    I would configure Github Actions cache so Docker doesn't have to compile all layers from scratch every time
  • The strongest principle of the blog's growth lies in the human choice to deploy it
    14 projects | dev.to | 3 Sep 2022
    In the copied example, npm caching is done via actions/cache@v2 action. But we can simplify our workflow by dropping this step and using built-in functionality for caching

What are some alternatives?

When comparing setup-node and cache you can also consider the following projects:

yarn - The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry

upload-artifact

setup-buildx-action - GitHub Action to set up Docker Buildx

sccache - Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.

act - Run your GitHub Actions locally πŸš€

checkout - Action for checking out a repo

actions-runner-controller - Kubernetes controller for GitHub Actions self-hosted runners

actions-gh-pages - GitHub Actions for GitHub Pages πŸš€ Deploy static files and publish your site easily. Static-Site-Generators-friendly.