# Trouble with Python build matrix being respected by jobs

**URL:** <https://travis-ci.community/t/trouble-with-python-build-matrix-being-respected-by-jobs/3432>\
**Category:** Uncategorized\
**Tags:** bug\
**Created:** [May 17, 2019, 3:14am UTC](https://travis-ci.community/t/trouble-with-python-build-matrix-being-respected-by-jobs/3432 "2019-05-17T03:14:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dtracers](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dtracers/32/1820_2.png) [@dtracers](https://travis-ci.community/u/dtracers)\
**Post date:** [May 17, 2019, 3:14am UTC](https://travis-ci.community/t/trouble-with-python-build-matrix-being-respected-by-jobs/3432/1 "2019-05-17T03:14:37Z")

</div>

This is my build:  
[https://travis-ci.org/SaltieRL/DistributedReplays/builds/533611955](https://travis-ci.org/SaltieRL/DistributedReplays/builds/533611955)

I have setup jobs but they are not being able to run the build matrix  
Instead it is adding 2 random python ones and then running all the stages on who knows what python version

```
sudo: required
dist: xenial
language: python
python:
  - '3.6'
  - '3.7'

services:
- postgresql
- redis-server

addons:
  apt:
    sources:
    - ubuntu-toolchain-r-test

install:
- pip install -r requirements.txt
- pip install -r requirements-test.txt
- ls
- cd webapp
- npm install
- cd $TRAVIS_BUILD_DIR

script: echo 'nothing'

stages:
  - lint
  - test
  - deploy

jobs:
  include:
    - stage: lint
      name: "style checks"
      python: "3.7"
      script:
        - chmod 777 .travis/tslint.sh && .travis/tslint.sh
    - stage: test
      name: "server unit tests"
      script:
        - pytest --cov=./
        - bash <(curl -s https://codecov.io/bash) -c -F server
    - stage: test
      name: "integration tests"
      script:
        - cd $TRAVIS_BUILD_DIR
        - cd webapp
        - npm install
        - npm start &
        - cd $TRAVIS_BUILD_DIR
        - celery -A backend.tasks.celery_tasks.celery worker --pool=solo -l info &
        - python3 RLBotServer.py &
    - stage: test
      name: "react unit tests"
      # we only need to run npm tests for one python version
      python: "3.6"
      script:
        - cd webapp
        - npm test
    - stage: deploy
      name: "Deploy"
      python: "3.7"
      after_success:
      - codecov
      - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
      - chmod +x .travis/send.sh
      - ./.travis/send.sh success $WEBHOOK_URL

      after_failure:
        - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
        - chmod +x .travis/send.sh
        - ./.travis/send.sh failure $WEBHOOK_URL

```

Is there something I am doing wrong?  
I am following the docs and in them the matrix is followed

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [May 17, 2019, 4:42am UTC](https://travis-ci.community/t/trouble-with-python-build-matrix-being-respected-by-jobs/3432/2 "2019-05-17T04:42:31Z")

</div>

`include:` jobs exist independently from the build matrix and are added on top of it.

So you get two jobs from the `python:` axis in the default `test` stage, accompanied with all the jobs you specified in `include:`, without a `python:` setting.

AFAICS from [https://docs.travis-ci.com/user/build-stages/#how-to-define-build-stages](https://docs.travis-ci.com/user/build-stages/#how-to-define-build-stages) , stages are not considered an axis so you cannot add jobs to more than one stage using the matrix.

As such, the way to go seems to be to either

- specify all the jobs manually, [using YAML aliases](https://docs.travis-ci.com/user/build-stages/using-yaml-aliases/) to reduce duplication, or
- only manually duplicate jobs as above in stages with fewer jobs and specify `python:` for them manually.

---

<div class="post-metadata">

**Author:** ![dtracers](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dtracers/32/1820_2.png) [@dtracers](https://travis-ci.community/u/dtracers)\
**Post date:** [May 17, 2019, 5:34am UTC](https://travis-ci.community/t/trouble-with-python-build-matrix-being-respected-by-jobs/3432/3 "2019-05-17T05:34:43Z")

</div>

Is there a way to specify jobs without the include?

And why do all stages specify specific versions of the matrix when they want to run solo in the docs?
