Specify if before_script runs in matrix

My before_script includes adding and installing Java8, which is only needed when I run integration tests, so I don’t want it to run it when running unit or pep8 tests.

Is there any way I can do this?

Link to my latest build config: https://travis-ci.org/phac-nml/irida-uploader/builds/572949716/config

before_script: |
  if [[ "$TESTS" =~ ^integrationtests.* ]]; then
    <etc>
  fi
2 Likes

@native-api’s suggestion works.

You could also declare your before_script: in the matrix: itself e.g.

matrix:
  include:
      ⋮
    - env: "TEST_SUITE=integrationtests"
      python: 3.6
      before_script:
        - <COMMAND>
        - <COMMAND>
        - <ETC.>
    ⋮

Hope this helps!

1 Like
Imprint