Skip to content

Commit

Permalink
fix: removes turbo cache step
Browse files Browse the repository at this point in the history
  • Loading branch information
moltar committed Feb 4, 2022
1 parent 9d7c18b commit e44a02e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 56 deletions.
36 changes: 0 additions & 36 deletions src/index.ts
Expand Up @@ -310,43 +310,8 @@ export class TurborepoProject extends typescript.TypeScriptProject {
},
}

// https://github.com/vercel/turborepo/issues/451#issuecomment-1002409285
const turboCacheKeyChunks = [
'turbo',
exp('runner.os'),
'build',
exp('github.ref_name'),
exp('github.sha'),
]

// Turborepo cache
// https://turborepo.org/docs/features/caching
const turboCacheStep: JobStep = {
name: 'Cache Turborepo',
uses: 'actions/cache@v2',
with: {
'path': TURBO_CACHE_DIR,
// I think turbo cache is not specific to environment, so we want to cache all of it.
//
// TODO: How do prune cache eventually?
'key': turboCacheKeyChunks.join('-'),
'restore-keys':
Array(turboCacheKeyChunks.length)
.fill(0)
.map((_, i) => i)
.reverse()
.map((chunks) => [...turboCacheKeyChunks.slice(0, chunks), undefined].join('-'))
.join('\n'),
},
}

this.buildWorkflow?.addPostBuildSteps(
nodeModulesCacheStep,

// run turbo cache in the main build, to create the cache on the first run
// even though we are not caching anything on this step. This avoids a race condition
// in matrix, where each matrix job then tries to reserve cache key
turboCacheStep,
)

this.buildWorkflow?.addPostBuildJob('turbo', {
Expand All @@ -360,7 +325,6 @@ export class TurborepoProject extends typescript.TypeScriptProject {
},
this.setupNodeStep,
nodeModulesCacheStep,
turboCacheStep,
{
name: 'Build',
run: `npx turbo run build --scope=${matrixScope} --include-dependencies --cache-dir="${TURBO_CACHE_DIR}"`,
Expand Down
20 changes: 0 additions & 20 deletions test/__snapshots__/sub-projects.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e44a02e

Please sign in to comment.