Skip to content

Commit

Permalink
prepare ci scripts (apple#32)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tomerd authored and weissi committed Feb 26, 2018
1 parent 0797b5c commit 9652984
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 44 deletions.
76 changes: 54 additions & 22 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,56 @@
FROM ubuntu:14.04
MAINTAINER [email protected]
ENTRYPOINT /bin/bash

# install dependencies
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 update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100

# install swiftenv
RUN git clone https://github.com/kylef/swiftenv.git ~/.swiftenv
RUN echo 'export SWIFTENV_ROOT="$HOME/.swiftenv"' >> ~/.bashrc
RUN echo 'export PATH="$SWIFTENV_ROOT/bin:$PATH"' >> ~/.bashrc
RUN echo 'export PATH="$HOME/scripts:$PATH"' >> ~/.bashrc
RUN echo 'eval "$(swiftenv init -)"' >> ~/.bashrc

#install script to allow mapping framepointers on linux
RUN mkdir $HOME/scripts
RUN wget -q https://raw.githubusercontent.com/apple/swift/1e078fbdfa768e211e0473cf917511efd73aec86/utils/symbolicate-linux-fatal -O $HOME/scripts/symbolicate-linux-fatal
RUN chmod 755 $HOME/scripts/symbolicate-linux-fatal

# install swift
ARG version
RUN $HOME/.swiftenv/bin/swiftenv install ${version:-4.0}

# local
RUN locale-gen en_US en_US.UTF-8
RUN dpkg-reconfigure locales
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

# basic dependencies
RUN apt-get update
RUN apt-get install -y wget git software-properties-common pkg-config
RUN apt-get install -y libicu-dev libblocksruntime0
RUN apt-get install -y lsof dnsutils # used by integration tests

# clang
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN apt-add-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main"
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

# modern curl
#RUN apt-get install -y curl
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
22 changes: 0 additions & 22 deletions scripts/generate_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,10 @@ set -e

my_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
root_path="$my_path/.."
swift_version=${swift_version:-4.0.2}
version=$(git describe --abbrev=0 --tags || echo "0.0.0")
modules=(NIO NIOHTTP1 NIOTLS NIOFoundationCompat)

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
if [[ ! -d "$root_path/.build/x86_64-unknown-linux" ]]; then
swift build
Expand Down
4 changes: 4 additions & 0 deletions scripts/integration_tests.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9652984

Please sign in to comment.