Updating Yarn Cache path to fix broken CI (#32834)

Summary:
The CI is currently failing with:
```
Error extracting tarball /tmp/cache1419328940 : tar: root/.cache/yarn: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6
```

The problem is that we're sharing the Yarn cache between two jobs (`test_js` and `test_ios_unit_jsc`) which are executed on two difference executors (a Machine vs a Docker container).

I've update the cache key to be `v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }}` so the job name is accounted when computing the Cache Key.

Moreover the `test_js` test was also failing on `flow check` as one of the library we depend on (`resolve`) added a test with a malformed JSON. I'm fixing this failure as well so the CI is back green.

## Changelog

[Internal] - Updating Yarn Cache path to fix broken CI

Pull Request resolved: https://github.com/facebook/react-native/pull/32834

Test Plan: Verified that the external CI is green: https://github.com/facebook/react-native/pull/32834

Reviewed By: lunaleaps

Differential Revision: D33453702

Pulled By: cortinico

fbshipit-source-id: 52bf42db583eaf6aa913f1bb164566f8c3563d36
This commit is contained in:
Nicola Corti
2022-01-06 10:46:15 -08:00
committed by Facebook GitHub Bot
parent cd4c6659d3
commit 252b2a63c5
2 changed files with 8 additions and 3 deletions
+4 -2
View File
@@ -78,7 +78,9 @@ commands:
steps:
- restore_cache:
keys:
- v5-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }}
- v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }}
- v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}
- v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}
- run:
name: "Yarn: Install Dependencies"
command: |
@@ -90,7 +92,7 @@ commands:
- save_cache:
paths:
- ~/.cache/yarn
key: v5-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }}
key: v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }}
install_buck_tooling:
steps:
+4 -1
View File
@@ -19,7 +19,7 @@
* --retries [num] - how many times to retry possible flaky commands: yarn add and running tests, default 1
*/
const {cd, cp, echo, exec, exit, mv} = require('shelljs');
const {cd, cp, echo, exec, exit, mv, rm} = require('shelljs');
const spawn = require('child_process').spawn;
const argv = require('yargs').argv;
const path = require('path');
@@ -265,6 +265,9 @@ try {
throw Error(exitCode);
}
describe('Test: Flow check');
// The resolve package included a test for a malformed package.json (see https://github.com/browserify/resolve/issues/89)
// that is failing the flow check. We're removing it.
rm('-rf', './node_modules/resolve/test/resolver/malformed_package_json');
if (exec(`${ROOT}/node_modules/.bin/flow check`).code) {
echo('Flow check failed.');
exitCode = 1;