I updated the above to include Mac OS X which Travis CI now supports. This .travis.yml file will compile your package on R devel and release on ubuntu/trusty and R release on Mac OS X (devel not currently supported).
I had a failure using clang on ubuntu that I wanted to check with Travis, the following passes on travis and osx but fails for gcc ā can anyone suggest how it might be modified so that the line near the bottom involving fPIC works for both gcc and clang?
language: r
sudo: false
cache: packages
r_check_args: "--no-vignettes"
r_build_args: '--no-build-vignettes'
matrix:
include:
- os: linux
dist: trusty
r: release
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- os: linux
dist: trusty
r: devel
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- os: linux
dist: trusty
r: release
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb https://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
- clang-7
env:
- MATRIX_EVAL="CC=clang-7 CXX=clang++-7"
- os: osx
osx_image: xcode10
r: release
fortran: false
before_install:
- mkdir -p ~/.R/
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo "CXX14 = clang++-7 -fPIC" >> ~/.R/Makevars; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo "CXX14FLAGS = -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -Wno-unused-local-typedefs -Wno-ignored-attributes -Wno-deprecated-declarations -Wno-attributes -O3" >> ~/.R/Makevars; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then echo "CXX14 = clang++ -arch x86_64 -ftemplate-depth-256" >> ~/.R/Makevars; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then echo "CXX14FLAGS = -O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -Wno-unknown-pragmas" >> ~/.R/Makevars; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then echo "CC = clang" >> ~/.R/Makevars; fi
- eval "${MATRIX_EVAL}"
Did you ever figure this out? Travis hasnāt given me a passing build since about October (Iām assuming because of 2.18, but Iām not sure ā I just tried to add the above code to my existing .travis.yml, but it didnāt seem to fix the issue). I miss my green āpassingā badge!
Not an R programmer, but you have ImportFrom in namespace but in the code base use package::func which means that ImportFrom is not needed or you should just use func.
@ahartikainen, your comment helped me find one instance of a importFrom of a package I no longer wanted as a dependency, and made me stumble across this post I somehow missed: How to update a package that has StanHeaders and rstan in its LinkingTo. (I had been trying to avoid updating rstan while writing these papers, but I guess that ship sailed.) Thank you!
It still doesnāt pass on Travis, but itās closer than it was.
Hmm, my current errors using @saudiwinās configuration are
For linux:
dist: trusty is no longer supported for language: r
and for mac (in R CMD CHECK)
Compilation used the following non-portable flag(s):
811 ā-march=nativeā ā-Wno-unknown-pragmasā ā-Wno-unused-functionā
812 ā-Wno-unused-variableā
Does anyone know a working travis configuration for a package using rstan?
Thank you, @mbjoseph. Using your minimalist example, I managed to get my rstan-dependent R package to build on Travis for the first time in quite a while. Big relief!