Skip to content

A Github action to set up Turborepo Remote Caching to work with GitHub Actions' built-in cache instead of Vercel one

License

Notifications You must be signed in to change notification settings

rharkor/caching-for-turbo

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Caching for Turborepo with GitHub Actions

CI Status

Supercharge your Turborepo builds with our dedicated GitHub Actions caching service, designed to make your CI workflows faster and more efficient.

Why This Project?

This GitHub Action provides an alternative approach to Turborepo vercel remote caching in CI/CD pipelines. While Vercel's official solution works well, there are some key advantages to using this action:

1. Independent from Vercel

  • No need for Vercel account or tokens
  • Works entirely within GitHub's ecosystem
  • Reduces external service dependencies
  • Free forever

2. Granular Caching

The main technical difference lies in how caching is handled:

Vercel's Approach

  • Uses a remote caching server hosted by Vercel
  • Become expensive for large monorepos with multiple apps/packages
  • May have limitations based on your Vercel plan

This Action's Approach

  • Simulates a local remote caching server on localhost:41230
  • Uses GitHub Actions' built-in caching system
  • Github will automatically remove old cache entries

3. When to Use This?

This solution might be better when:

  • You have a large monorepo with multiple apps/packages
  • You want to avoid external service dependencies
  • You need more control over your caching strategy
  • You want to leverage GitHub's existing infrastructure

However, if you're already using Vercel and their remote caching works well for your needs, there's no pressing need to switch. Both solutions are valid approaches to the same problem.

Quick Start

Easily integrate our caching action into your GitHub Actions workflow by adding the following step before you run turbo build:

- name: Cache for Turbo
  uses: rharkor/[email protected]

This GitHub Action facilitates:

  1. Server Initialization: Automatically spins up a server on localhost:41230.
  2. Environment Setup: Sets up TURBO_API, TURBO_TOKEN, and TURBO_TEAM environment variables required by turbo build.
  3. Efficient Caching: Leverages GitHub's cache service to significantly accelerate build times.

Configurable Options

Customize the caching behavior with the following optional settings (defaults provided):

with:
  cache-prefix: turbogha_ # Custom prefix for cache keys

Contributing

Set Up Your Development Environment

  1. Start the development server:

    npm run dev-run
  2. In a separate terminal, execute the tests:

    npm test

Licensing

Licensed under the MIT License. For more details, see the LICENSE file.

Acknowledgements

This project is inspired by dtinth and has been comprehensively rewritten for enhanced robustness and reliability.

About

A Github action to set up Turborepo Remote Caching to work with GitHub Actions' built-in cache instead of Vercel one

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •