Use docker to build native_dyn.

As we want to use qt and packages are available only since ubuntu artful, we
need to use docker because travis-ci is ubuntu trusty.

We could also build qt, but it takes too many time and travis timeout.
This commit is contained in:
Matthieu Gautier 2018-06-05 22:47:48 +02:00
parent 312e734678
commit ded38889cf
4 changed files with 91 additions and 10 deletions

View File

@ -2,6 +2,8 @@ language: cpp
dist: trusty dist: trusty
sudo: required sudo: required
services:
- docker
branches: branches:
only: only:
- master - master
@ -27,7 +29,9 @@ cache:
- $HOME/.gradle/wrapper/ - $HOME/.gradle/wrapper/
- $HOME/.android/build-cache - $HOME/.android/build-cache
install: travis/install_extra_deps.sh install: travis/install_extra_deps.sh
script: travis/compile_all.py script:
- if [ $TRAVIS_OS_NAME == "osx" ] || [ $PLATFORM != "native_dyn" ]; then travis/compile_all.py; fi
- if [ $TRAVIS_OS_NAME == "linux" ] && [ $PLATFORM == "native_dyn" ]; then docker build -t kiwix/build . && docker run -e PLATFORM -e NIGHTLY_DATE -e TRAVIS_EVENT_TYPE -e TRAVIS_BUILD_DIR kiwix/build; fi
after_failure: travis/upload_all_log.sh after_failure: travis/upload_all_log.sh
deploy: deploy:
- provider: script - provider: script

75
Dockerfile Normal file
View File

