# Help with .travis.yml

**URL:** <https://discourse.julialang.org/t/help-with-travis-yml/25017>\
**Category:** General Usage\
**Tags:** build, travis, stan\
**Created:** [June 6, 2019, 5:45pm UTC](https://discourse.julialang.org/t/help-with-travis-yml/25017 "2019-06-06T17:45:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![goedman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goedman/32/217_2.png) [@goedman](https://discourse.julialang.org/u/goedman)\
**Post date:** [June 6, 2019, 5:45pm UTC](https://discourse.julialang.org/t/help-with-travis-yml/25017/1 "2019-06-06T17:45:57Z")

</div>

For several years I’ve been testing Cmdstan.jl (previously Stan.jl) with a script like below. I updated building the docs mid last year and attempted to use `stages`, with limited success, but at least early on below script did build and run the cmdstan binary successfully on all examples. Since a few months this is no longer the case (It does try to run the examples but I don’t think it can run the `stanc` compiler or the subsequent C++ compilation).

I have tried to move the test script to a separate stage, add the julia line to the documentation phase, and many other variations, with no success. It does build the cmdstan binaries but from within Julia I can’t use these.

Does anyone have a suggestion how I could fix this?

Unfortunately this is an even bigger problem for StatisticalRethinkingJulia as I used this to generate the docs using Literate.jl during the Travis testing.

```julia
## Documentation: http://docs.travis-ci.com/user/languages/julia/
language: julia

os:
  - linux
  #- osx
  
julia:
  #- 1.0
  - 1.1
  #- nightly
  
matrix:
  allow_failures:
    - os: osx
    - julia: nightly

script:
  - if [[-a .git/shallow]]; then git fetch --unshallow; fi
  - cd $HOME; if [[! -d cmdstan]]; then git clone https://github.com/stan-dev/cmdstan.git; fi
  - cd $HOME/cmdstan; git checkout v2.19.0; make stan-update; make build
  - export JULIA_CMDSTAN_HOME=$HOME/cmdstan
  - cd $TRAVIS_BUILD_DIR
  - julia -e 'using Pkg; Pkg.test("CmdStan"; coverage=true)'

branches:
  only:
    - master
    - /^v\d+\.\d+(\.\d+)?(-\S*)?$/
    
jobs:
  include:
    - stage: Documentation
      julia: 1.1
      os: linux
      script:
        - if [[-a .git/shallow]]; then git fetch --unshallow; fi
        - cd $HOME; if [[! -d cmdstan]]; then git clone https://github.com/stan-dev/cmdstan.git; fi
        - cd $HOME/cmdstan; git checkout v2.19.0; make stan-update; make build
        - export JULIA_CMDSTAN_HOME=$HOME/cmdstan
        - cd $TRAVIS_BUILD_DIR
        - julia --project=docs -e 'using Pkg; Pkg.instantiate(); Pkg.develop(PackageSpec(path=pwd()))'
        - julia --project=docs --color=yes docs/make.jl
      after_success: skip

notifications:
  email: false
  
git:
  depth: 99999999

```

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [June 7, 2019, 5:12am UTC](https://discourse.julialang.org/t/help-with-travis-yml/25017/2 "2019-06-07T05:12:35Z")

</div>

See the `.travis.yml` for

[https://github.com/tpapp/StanRun.jl](https://github.com/tpapp/StanRun.jl)

It downloads and builds Stan.

---

<div class="post-metadata">

**Author:** ![goedman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goedman/32/217_2.png) [@goedman](https://discourse.julialang.org/u/goedman)\
**Post date:** [June 7, 2019, 1:07pm UTC](https://discourse.julialang.org/t/help-with-travis-yml/25017/3 "2019-06-07T13:07:12Z")

</div>

Thank you very much Tamas! I should have remembered to look there!

Would you mind if I investigate if I can improve CmdStan.jl by using StanRun.jl? Last time I looked at it (mid 2018) I decided against it because at that time I preferred Dicts over NamedTuples, but since working much more with DynamicHMC and the additional features in NamedTupleTools.jl it is time for me to rethink that trade-off.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [June 7, 2019, 1:15pm UTC](https://discourse.julialang.org/t/help-with-travis-yml/25017/4 "2019-06-07T13:15:22Z")

</div>

Please use whatever you find convenient from these packages, either the whole package or pieces of it as building blocks.

Compared to CmdStan, my approach is more modular:

1. [StanDump.jl](https://github.com/tpapp/StanDump.jl) writes anything that supports `pairs` (`Dict`, `NamedTuple`, whatever you can think of) as Stan-compatible R data dump files. That’s all it does.

2. [StanRun.jl](https://github.com/tpapp/StanRun.jl) compiles and runs the model (dumping the data it with StanDump if that is desired). It forms multi-dimensional arrays by figuring out that columns like `a[1,1]`, `a[2, 1]`, etc are part of a larger array.

3. [StanSamples.jl](https://github.com/tpapp/StanSamples.jl) (WIP, not yet registered) reads in Stan output from CSV files, not caring whether they were produced with StanRun.

---

<div class="post-metadata">

**Author:** ![goedman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goedman/32/217_2.png) [@goedman](https://discourse.julialang.org/u/goedman)\
**Post date:** [June 10, 2019, 8:35pm UTC](https://discourse.julialang.org/t/help-with-travis-yml/25017/5 "2019-06-10T20:35:17Z")

</div>

Thanks again for your help. Turns out the trick is the `dist: xenial` line in .travis.yml which provides a newer g++ version needed for compiling the generated C++ for the Stan model. With help from a Stan developer (Steve Bronder) and native\_api on Travis-CI it is working again (although I am using parts of your .travis.yml in StanRun.jl). I’ll also continue to look into the use of StanDump, StanRun and StanSamples for CmdStan.jl v6.0.
