Commit 9bcbf43
authored
ci: cache eslint and tsc results between ci runs (#33304)
## **Description**
`yarn lint` and `yarn lint:tsc` both run cold on every CI invocation:
`.eslintcache` and `tsconfig.tsbuildinfo` are gitignored, and the
`scripts` job in `ci.yml` does a fresh `actions/checkout` with no step
restoring them, so ESLint's `--cache` flag and TypeScript's
`incremental: true` option never actually get to skip anything in CI —
every run re-lints and re-type-checks the entire repo from scratch.
This adds two rolling caches to the `scripts` job, scoped to their
respective matrix entries:
- `lint` → restores/saves `.eslintcache`
- `lint:tsc` → restores/saves `tsconfig.tsbuildinfo`
Both use a `key` that includes `github.run_id` (always a miss) with a
`restore-keys` prefix fallback — this is the pattern documented in
[`actions/cache`'s own "Update a cache"
guidance](https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache),
needed because cache entries are immutable and can't be overwritten in
place. The net effect: each run restores the most recent eligible cache
(same branch, base branch, or `main`, per GitHub's cache access rules),
lets the tool re-validate file hashes itself, and saves a fresh cache at
the end — so most runs only need to re-lint/re-check files that actually
changed instead of the whole repo.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes:
## **Manual testing steps**
N/A — CI-only configuration change with no in-app behavior to verify.
Validated by observing the `Restore ESLint cache` / `Restore TypeScript
incremental build cache` steps and the resulting `lint` / `lint:tsc` job
durations across consecutive CI runs on this PR and after merging to
`main`.
## **Screenshots/Recordings**
### **Before**
N/A
### **After**
N/A
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [x] I've tested on Android
- [x] I've tested with a power user scenario
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Made with [Cursor](https://cursor.com)1 parent 285a54b commit 9bcbf43
1 file changed
Lines changed: 30 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
310 | 326 | | |
311 | 327 | | |
312 | 328 | | |
| |||
1338 | 1354 | | |
1339 | 1355 | | |
1340 | 1356 | | |
1341 | | - | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
1342 | 1364 | | |
1343 | 1365 | | |
1344 | 1366 | | |
| |||
1392 | 1414 | | |
1393 | 1415 | | |
1394 | 1416 | | |
1395 | | - | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
1396 | 1424 | | |
1397 | 1425 | | |
1398 | 1426 | | |
| |||
0 commit comments