Skip to content

Commit

Permalink
.circleci/config.yml: Update CircleCI Syntax
Browse files Browse the repository at this point in the history
This updates CircleCI syntax from 1.0 to 2.0

Closes coala#2298
  • Loading branch information
harshhx17 committed Jun 21, 2018
1 parent 3853209 commit 3b2bf3f
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 127 deletions.
40 changes: 3 additions & 37 deletions .ci/deps.apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,17 @@ export DEBIAN_FRONTEND=noninteractive
deps="libclang1-3.4 indent mono-mcs chktex r-base julia golang-go luarocks verilator cppcheck flawfinder devscripts mercurial"
deps_infer="m4 opam"

case $CIRCLE_BUILD_IMAGE in
"ubuntu-12.04")
if [ $CIRCLECI ]; then
USE_PPAS="true"
# The Circle provided Go is too old
sudo mv /usr/local/go /usr/local/circleci-go
;;
"ubuntu-14.04")
# Use xenial, needed to replace outdated julia provided by Circle CI
ADD_APT_UBUNTU_RELEASE=xenial
# Work around lack of systemd on trusty, which xenial's lxc-common expects
echo '#!/bin/sh' | sudo tee /usr/bin/systemd-detect-virt > /dev/null
sudo chmod a+x /usr/bin/systemd-detect-virt

# The non-apt go provided by Circle CI is acceptable
deps=${deps/golang-go/}
# Add packages which are already in the precise image
deps="$deps g++-4.9 libxml2-utils php-cli php7.0-cli php-codesniffer"
# gfortran on CircleCI precise is 4.6 and R irlba compiles ok,
# but for reasons unknown it fails on trusty without gfortran-4.9
deps="$deps gfortran-4.9"
# Add extra infer deps
deps_infer="$deps_infer ocaml camlp4"
# opam install --deps-only --yes infer fails with
# Fatal error:
# Stack overflow
# aspcud is an external dependency resolver, and is the recommended
# solution: https://github.com/ocaml/opam/issues/2507
deps_infer="$deps_infer aspcud"
;;
esac

if [ -n "$ADD_APT_UBUNTU_RELEASE" ]; then
echo "deb http://archive.ubuntu.com/ubuntu/ $ADD_APT_UBUNTU_RELEASE main universe" | sudo tee -a /etc/apt/sources.list.d/$ADD_APT_UBUNTU_RELEASE.list > /dev/null
deps="$deps golang-1.9-go"
fi

if [ "$USE_PPAS" = "true" ]; then
sudo add-apt-repository -y ppa:marutter/rdev
sudo add-apt-repository -y ppa:staticfloat/juliareleases
sudo add-apt-repository -y ppa:staticfloat/julia-deps
sudo add-apt-repository -y ppa:ondrej/golang
sudo add-apt-repository -y ppa:gophers/archive
sudo add-apt-repository -y ppa:avsm/ppa
elif [ -n "$USE_PPAS" ]; then
for ppa in $USE_PPAS; do
Expand All @@ -63,11 +34,6 @@ sudo apt-get -y --no-install-recommends install $deps $deps_perl $deps_infer

# On Trusty, g++ & gfortran 4.9 need activating for R lintr dependency irlba.
ls -al /usr/bin/gcc* /usr/bin/g++* /usr/bin/gfortran* || true
if [[ "$CIRCLE_BUILD_IMAGE" == "ubuntu-14.04" ]]; then
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-4.9 20
fi

# Change environment for flawfinder from python to python2
sudo sed -i '1s/.*/#!\/usr\/bin\/env python2/' /usr/bin/flawfinder
1 change: 1 addition & 0 deletions .ci/deps.opam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if [ ! -e ~/infer-linux64-v0.7.0/infer/bin ]; then
wget -nc -O ~/infer.tar.xz https://github.com/facebook/infer/releases/download/v0.7.0/infer-linux64-v0.7.0.tar.xz
tar xf ~/infer.tar.xz -C ~/
cd ~/infer-linux64-v0.7.0
apt-get install ocaml ocaml-native-compilers camlp4-extra opam -y
opam init --y
opam update