@ -0,0 +1,75 @@
FROM ubuntu:artful
ENV LANG C.UTF-8
RUN \
dpkg --add-architecture i386; \
apt update -q; \
apt full-upgrade --purge -q -y; \
apt install -q -y --no-install-recommends \
# Base build tools
build-essential \
# gcc-5 \
# g++-5 \
automake \
libtool \
cmake \
ccache \
pkg-config \
autopoint \
patch \
python \
python3 \
python3-pip \
python3-setuptools \
git \
subversion \
wget \
unzip \
sudo \
# Win32 cross-compilation
g++-mingw-w64-i686 \
gcc-mingw-w64-i686 \
gcc-mingw-w64-base \
mingw-w64-tools \
# Some dependencies already packaged
libbz2-dev \
libmagic-dev \
zlib1g-dev \
uuid-dev \
ctpp2-utils \
libctpp2-dev \
libmicrohttpd-dev \
# Some helper tools
vim \
less \
grep \
openssh-client \
; \
apt-get clean -y; \
rm -rf \
/usr/share/doc/* \
/var/cache/debconf/*
RUN useradd --create-home travis -G sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER travis
WORKDIR /home/travis
RUN \
mkdir -p /home/travis/.local/bin ;\
wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip ;\
unzip ninja-linux.zip ninja ;\
mv ninja /home/travis/.local/bin ;\
rm ninja-linux.zip
ENV PATH="/home/travis/.local/bin:${PATH}"
COPY . kiwix-build/
RUN sudo chown -R travis:travis /home/travis/kiwix-build
RUN pip3 install --user -e kiwix-build
ENV TRAVISCI_SSH_KEY /home/travis/kiwix-build/travis/travisci_builder_id_key
ENV TRAVIS_OS_NAME linux
CMD kiwix-build/travis/compile_all.py && kiwix-build/travis/deploy.sh

View File

@ -31,7 +31,7 @@ NIGHTLY_ZIM_ARCHIVES_DIR = HOME/'NIGHTLY_ZIM_ARCHIVES'/NIGHTLY_DATE
RELEASE_ZIM_ARCHIVES_DIR = HOME/'RELEASE_ZIM_ARCHIVES' RELEASE_ZIM_ARCHIVES_DIR = HOME/'RELEASE_ZIM_ARCHIVES'
DIST_KIWIX_ARCHIVES_DIR = HOME/'DIST_KIWIX_ARCHIVES' DIST_KIWIX_ARCHIVES_DIR = HOME/'DIST_KIWIX_ARCHIVES'
DIST_ZIM_ARCHIVES_DIR = HOME/'DIST_ZIM_ARCHIVES' DIST_ZIM_ARCHIVES_DIR = HOME/'DIST_ZIM_ARCHIVES'
SSH_KEY = Path(environ['TRAVIS_BUILD_DIR'])/'travis'/'travisci_builder_id_key' SSH_KEY = environ.get('TRAVISCI_SSH_KEY', Path(environ['TRAVIS_BUILD_DIR'])/'travis'/'travisci_builder_id_key')
# We have build everything. Now create archives for public deployement. # We have build everything. Now create archives for public deployement.
BINARIES = { BINARIES = {
@ -162,7 +162,9 @@ def make_deps_archive(target, full=False):
def scp(what, where): def scp(what, where):
print_message("Copy {} to {}", what, where) print_message("Copy {} to {}", what, where)
command = ['scp', '-i', str(SSH_KEY), str(what), str(where)] command = ['scp', '-o', 'StrictHostKeyChecking=no',
'-i', str(SSH_KEY),
str(what), str(where)]
subprocess.check_call(command) subprocess.check_call(command)

View File

@ -8,14 +8,14 @@ RELEASE_KIWIX_ARCHIVES_DIR=${HOME}/RELEASE_KIWIX_ARCHIVES
RELEASE_ZIM_ARCHIVES_DIR=${HOME}/RELEASE_ZIM_ARCHIVES RELEASE_ZIM_ARCHIVES_DIR=${HOME}/RELEASE_ZIM_ARCHIVES
DIST_KIWIX_ARCHIVES_DIR=${HOME}/DIST_KIWIX_ARCHIVES DIST_KIWIX_ARCHIVES_DIR=${HOME}/DIST_KIWIX_ARCHIVES
DIST_ZIM_ARCHIVES_DIR=${HOME}/DIST_ZIM_ARCHIVES DIST_ZIM_ARCHIVES_DIR=${HOME}/DIST_ZIM_ARCHIVES
SSH_KEY=travis/travisci_builder_id_key SSH_KEY=${TRAVISCI_SSH_KEY:-travis/travisci_builder_id_key}
if [[ "$TRAVIS_EVENT_TYPE" = "cron" ]] if [[ "$TRAVIS_EVENT_TYPE" = "cron" ]]
then then
scp -vrp -i ${SSH_KEY} \ scp -vrp -i ${SSH_KEY} -o StrictHostKeyChecking=no \
${NIGHTLY_KIWIX_ARCHIVES_DIR} \ ${NIGHTLY_KIWIX_ARCHIVES_DIR} \
nightlybot@download.kiwix.org:/var/www/download.kiwix.org/nightly nightlybot@download.kiwix.org:/var/www/download.kiwix.org/nightly
scp -vrp -i ${SSH_KEY} \ scp -vrp -i ${SSH_KEY} -o StrictHostKeyChecking=no \
${NIGHTLY_ZIM_ARCHIVES_DIR} \ ${NIGHTLY_ZIM_ARCHIVES_DIR} \
nightlybot@download.kiwix.org:/var/www/download.openzim.org/nightly nightlybot@download.kiwix.org:/var/www/download.openzim.org/nightly
@ -27,7 +27,7 @@ then
for archive in $RELEASE_ARCHIVES for archive in $RELEASE_ARCHIVES
do do
subdir=$(basename $(dirname $archive)) subdir=$(basename $(dirname $archive))
scp -vrp -i ${SSH_KEY} \ scp -vrp -i ${SSH_KEY} -o StrictHostKeyChecking=no \
${archive} \ ${archive} \
nightlybot@download.kiwix.org:/var/www/download.kiwix.org/release/${subdir} nightlybot@download.kiwix.org:/var/www/download.kiwix.org/release/${subdir}
done done
@ -39,7 +39,7 @@ then
for archive in $RELEASE_ARCHIVES for archive in $RELEASE_ARCHIVES
do do
subdir=$(basename $(dirname $archive)) subdir=$(basename $(dirname $archive))
scp -vrp -i ${SSH_KEY} \ scp -vrp -i ${SSH_KEY} -o StrictHostKeyChecking=no \
${archive} \ ${archive} \
nightlybot@download.openzim.org:/var/www/download.openzim.org/release/${subdir} nightlybot@download.openzim.org:/var/www/download.openzim.org/release/${subdir}
done done
@ -51,7 +51,7 @@ then
for archive in $DIST_KIWIX_ARCHIVES for archive in $DIST_KIWIX_ARCHIVES
do do
subdir=$(basename $(dirname $archive)) subdir=$(basename $(dirname $archive))
scp -vrp -i ${SSH_KEY} \ scp -vrp -i ${SSH_KEY} -o StrictHostKeyChecking=no \
${archive} \ ${archive} \
nightlybot@download.kiwix.org:/var/www/download.kiwix.org/release/${subdir} nightlybot@download.kiwix.org:/var/www/download.kiwix.org/release/${subdir}
done done
@ -63,7 +63,7 @@ then
for archive in $DIST_ZIM_ARCHIVES for archive in $DIST_ZIM_ARCHIVES
do do
subdir=$(basename $(dirname $archive)) subdir=$(basename $(dirname $archive))
scp -vrp -i ${SSH_KEY} \ scp -vrp -i ${SSH_KEY} -o StrictHostKeyChecking=no \
${archive} \ ${archive} \
nightlybot@download.openzim.org:/var/www/download.openzim.org/release/${subdir} nightlybot@download.openzim.org:/var/www/download.openzim.org/release/${subdir}
done done