prepare ci scripts (#32)

Motivation:

set up continuous integration

Modifications:

* update docker file to include all dependencies required for build, unit tests, integration tests and doc generation
* remove dependency steps from doc generation script
* add integration tests driver script

Result:

able to set up docker based continuous integration
This commit is contained in:
tomer doron 2018-02-26 03:27:53 -08:00 committed by Johannes Weiß
parent 0797b5c293
commit 9652984b60
3 changed files with 54 additions and 40 deletions

View File

@ -1,24 +1,56 @@
FROM ubuntu:14.04 FROM ubuntu:14.04
MAINTAINER tomerd@apple.com MAINTAINER tomerd@apple.com
ENTRYPOINT /bin/bash
# install dependencies # local
RUN apt-get -y update && apt-get -y install curl git libicu-dev clang-3.8 libpython2.7-dev libxml2 python-lldb-3.9 wget libssl-dev RUN locale-gen en_US en_US.UTF-8
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100 RUN dpkg-reconfigure locales
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100 RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.profile
RUN echo 'export LANGUAGE=en_US:en' >> $HOME/.profile
RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.profile
# install swiftenv # basic dependencies
RUN git clone https://github.com/kylef/swiftenv.git ~/.swiftenv RUN apt-get update
RUN echo 'export SWIFTENV_ROOT="$HOME/.swiftenv"' >> ~/.bashrc RUN apt-get install -y wget git software-properties-common pkg-config
RUN echo 'export PATH="$SWIFTENV_ROOT/bin:$PATH"' >> ~/.bashrc RUN apt-get install -y libicu-dev libblocksruntime0
RUN echo 'export PATH="$HOME/scripts:$PATH"' >> ~/.bashrc RUN apt-get install -y lsof dnsutils # used by integration tests
RUN echo 'eval "$(swiftenv init -)"' >> ~/.bashrc
#install script to allow mapping framepointers on linux # clang
RUN mkdir $HOME/scripts RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN wget -q https://raw.githubusercontent.com/apple/swift/1e078fbdfa768e211e0473cf917511efd73aec86/utils/symbolicate-linux-fatal -O $HOME/scripts/symbolicate-linux-fatal RUN apt-add-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main"
RUN chmod 755 $HOME/scripts/symbolicate-linux-fatal RUN apt-get update
RUN apt-get install -y clang-5.0 lldb-5.0
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 100
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-5.0 100
# install swift # modern curl
ARG version #RUN apt-get install -y curl
RUN $HOME/.swiftenv/bin/swiftenv install ${version:-4.0} RUN apt-get install -y build-essential libssl-dev
RUN mkdir $HOME/.curl
RUN wget -q http://curl.haxx.se/download/curl-7.50.3.tar.gz -O $HOME/curl.tar.gz
RUN tar xzf $HOME/curl.tar.gz --directory $HOME/.curl --strip-components=1
RUN cd $HOME/.curl && ./configure --with-ssl && make && make install && cd -
RUN ldconfig
# swift
ARG version=4.0.2
RUN mkdir $HOME/.swift
RUN wget -q https://swift.org/builds/swift-${version}-release/ubuntu1404/swift-${version}-RELEASE/swift-${version}-RELEASE-ubuntu14.04.tar.gz -O $HOME/swift.tar.gz
RUN tar xzf $HOME/swift.tar.gz --directory $HOME/.swift --strip-components=1
RUN echo 'export PATH="$HOME/.swift/usr/bin:$PATH"' >> $HOME/.profile
RUN echo 'export LINUX_SOURCEKIT_LIB_PATH="$HOME/.swift/usr/lib"' >> $HOME/.profile
# script to allow mapping framepointers on linux
RUN mkdir -p $HOME/.scripts
RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.scripts/symbolicate-linux-fatal
RUN chmod 755 $HOME/.scripts/symbolicate-linux-fatal
RUN echo 'export PATH="$HOME/.scripts:$PATH"' >> $HOME/.profile
# ruby
RUN apt-add-repository -y ppa:brightbox/ruby-ng
RUN apt-get update
RUN apt-get install -y ruby2.4 ruby2.4-dev libsqlite3-dev
# known_hosts
RUN mkdir -p $HOME/.ssh
RUN touch $HOME/.ssh/known_hosts
RUN ssh-keyscan github.com >> $HOME/.ssh/known_hosts

View File

@ -4,32 +4,10 @@ set -e
my_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" my_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
root_path="$my_path/.." root_path="$my_path/.."
swift_version=${swift_version:-4.0.2}
version=$(git describe --abbrev=0 --tags || echo "0.0.0") version=$(git describe --abbrev=0 --tags || echo "0.0.0")
modules=(NIO NIOHTTP1 NIOTLS NIOFoundationCompat) modules=(NIO NIOHTTP1 NIOTLS NIOFoundationCompat)
if [[ "$(uname -s)" == "Linux" ]]; then if [[ "$(uname -s)" == "Linux" ]]; then
# setup ruby
if ! command -v ruby > /dev/null; then
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
source $HOME/.rvm/scripts/rvm
rvm requirements
rvm install 2.4
fi
# setup swift
if ! command -v swift > /dev/null; then
rm -rf "$HOME/.swiftenv"
git clone https://github.com/kylef/swiftenv.git "$HOME/.swiftenv"
export SWIFTENV_ROOT="$HOME/.swiftenv"
export PATH="$SWIFTENV_ROOT/bin:$HOME/scripts:$PATH"
eval "$(swiftenv init -)"
swiftenv install $swift_version
# set path swift libs
export LINUX_SOURCEKIT_LIB_PATH="$SWIFTENV_ROOT/versions/$swift_version/usr/lib"
fi
# build code if required # build code if required
if [[ ! -d "$root_path/.build/x86_64-unknown-linux" ]]; then if [[ ! -d "$root_path/.build/x86_64-unknown-linux" ]]; then
swift build swift build

4
scripts/integration_tests.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
mkdir -p .build # for the junit.xml file
./IntegrationTests/run-tests.sh --junit-xml .build/junit-sh-tests.xml