Expand Down
13 changes: 7 additions & 6 deletions .ci/deps.pip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ set -x
TERM=dumb

# Choose the python versions to install deps for
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" ) ;;
case $CIRCLE_JOB in
"python-3.5") dep_versions=( "3.4.3" "3.5.1" );;
"python-3.4") dep_versions=( "3.4.3" );;
*) dep_versions=( "3.5.1" );;
esac

for dep_version in "${dep_versions[@]}" ; do
ver=$(python --version 2>&1)
for i in $ver;do version=$i;done
pyenv install -ks $dep_version
pyenv local $dep_version 2.7.10
pyenv local $dep_version $version
python --version
source .ci/env_variables.sh

Expand Down
207 changes: 207 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
version: 2
jobs:
python-3.5: &build
docker:
- image: circleci/jdk8:0.1.1

steps:
- checkout
- restore_cache:
key: coala-bears-dep-{{checksum "requirements.txt"}}

- run:
name: dependencies
command: |
sudo apt-get update
sudo apt-get install -y software-properties-common curl \
python-software-properties
sudo add-apt-repository -y ppa:hvr/ghc
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo add-apt-repository -y ppa:avsm/ppa
echo 'export TERM=dumb' >> $BASH_ENV
echo 'export LANG=en_US.UTF-8' >> $BASH_ENV
echo 'export LANGUAGE=en_US:en' >> $BASH_ENV
echo 'export LC_ALL=en_US.UTF-8' >> $BASH_ENV
curl -sL https://deb.nodesource.com/setup_8.x |
sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg |
sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" |
sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install -y python3.4-venv git bzip2 \
cabal-install-1.24 clang-3.4 libreadline-dev libblas-dev \
gfortran ghc happy indent liblapack-dev language-pack-en \
libperl-critic-perl libxml2-utils menhir php-codesniffer \
build-essential texinfo libbz2-dev libcurl4-openssl-dev \
libexpat-dev sqlite3 zlib1g-dev git-core ruby libssl-dev \
libsqlite3-dev libxslt1-dev libffi-dev yarn python3-dev \
libgdbm-dev libncurses5-dev automake libtool bison \
libncursesw5-dev libc6-dev tk-dev libncurses-dev \
ca-certificates
- run:
name: virtual-env
command: |
if [ ! -d "$HOME/.venv" ]; then
python3 -m venv ~/.venv
fi
echo 'source $HOME/.venv/bin/activate' >> $BASH_ENV
- run:
name: pre
command: |
sudo rm -rf /var/cache/apt/archives
sudo ln -s $HOME/.apt-cache /var/cache/apt/archives
mkdir -p $HOME/.apt-cache/partial
mkdir -p $HOME/.RLibrary
mkdir -p $HOME/go
curl -o- https://raw.githubusercontent.com\
/creationix/nvm/v0.33.8/install.sh | bash
echo 'export NVM_DIR=$HOME/.nvm' >> $BASH_ENV
export NVM_DIR=$HOME/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 6.10.2
nvm alias default node
echo 'export PATH=/usr/lib/go-1.9/bin:$PATH' >> $BASH_ENV
echo 'export GOPATH=$HOME/go' >> $BASH_ENV
echo 'export PATH=$GOPATH/bin:$PATH' >> $BASH_ENV
echo 'source $NVM_DIR/nvm.sh' >> $BASH_ENV
echo 'export PATH=/opt/cabal/bin:$PATH' >> $BASH_ENV
echo 'export PATH=$HOME/project/node_modules/.bin:$PATH'\
>> $BASH_ENV
echo 'export PATH=$HOME/project/vendor/bin:$PATH' >>\
$BASH_ENV
echo 'export LINTR_COMMENT_BOT=false' >> $BASH_ENV
echo 'export PATH=$HOME/dart-sdk/bin:$PATH' >> $BASH_ENV
echo 'export PATH=$HOME/.cabal/bin:$PATH' >> $BASH_ENV
echo 'export PATH=$HOME/infer-linux64-v0.7.0/infer/bin'\
':$PATH' >> $BASH_ENV
echo 'export PATH=$HOME/pmd-bin-5.4.1/bin:$PATH' >>\
$BASH_ENV
echo 'export PATH=$HOME/bakalint-0.4.0:$PATH' >> $BASH_ENV
echo 'export PATH=$HOME/elm-format-0.18:$PATH' >>\
$BASH_ENV
echo 'export PATH=$HOME/.local/tailor/tailor-latest/bin:'\
'$PATH' >> $BASH_ENV
echo 'export PATH=$HOME/phpmd:$PATH' >> $BASH_ENV
echo 'export R_LIB_USER=$HOME/.RLibrary' >> $BASH_ENV
echo 'export PATH=/usr/local/rvm/gems/ruby-2.2.2/bin:'\
'$PATH' >> $BASH_ENV
- run:
name: aptDependencies
command: bash .ci/deps.apt.sh

