Skip to content

Commit

Permalink
Basic Travis CI trusty build script
Browse files Browse the repository at this point in the history
Update R deps lib directory to use an environment variable
R_LIB_USER as the conventional directory on Travis is ~/R/Library,
while the CircleCI configuration is ~/.RLibrary.

Travis creates cache directory ~/bakalint-0.4.0 automatically,
so the existance test needs to refer to a file in that directory.

Use Travis language `python`, with pip caching.
Thus do not install packages in .ci/deps.sh,
by setting `dep_versions=( )` if $CIRCLE_NODE_INDEX is not set.

cabal refuses to install hlint without `--force-reinstalls`
on trusty.

Use Travis apt addon to install as many trusty packages as possible,
thus reducing the number of packages installed from the ppa's.

Closes coala/coala#3191
  • Loading branch information
jayvdb committed Dec 16, 2016
1 parent 13d2e6d commit 3df3def
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .ci/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -x
case $CIRCLE_NODE_INDEX in
0) dep_versions=( "3.4.3" "3.5.1" ) ;;
1) dep_versions=( "3.4.3" ) ;;
-1) dep_versions=( ) ;; # set by .travis.yml
*) dep_versions=( "3.5.1" ) ;;
esac

Expand Down Expand Up @@ -76,8 +77,7 @@ sudo rm -rf $(which alex) # Delete ghc-alex as it clashes with npm deps
npm install

# R commands
mkdir -p ~/.RLibrary
echo '.libPaths( c( "~/.RLibrary", .libPaths()) )' >> .Rprofile
echo '.libPaths( c( "'"$R_LIB_USER"'", .libPaths()) )' >> .Rprofile
echo 'options(repos=structure(c(CRAN="http://cran.rstudio.com")))' >> .Rprofile
R -e "install.packages('lintr', dependencies=TRUE, quiet=TRUE, verbose=FALSE)"
R -e "install.packages('formatR', dependencies=TRUE, quiet=TRUE, verbose=FALSE)"
Expand Down Expand Up @@ -119,7 +119,7 @@ if ! dartanalyzer -v &> /dev/null ; then
fi

# VHDL Bakalint Installation
if [ ! -e ~/bakalint-0.4.0 ]; then
if [ ! -e ~/bakalint-0.4.0/bakalint.pl ]; then
wget "http://downloads.sourceforge.net/project/fpgalibre/bakalint/0.4.0/bakalint-0.4.0.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Ffpgalibre%2Ffiles%2Fbakalint%2F0.4.0%2F&ts=1461844926&use_mirror=netcologne" -O ~/bl.tar.gz
tar xf ~/bl.tar.gz -C ~/
fi
Expand Down
2 changes: 1 addition & 1 deletion .ci/deps.shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BIN_PATH=~/.cabal/bin/shellcheck

function install_shellcheck {
cabal update --verbose=0
cabal install --verbose=0 shellcheck-$VERSION
cabal install --verbose=0 --force-reinstalls shellcheck-$VERSION
}

function currently_installed_shellcheck_version {
Expand Down
97 changes: 97 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
sudo: required

language: python
python:
- 3.4
- 3.5

dist: trusty

addons:
apt:
sources:
- ubuntu-toolchain-r-test
- avsm # OPAM stable
- hvr-ghc # Haskell
packages:
- cabal-install
- chktex
- clang-3.4
- cppcheck
- espeak
- ghc
- haskell-platform
- indent
- libblas-dev
- liblapack-dev
- libxml2-utils
- luarocks
- menhir
- mono-mcs
- oracle-java9-set-default
- php-codesniffer
- verilator

cache:
pip: true
directories:
# Installed language package caches
- ~/.cabal
- ~/R/Library
- ~/.julia
- $TRAVIS_BUILD_DIR/node_modules
- $TRAVIS_BUILD_DIR/.bundle
- $TRAVIS_BUILD_DIR/vendor
# coala managed data
- ~/nltk_data
- ~/.local/share/coala-bears
# .deb cache
- ~/.apt-cache
# Installed linters
- ~/infer-linux64-v0.7.0
- ~/pmd-bin-5.4.1
- ~/bakalint-0.4.0
- ~/dart-sdk/bin

env:
global:
- CIRCLE_NODE_INDEX=-1 # Avoid accidentially being a CircleCI worker
- USE_PPAS=true
- R_LIB_USER=~/R/Library
- LINTR_COMMENT_BOT=false
- PATH="$PATH:$TRAVIS_BUILD_DIR/node_modules/.bin:$TRAVIS_BUILD_DIR/vendor/bin:$HOME/dart-sdk/bin:$HOME/.cabal/bin:$HOME/infer-linux64-v0.7.0/infer/bin:$HOME/pmd-bin-5.4.1/bin:/$HOME/bakalint-0.4.0"

before_install:
- nvm install 4
- nvm use 4
# Remove Ruby directive from Gemfile as this image has 2.2.5
- sed -i '/^ruby/d' Gemfile
- mkdir -p ~/.apt-cache
- bash .ci/deps.sh
- bash .ci/deps.shellcheck.sh
# https://github.com/coala/coala/issues/3183
# https://github.com/coala/coala/issues/3184
- pip install -U py==1.4.29 pip
- cat test-requirements.txt docs-requirements.txt >> requirements.txt
- sed -i '/^-r/d' requirements.txt
- echo 'language_check==0.8.*' >> requirements.txt

before_script:
- julia -e 'Pkg.add("Lint")'
- python3 -m nltk.downloader punkt maxent_treebank_pos_tagger averaged_perceptron_tagger

script:
- bash .ci/tests.sh
- python setup.py install
# https://github.com/coala/coala-bears/issues/1037
- >
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
sed -i '/bears = GitCommitBear/d' .coafile
fi
- coala --non-interactive
- bash .ci/deploy.coverage.sh
- rm -rf docs/API && make -C docs clean
- python setup.py docs

notifications:
email: false
2 changes: 2 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ dependencies:
- echo 'export PATH=$PATH:~/infer-linux64-v0.7.0/infer/bin' >> ~/.circlerc
- echo 'export PATH=$PATH:~/pmd-bin-5.4.1/bin' >> ~/.circlerc
- echo 'export PATH=$PATH:~/bakalint-0.4.0' >> ~/.circlerc
- echo 'export R_LIB_USER=~/.RLibrary' >> ~/.circlerc
- sed -i '/source \/home\/ubuntu\/virtualenvs\//d' ~/.circlerc
- mkdir -p ~/.RLibrary
- nvm alias default node
override:
- bash .ci/deps.shellcheck.sh
Expand Down

0 comments on commit 3df3def

Please sign in to comment.