Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves travis-ci config to support ubuntu/centos+gcc, cpplint #263

Merged
merged 1 commit into from
Apr 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 63 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,74 @@
sudo: required
dist: trusty

language: cpp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a memorandum: It seems that Travis CI currently ignores this settings for matrix builds. travis-ci/travis-ci#3655


compiler:
# gcc test is disabled (see #120)
# - gcc
- clang
services:
- docker

matrix:
include:
- env:
- DIST=centos
- VERSION=6
- env:
- DIST=centos
- VERSION=7
- env:
- DIST=centos
- VERSION=7
- SCL=devtoolset-4 # gcc 5.2 (enabled function multiversioning)
- env:
- DIST=ubuntu
- VERSION=12.04
- env:
- DIST=ubuntu
- VERSION=14.04
- env:
- DIST=ubuntu
- VERSION=16.04 # gcc 5.3 (enabled function multiversioning)

before_install:
- lsb_release -a
- uname -a
- sudo apt-get -qq update
- docker pull ${DIST}:${VERSION}
- docker run -w /root --name test -d ${DIST}:${VERSION} sleep infinity
- docker cp . test:/root/
- if [ "$DIST" == "centos" ]; then
if [ $VERSION -eq 6 ]; then
docker exec test rpm -Uvh http://download.jubat.us/yum/rhel/6/stable/x86_64/jubatus-release-6-2.el6.x86_64.rpm;
elif [ $VERSION -eq 7 ]; then
docker exec test rpm -Uvh http://download.jubat.us/yum/rhel/7/stable/x86_64/jubatus-release-7-2.el7.x86_64.rpm;
fi;
if [ -n "$SCL" ]; then
docker exec test yum -y install centos-release-scl;
fi;
fi

install:
# msgpack
- sudo apt-get -qq install libmsgpack-dev
# oniguruma
- wget https://github.com/kkos/oniguruma/releases/download/v5.9.6/onig-5.9.6.tar.gz && tar xvf onig-5.9.6.tar.gz
- pushd onig-5.9.6 && ./configure && make && sudo make install && popd
- sudo ldconfig
- if [ "$DIST" == "centos" ]; then
docker exec test yum -y install redhat-lsb gcc-c++ bzip2 msgpack-devel oniguruma-devel;
if [ -n "$SCL" ]; then
docker exec test yum -y install ${SCL}-gcc-c++ ${SCL}-binutils;
docker exec test bash -c "echo 'source scl_source enable ${SCL}' > /root/.bashrc";
fi;
fi
- if [ "$DIST" == "ubuntu" ]; then
docker exec test apt-get update;
docker exec test apt-get -qq install lsb-release autoconf automake make g++ python2.7 wget tar bzip2 libmsgpack-dev;
docker exec test bash -c "wget --no-check-certificate https://github.com/kkos/oniguruma/releases/download/v5.9.6/onig-5.9.6.tar.gz && tar xvf onig-5.9.6.tar.gz && cd onig-5.9.6 && ./configure && make && make install && ldconfig";
if [ "$VERSION" != "12.04" ]; then
docker exec test ln -sf /usr/bin/python2.7 /usr/bin/python;
fi;
fi

before_script:
- docker exec test lsb_release -a
- docker exec -t test bash -ic "g++ --version"

script:
- ./waf configure
- ./waf build --checkall
- docker exec -t test bash -ic "./waf configure"
- docker exec -t test bash -ic "./waf build --checkall"
- docker exec -t test bash -ic "./waf cpplint"
- if [ -n "$SCL" ]; then docker exec test ./waf build --checkall; fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

将来的にCentOS7でも #246 / #250 の全機能を使ったバイナリを配布することを考慮して,
比較的新しいgccが利用できるSCLでビルドしたバイナリを,SCL外で実行するテストを追加しました.SCLのRHEL版であるDTのマニュアルでは互換性がある様に記載してありましたので.
(ビルド・実行環境の互換性マトリクスC++ABI互換性 )

※ SCLが設定されている場合,bash経由でコマンドを実行すると51行目で出力した .bashrc が有効となりますが,bashを経由しないでコマンドを実行すると .bashrc を読み込まないのでSCL環境外でそのコマンドを実行するという動作になります

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます、意図了解しました。

なお、手元で試してみたところ、現時点では SCL-enabled であってもシステム側のランタイムライブラリが使われるようです。

# SCL Disabled

$ which g++
/usr/bin/g++

$ g++ test.cpp -o test

$ ldd ./test
        linux-vdso.so.1 =>  (0x00007ffce87fc000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f9e7585e000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f9e7555c000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f9e75345000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f9e74f84000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9e75b6f000)

# SCL Enabled

$ source scl_source enable devtoolset-4

$ which g++
/opt/rh/devtoolset-4/root/usr/bin/g++

$ g++ test.cpp -o test

$ ldd ./test
        linux-vdso.so.1 =>  (0x00007ffec456b000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f32714e3000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f32711e0000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f3270fca000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f3270c09000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f32717f4000)


branches:
only:
Expand Down