Use matrix build in Travis only on deploy
<p>Is there any way to <em>only</em> run a matrix build in travis on deploy? Right now we use the same <code>.travis.yml</code> file for test and deploy, and a matrix build (and thus two workers) is triggered in both cases. I can't find a way to only run the build as a matrix in the case in which we are deploying and not when we are running tests (or perhaps to only use a matrix during the deploy process). The main reason I'd like to do this is so that I don't trigger extra builds when PRs are created and I just need the test build to run.  </p>

<p>I also couldn't find a simple way we could run a single build for npm install/npm test and then spin off two separate workers/a matrix for the "deploy" process, which would also solve the problem.</p>

<p>Here's a snip of my current .travis.yml file:
</p>

<pre><code>language: node_js
node_js: 4.2.1
env:
  global:
    - APP_NAME=example
  matrix:
    - CF_DOMAIN=example1.net CF_TARGET=https://target1.com APP_NAME=${APP_NAME}-1
    - CF_DOMAIN=example2.net CF_TARGET=https://target2.com APP_NAME=${APP_NAME}-2

branches:
  only:
    - master
deploy:
- provider: script
  skip_cleanup: true
  script: node_modules/.bin/deploy.sh
  on:
    branch: master
</code></pre>

<p>It might also work for us to only run a matrix build on a <code>push</code> hook, but not on a <code>pr</code>.</p>