androidcirclecitestfairy

make circle ci upload only master commits to test fairy


I added in the circle.yml the instruction to upload to test fairy after the build.

But I want only to upload to test fairy when the build was triggered by a commit in the master branch.

My circle.yml file:

test:
  override:
    # start the emulator
    - emulator -avd circleci-android22 -no-audio -no-window:
        background: true
        parallel: true
    # wait for it to have booted
    - circle-android wait-for-boot
    # run tests  against the emulator.
    - ./gradlew assembleDebug
    - ./gradlew connectedAndroidTest
    - ./gradlew testfairyBeta

How can I execute the instruction ./gradlew testfairyBeta only if the build was triggered by a commit in the master branch?

When the build was triggered by commits in others branchs I want to run only the ./gradlew connectedAndroidTest and his dependencies.


Solution

  • You can use an if statement to force testfairyBeta only on master. Here is how:

    - if [ $CIRCLE_BRANCH = 'master' ]; then ./gradlew testfairyBeta; fi