Skip to content

Commit

Permalink
Explicitly set path to yarn
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hramos authored and facebook-github-bot committed Mar 17, 2018
1 parent 076b1ce commit 6f6084d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,11 @@ aliases:
- &run-js-tests
name: JavaScript Test Suite
command: yarn test-ci


# eslint sometimes runs into trouble generating the reports
- &run-lint-checks
name: Lint code
command: yarn lint --format junit -o ~/react-native/reports/junit/js-lint-results.xml
command: scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/react-native/reports/junit/js-lint-results.xml
when: always

- &run-flow-checks
Expand Down Expand Up @@ -251,13 +252,16 @@ js_defaults: &js_defaults
<<: *defaults
docker:
- image: circleci/node:8
environment:
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

android_defaults: &android_defaults
<<: *defaults
docker:
- image: circleci/android:api-26-alpha
resource_class: "large"
environment:
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
- TERM: "dumb"
- ADB_INSTALL_TIMEOUT: 10
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
Expand Down Expand Up @@ -539,7 +543,7 @@ jobs:
command: |
# GITHUB_TOKEN=eslint-bot public_repo access token
if [ -n "$CIRCLE_PR_NUMBER" ]; then
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
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
else
echo "Skipping code analysis."
fi
Expand Down
12 changes: 12 additions & 0 deletions scripts/circleci/analyze_code.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

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

# check status
STATUS=$?
if [ $STATUS == 0 ]; then
echo "Code analyzed successfully"
else
echo "Code analyzis failed, error status $STATUS"
fi

13 changes: 13 additions & 0 deletions scripts/circleci/exec_swallow_error.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# execute command
$@

# check status
STATUS=$?
if [ $STATUS == 0 ]; then
echo "Command '$@' completed successfully"
else
echo "Command '$@' exited with error status $STATUS"
fi

0 comments on commit 6f6084d

Please sign in to comment.