How to Run Test in Specific Branch

ios
fastlane
circle.yml
ui-test

#1

Hello There, need your help. I am already find the solution and seems it’s not works.

So the problem was like this :

I have a project with have different branch, eg : branch feature, master, develop. All i need to do is I want to run testing in circle using fastlane only in develop branch. How can i configure condition like that?

I am success to separated it deployment section in circle.yml, but it seems wrong because it would detect build failed once it’s had failed test. So i decided put in test section, but how can i config the test only run in specific branch?

This is my circle.yml

test:
override:
- fastlane test
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit && cat fastlane/test_output/report.junit > $CIRCLE_TEST_REPORTS/junit/report.xml
- mkdir $CIRCLE_ARTIFACTS/html
- mv fastlane/test_output/report.html $CIRCLE_ARTIFACTS/html

general:
branches:
only:
- develop
- /feature/./
- /hotfix/.
/
- /release/.*/

deployment:
devel_distribution:
branch: [develop, /feature/.*/]
commands:
- fastlane devel

release_distribution:
branch: [/hotfix/./, /release/./]
commands:
- fastlane beta


#2

Did you figure this out? Is there a solution you could post? Thanks!


#3

We did this with some detection logic in the yaml:

version: 2

jobs:
build-job:
docker:
# specify the version you desire here
- image: circleci/node:9.2.0-browsers

  # Specify service dependencies here if necessary
  # CircleCI maintains a library of pre-built images
  # documented at https://circleci.com/docs/2.0/circleci-images/
  # - image: circleci/mongo:3.4.4

working_directory: ~/RA
steps:
  - checkout
  - run:
      name: install
      command: npm install
  - save_cache:
      key: dependency-cache-{{ checksum "package.json" }}
      paths:
        - ./node_modules
  - run:
      name: build minified assets
      command: |
        echo $REACT_APP_API_HOST
        if [ "$CIRCLE_BRANCH" == "QA" ];
        then
          echo $NODE_ENV;
          REACT_APP_API_HOST=//ra-rs-api-qa.mshft.net;
          echo $REACT_APP_API_HOST;
        fi
        echo $REACT_APP_API_HOST
        npm run build
  - run:
      name: start
      command: npm start
      background: true

#4

just change where we have setting the env var to your tests etc


#5