Travis CI: branch filters in build matrix items

tamasf

We are wondering whether there is any way to add filters to Travis matrix items. In our particular case, we wish to run certain jobs only on specific branches.

The following example would be an ideal way for configuring this scenario, however it doesn't seem to work:

matrix:
  include:
    - env: BUILD_TYPE=release
      branches:
        only:
          - master
    - env: BUILD_TYPE=ci
      branches:
        only:
          - develop

As a workaround, we can exit from the build script immediately by checking the appropriate env vars (TRAVIS_BRANCH), but it is very far from ideal as launching the slave machine and cloning the repo takes a considerable amount of time.

b3n

You can now achieve this with the beta feature Conditional Build Stages

jobs:
  include:
    - stage: release
      if: branch = master
      env: BUILD_TYPE=release
    - stage: ci
      if: branch = develop
      env: BUILD_TYPE=ci

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related