microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.07k stars 12.37k forks source link

build cache / tsbuildinfo not used, but why? #41520

Closed simllll closed 3 years ago

simllll commented 3 years ago

TypeScript Version: 4.0.5 / also tested it with 4.1

Search Terms: build cache, incremental build, tsbuildinfo, timestamps

Issue

I'm using github actions for our tests, and would like to make use of the build cache to shorten runtime of the actions. But typescirpt is not using the buildcache. I tried already debugging:

What (else) is a factor to consider the build cache to be valid for tsc to re use it? Is there any possibility to debug why it's not using the cache? On our dev workstations everything is working perfectly.

Expected behavior: Typescript should use the buildcache

Actual behavior: It's not using the buildcache

simllll commented 3 years ago

I found some sort of answer, by using "--verbose" flag typescript outputs the reason why it's not using the cache.

simllll commented 3 years ago

Just in any case someone else is running into this too. I fixed my issue by using https://github.com/MestreLion/git-tools git-restore-mtime toolkit

      - name: Restore mtime for git checkout
        run: sudo apt install git-restore-mtime && sudo curl -o /usr/lib/git-core/git-restore-mtime https://raw.githubusercontent.com/MestreLion/git-tools/v2020.09/git-restore-mtime && git restore-mtime

this allow github actions to utilize typescripts caching strategy!

simllll commented 3 years ago

I've anyone stumpled upon this: see https://github.com/actions/cache/issues/459 for a possible solution