- run:
name: generalDependencies
command: |
gpg --keyserver hkp://keys.gnupg.net --recv-keys \
409B6B1796C275462A1703113804BB82D39DC0E3 \
7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
echo 'source /etc/profile.d/rvm.sh' >> $BASH_ENV
rvm install 2.2.2
rvm use 2.2.2 --default
ruby -v
rvm rvmrc warning ignore /root/project/Gemfile
gem install bundler
bash .ci/deps.sh
- run:
name: cabalDependencies
command: bash .ci/deps.cabal.sh

- run:
name: dependenciesPip
command: |
if [ ! -d "$HOME/.pyenv" ]; then
git clone https://github.com/pyenv/pyenv.git /tmp/pyenv
mkdir -p ~/.pyenv
cp -R /tmp/pyenv/* ~/.pyenv
fi
echo 'export PYENV_ROOT=$HOME/.pyenv' >> $BASH_ENV
echo 'export PATH=$PYENV_ROOT/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
eval "$(pyenv init -)"
bash .ci/deps.pip.sh
- run:
name: javaDependencies
command: bash .ci/deps.java.sh

- run:
name: opamDependencies
command: bash .ci/deps.opam.sh

- run:
name: RDependencies
command: bash .ci/deps.r.sh

- run:
name: bearsDependencies
command: bash .ci/deps.coala-bears.sh

- run:
name: codecov
when: always
command: codecov

- run:
name: coala-ci
when: always
command: coala-ci -L DEBUG

- run:
name: setup
when: always
command: python setup.py bdist_wheel

- run:
name: allDependencies
when: always
command: pip install $(ls ./dist/*.whl)"[alldeps]"

- run:
name: sphinx-build
when: always
command: |
if [ $CIRCLE_JOB == "python-3.4" ] ; then
python setup.py docs
fi
- run:
name: tests
when: always
command: bash .ci/tests.sh

- save_cache:
key: coala-bears-dep-{{checksum "requirements.txt"}}
paths:
- "docs/_build"
- "../.pyenv"
- "node_modules"
- "../.RLibrary"
- "../.cabal"
- "../nltk_data"
- "../infer-linux64-v0.7.0"
- "../pmd-bin-5.4.1"
- "../.local/share/coala-bears"
- "../bakalint-0.4.0"
- "../.julia"
- "../.local/tailor"
- "project/vendor"
- "project/.bundle"
- "project/node_modules"
- "../.ghc"
- "../.ghc-mod"

python-3.4: *build

workflows:
version: 2
test:
jobs:
- python-3.5
- python-3.4
2 changes: 1 addition & 1 deletion .coafile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ignore = *.py

[all.yml]
bears = YAMLLintBear
files = *.yml, *.yaml, .ci/*.yml, tests/**/*.yml
files = *.yml, *.yaml, .ci/*.yml, tests/**/*.yml, .circleci/config.yml

[bash]
bears = ShellCheckBear
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ cache:

env:
global:
- CIRCLE_NODE_INDEX=-1 # Avoid accidentially being a CircleCI worker
- USE_PPAS="marutter/rdev staticfloat/juliareleases ondrej/golang"
- R_LIB_USER=~/R/Library
- LINTR_COMMENT_BOT=false
Expand Down
Loading

0 comments on commit 3b2bf3f

Please sign in to comment.