diff --git a/.circleci/config.yml b/.circleci/config.yml index e89c2ce451d..475c3a676e2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,13 +107,6 @@ aliases: - /.*-stable/ - gh-pages - - &filter-only-tagged-releases - tags: - only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/ - branches: - only: - - /.*-stable/ - # Dependency Management - &install-ndk name: Install Android NDK @@ -466,11 +459,9 @@ jobs: - run: name: Build iOS app for simulator command: yarn run build-ios-e2e - # TODO: Fix these failing tests. - - run: *display-broken-tests-warning - run: - name: Run Detox Tests (Disabled) - command: ./scripts/circleci/exec_author_check.sh yarn run test-ios-e2e + name: Run Detox Tests + command: yarn run test-ios-e2e # Set up an Android environment for downstream jobs test_android: @@ -548,49 +539,48 @@ jobs: # Issues will be posted to the PR itself via GitHub bots. # This workflow should only fail if the bots fail to run. analyze_pr: - <<: *js_defaults + <<: *defaults + docker: + - image: circleci/node:10 + environment: + - PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" steps: - - attach_workspace: - at: ~/react-native + - checkout + - run: *setup-artifacts - - restore-cache: *restore-cache-analysis + - restore-cache: *restore-yarn-cache - run: *yarn - - run: - name: Install Additional Dependencies - command: | - if [ -n "$CIRCLE_PR_NUMBER" ]; then - yarn add github@0.2.4 - cd bots - yarn install --non-interactive --cache-folder ~/.cache/yarn - else - echo "Skipping dependency installation." - fi - - save-cache: *save-cache-analysis - - run: - name: Analyze Pull Request - command: | - # DANGER_GITHUB_API_TOKEN=React-Linter public_repo access token - if [ -n "$CIRCLE_PR_NUMBER" ]; then - cd bots && DANGER_GITHUB_API_TOKEN="80aa64c50f38a267e9ba""575d41d528f9c234edb8" yarn danger - else - echo "Skipping pull request analysis." - fi - when: always - run: name: Analyze Code command: | # GITHUB_TOKEN=eslint-bot public_repo access token if [ -n "$CIRCLE_PR_NUMBER" ]; then - 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 + echo -e "\\x1B[36mInstalling additional dependencies\\x1B[0m"; yarn add @octokit/rest@15.10.0 + echo -e "\\x1B[36mAnalyzing code\\x1B[0m"; GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" ./scripts/circleci/analyze_code.sh else echo "Skipping code analysis." fi when: always + - restore-cache: *restore-cache-analysis + - run: + name: Analyze Pull Request + command: | + # DANGER_GITHUB_API_TOKEN=React-Linter public_repo access token + if [ -n "$CIRCLE_PR_NUMBER" ]; then + cd bots + yarn install --non-interactive --cache-folder ~/.cache/yarn + DANGER_GITHUB_API_TOKEN="80aa64c50f38a267e9ba""575d41d528f9c234edb8" yarn danger + else + echo "Skipping pull request analysis." + fi + when: always + - save-cache: *save-cache-analysis + # Publishes new version onto npm # Only works on stable branches when a properly tagged commit is pushed - publish: + publish_npm_package: <<: *android_defaults steps: - checkout @@ -598,9 +588,29 @@ jobs: - restore-cache: *restore-yarn-cache - run: *yarn - - run: - name: Authenticate with npm - command: echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc + # Configure Android SDK and related dependencies + - run: *configure-android-path + - run: *install-android-build-dependencies + + - restore-cache: *restore-cache-android-packages + - run: *install-android-packages + + # Install Android NDK + - run: *create-ndk-directory + - restore-cache: *restore-cache-ndk + - run: *install-ndk + + # Fetch dependencies using Buck + - restore-cache: *restore-cache-downloads-buck + - run: *install-buck + - run: *download-dependencies-buck + + # Fetch dependencies using Gradle + - restore-cache: *restore-cache-downloads-gradle + - run: *download-dependencies-gradle + + - restore-cache: *restore-yarn-cache + - run: *yarn - run: name: Authenticate with npm @@ -660,39 +670,19 @@ workflows: requires: - checkout_code - # Only runs on PRs - analyze: - jobs: - # Checkout repo and run Yarn - - checkout_code: - filters: *filter-ignore-master-stable - - # Run code checks - - analyze_pr: - filters: *filter-ignore-master-stable - requires: - - checkout_code - - test-and-deploy: - jobs: - - checkout_code: - # required since `publish` has tag filters - filters: *filter-only-tagged-releases - - test_javascript: - requires: - - checkout_code - - test_objc: - requires: - - checkout_code - - test_android: - requires: - - checkout_code - # Only runs on vX.X.X tags if all tests are green - - publish: + - publish_npm_package: + filters: + branches: + only: + - /.*-stable/ + tags: + only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/ requires: - test_javascript - test_objc - test_android - filters: *filter-only-tagged-releases + # Run code checks + - analyze_pr: + filters: *filter-ignore-master-stable