I can’t quite wrap my head around the documentation and the examples to figure out what I need.
I have a repo that contains golang and node_js code. I want to run two stages that
tests/builds the go code
tests/builds the js code
and then the output of both those builds should run in an after_success step to build a single docker image with the compiled files.
I’ve tried with the matrix but am getting two docker images built:
services:
- docker
matrix:
include:
- language: go
go:
- "1.11"
script:
- make test
- make build
- language: node_js
node_js:
- "7"
script: yarn run build
after_success:
- docker build
The problem is that the js build takes a little bit longer to execute, but the after_success executes before yarn run build is complete, and the files generated are not in the docker image.
My expectation is that after_success only runs once, after all jobs are complete and successful.
If you want these two jobs to be in different stages (and guarantee sequential execution), you need to define different stage values. This is explained in https://docs.travis-ci.com/user/build-stages/.
The ordering of the jobs doesn’t matter, they just have to all run before after_success
But, since running them sequentially isn’t a hard requirement at this point, using stages would be ok with me. However the documentation of stages (or any examples I found) does not show me how to use multiple languages. Can you take my example and convert it to use stages?
ok, that was something I looked into for a workaround already.
What I wanted to do was use a go image as a base, then install node on it, and then use that to build the jobs, but using a custom image seemed like a lot more overhead to do this.
so…can you give me an example of running these two languages in one job?