Help with .travis.yml

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.

## 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
1 Like

See the .travis.yml for

https://github.com/tpapp/StanRun.jl

It downloads and builds Stan.

1 Like

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.

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 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 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 (WIP, not yet registered) reads in Stan output from CSV files, not caring whether they were produced with StanRun.

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.

1 Like