Skip to content

Commit 6f6084d

Browse files
hramosfacebook-github-bot
authored andcommitted
Explicitly set path to yarn
Summary: Due to issues with Circle's Docker images ([link](https://twitter.com/circleci/status/974694807091073024)), jobs are failing with an error "yarn not found". Test Plan Run on Circle Release Notes [GENERAL][MINOR][.circleci] - Fix Circle issue Closes #18419 Differential Revision: D7312052 Pulled By: hramos fbshipit-source-id: 2768b9c69046a2f80518430024d3e7afbbd7de65
1 parent 076b1ce commit 6f6084d

3 files changed

Lines changed: 32 additions & 3 deletions

File tree

.circleci/config.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ aliases:
157157
- &run-js-tests
158158
name: JavaScript Test Suite
159159
command: yarn test-ci
160-
160+
161+
# eslint sometimes runs into trouble generating the reports
161162
- &run-lint-checks
162163
name: Lint code
163-
command: yarn lint --format junit -o ~/react-native/reports/junit/js-lint-results.xml
164+
command: scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/react-native/reports/junit/js-lint-results.xml
164165
when: always
165166

166167
- &run-flow-checks
@@ -251,13 +252,16 @@ js_defaults: &js_defaults
251252
<<: *defaults
252253
docker:
253254
- image: circleci/node:8
255+
environment:
256+
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
254257

255258
android_defaults: &android_defaults
256259
<<: *defaults
257260
docker:
258261
- image: circleci/android:api-26-alpha
259262
resource_class: "large"
260263
environment:
264+
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
261265
- TERM: "dumb"
262266
- ADB_INSTALL_TIMEOUT: 10
263267
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
@@ -539,7 +543,7 @@ jobs:
539543
command: |
540544
# GITHUB_TOKEN=eslint-bot public_repo access token
541545
if [ -n "$CIRCLE_PR_NUMBER" ]; then
542-
cat <(echo eslint; yarn --silent lint --format=json; echo flow; yarn --silent flow check --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER node bots/code-analysis-bot.js
546+
GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER scripts/circleci/analyze_code.sh
543547
else
544548
echo "Skipping code analysis."
545549
fi

scripts/circleci/analyze_code.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
cat <(echo eslint; yarn --silent lint --format=json; echo flow; yarn --silent flow check --json) | GITHUB_TOKEN=$GITHUB_TOKEN CI_USER=$CI_USER CI_REPO=$CI_REPO PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER node bots/code-analysis-bot.js
4+
5+
# check status
6+
STATUS=$?
7+
if [ $STATUS == 0 ]; then
8+
echo "Code analyzed successfully"
9+
else
10+
echo "Code analyzis failed, error status $STATUS"
11+
fi
12+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# execute command
4+
$@
5+
6+
# check status
7+
STATUS=$?
8+
if [ $STATUS == 0 ]; then
9+
echo "Command '$@' completed successfully"
10+
else
11+
echo "Command '$@' exited with error status $STATUS"
12+
fi
13+

0 commit comments

Comments
 (0)