Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

jobs vs. matrix: What's the difference? #1500

Closed
vinniefalco opened this issue Oct 12, 2017 · 13 comments
Closed

jobs vs. matrix: What's the difference? #1500

vinniefalco opened this issue Oct 12, 2017 · 13 comments
Assignees

Comments

@vinniefalco
Copy link

I can't find a reference of all travis.yml keywords. What is the difference between jobs and matrix?

@jab
Copy link

jab commented Nov 16, 2017

Wondering the same myself. One difference I just found: Changing "matrix" to "jobs" and running "travis lint" results in

Warnings for .travis.yml:
[x] unexpected key jobs, dropping

@plaindocs
Copy link
Contributor

Hi @vinniefalco @jab we're working on that reference.

In the meantime you can find some info here on jobs and stages

https://docs.travis-ci.com/user/build-stages/

and some info on builds matrixes here

https://docs.travis-ci.com/user/customizing-the-build/#Build-Matrix

Cheers

@MariadeAnton
Copy link
Contributor

Hi everyone!

As @plaindocs mentioned, we're working on getting the reference updated via #1476

At the moment, both matrix.include and jobs.include let you configure and spin up different jobs and one can group jobs in different stages using jobs.include.

Thanks so much for the question!

@codeselfceo
Copy link

Hello everyone!!

How can I use a folder created in a previous stage on the next stage? For example, 1 stage is build, which will generate a dist folder, 2 stage should deploy that folder.

This is my code:

language: node_js
node_js: stable
cache:
  directories:
    - node_modules
jobs:
  include:
    - stage: Install
      name: "Installing dependencies..."
      script: npm install
    - stage: Compile
      skip_cleanup: true
      name: "Building app..."
      script: npm run-script build
    - stage: Deploy
      if: branch = master
      skip_cleanup: true
      name: "Shipping..."
      script: npm run-script deploy

I hope you guys can help me, I really need this.

NOTE: anything to say about the file configuration, don't hesitate to say it, I'm totally new with this.

@apaleyes
Copy link

apaleyes commented Dec 4, 2018

Do these overwrite each other? If i have both matrix.include and jobs.include defined, is only one of them executed? This was my experience somehow, but would be nice to hear a more detailed explanation of their behavior. Thanks!

@BanzaiMan
Copy link
Contributor

Do these overwrite each other?

In essence, yes. matrix and jobs define the same data, so whatever comes at the end will win (which I believe is the YAML spec).

NHDaly added a commit to JuliaGizmos/Blink.jl that referenced this issue Jan 7, 2019
According to this thread, `matrix:include` and `jobs:include` overwrite eachother, so you cannot use both in the same file:
travis-ci/docs-travis-ci-com#1500
@BanzaiMan
Copy link
Contributor

I'm reopening this as a focused subset of #1476 that needs attention specifically.

@BanzaiMan BanzaiMan reopened this Jan 16, 2019
@jab
Copy link

jab commented Jan 19, 2019

@abitrolly
Copy link
Contributor

os expansion doesn't work for jobs. In the script below osx part is not executed.

language: go
go_import_path: github.com/harmony-one/harmony
install:
  - go build -v ./...
script:
  - ./scripts/travis_checker.sh

jobs:
  include:
  - stage: New build script
    os:
      - linux
      - osx
    script:
      - ./build.sh

@dismine
Copy link

dismine commented Feb 24, 2019

@abitrolly i believe your mistake is to put two os in one job. Just try to split os between two jobs inside one stage.

jobs:
  include:
  - stage: New build script
    os: linux
    script:
      - ./build.sh
  - os: osx
    script:
      - ./build.sh

@stale
Copy link

stale bot commented Jun 20, 2019

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please do feel free to either reopen this issue or open a new one. We'll gladly take a look again! You can read more here: https://blog.travis-ci.com/2018-03-09-closing-old-issues

@noloader
Copy link
Contributor

Where the hell does "no environment variables set" come from when not using matrix:. I thought switching to job: and include: would stop the errors, but Travis still produces the errors.

@stuaxo
Copy link

stuaxo commented Feb 13, 2020

Not great that stalebot closed this, it's been confusing me for ages.

Maybe the best thing is to open a PR with an incomplete doc to avoid this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

12 participants