Test only PRs to master branch

config

#1

Hello, we run lint and selenium tests on our repo. Is there a way to not test wip branches on each commit, but test them when they are a subject of a PR to a certain other branch? (Note that we have required status checks in git.)

In best case, we would like to have shallow tests run on each commit within whole repo and rigorous tests on PRs to master and production, but that may be a subject for new thread…


#2

Here I go

#circle.yml

test:
  override:
  - chmod +x testSelenium.sh
  - chmod +x testSeleniumConditionally.sh
  - ./testSeleniumConditionally.sh:
      timeout: 1200

#testSeleniumConditionally.sh

#!/bin/bash
CCI_SELENIUM_WHITELISTED_BRANCHES=("master" "production" "test")

if [[ -n $CI_PULL_REQUEST ]] ||
   (
    for e in "${CCI_SELENIUM_WHITELISTED_BRANCHES[@]}";
      do [[ "$e" == "$CIRCLE_BRANCH" ]] && exit 0
      done
      exit 1
   )
then ./testSelenium.sh
else exit 0
fi

#3