Build Stages: Defining steps using YAML aliases

This example has 3 build stages:

  • Two jobs that run tests against Ruby 2.2 and 2.3
  • One job that deploys to staging
  • Three jobs that runs test against staging

Here’s what the .travis.yml config could look like:

rvm:
  - 2.2
  - 2.3

script: bundle exec rspec

jobs:
  include:
    - stage: deploy to staging
      rvm: 2.3
      install: skip # bundle install is not required
      script: ./deploy.sh
    - &test-staging
      stage: test staging
      rvm: 2.3
      install: skip
      script: ./test-staging.sh one
    - <<: *test-staging
      script: ./test-staging.sh two
    - <<: *test-staging
      script: ./test-staging.sh three

This is how the build matrix might look:

image

You can find the code for this example on our demo repository: