Build the flatpak in travis.

Use docker to have the last version of ubuntu (and flatpak)
This commit is contained in:
Matthieu Gautier 2018-11-27 10:04:36 +01:00
parent a3ce2e0126
commit 086361b432
3 changed files with 92 additions and 11 deletions

View File

@ -32,8 +32,13 @@ script:
- |
if [[ $TRAVIS_OS_NAME = "linux" && $DESKTOP_ONLY == 1 ]]
then
docker build -t kiwix/build -f travis/Dockerfile .
docker run -e PLATFORM -e NIGHTLY_DATE -e TRAVIS_EVENT_TYPE -e TRAVIS_BUILD_DIR -e DESKTOP_ONLY -e TRAVIS_TAG --device /dev/fuse --cap-add SYS_ADMIN kiwix/build
if [[ $PLATFORM = "flatpak" ]]
then
docker build -t kiwix/build -f travis/Dockerfile_flatpak .
else
docker build -t kiwix/build -f travis/Dockerfile .
fi
docker run -e PLATFORM -e NIGHTLY_DATE -e TRAVIS_EVENT_TYPE -e TRAVIS_BUILD_DIR -e DESKTOP_ONLY -e TRAVIS_TAG --device /dev/fuse --cap-add ALL kiwix/build
else
travis/compile_all.py
fi
@ -83,6 +88,10 @@ matrix:
addons:
apt:
packages: []
- env: PLATFORM="flatpak" DESKTOP_ONLY=1
addons:
apt:
packages: []
- env: PLATFORM="native_static"
addons:
apt:

63
travis/Dockerfile_flatpak Normal file
View File

@ -0,0 +1,63 @@
FROM ubuntu:bionic
ENV LANG C.UTF-8
RUN \
apt update -q; \
apt full-upgrade --purge -q -y; \
apt install -q -y --no-install-recommends \
# Base build tools
build-essential \
automake \
libtool \
cmake \
ccache \
pkg-config \
autopoint \
patch \
python \
python3 \
python3-pip \
python3-setuptools \
git \
subversion \
wget \
unzip \
sudo \
# Flatpak tools
elfutils \
flatpak \
flatpak-builder \
# 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_artful
CMD kiwix-build/travis/compile_all.py && kiwix-build/travis/deploy.sh

View File

@ -96,7 +96,7 @@ def run_kiwix_build(target, platform,
subprocess.check_call(command, cwd=str(HOME))
def create_app_image():
def create_desktop_image():
if make_release:
postfix = main_project_versions['kiwix-desktop']
extra_postfix = release_versions.get('kiwix-desktop')
@ -112,19 +112,24 @@ def create_app_image():
archive_dir = NIGHTLY_KIWIX_ARCHIVES_DIR
src_dir = SOURCE_DIR/'kiwix-desktop'
command = ['kiwix-build/scripts/create_kiwix-desktop_appImage.sh',
str(BASE_DIR/'INSTALL'), str(src_dir), str(HOME/'AppDir')]
print_message("Build AppImage of kiwix-desktop")
subprocess.check_call(command, cwd=str(HOME))
if PLATFORM == 'flatpak':
build_path = BASE_DIR/'BUILD_flatpak'/'org.kiwix.Client.flatpak'
app_name = 'org.kiwix.Client.{}.flatpak'.format(postfix)
else:
build_path = HOME/'Kiwix-x86_64.AppImage'
app_name = "kiwix-desktop_x86_64_{}.appimage".format(postfix)
command = ['kiwix-build/scripts/create_kiwix-desktop_appImage.sh',
str(BASE_DIR/'INSTALL'), str(src_dir), str(HOME/'AppDir')]
print_message("Build AppImage of kiwix-desktop")
subprocess.check_call(command, cwd=str(HOME))
try:
archive_dir.mkdir(parents=True)
except FileExistsError:
pass
app_name = "kiwix-desktop_x86_64_{}.appimage".format(postfix)
print_message("Copy AppImage to {}".format(archive_dir/app_name))
shutil.copy(str(HOME/'Kiwix-x86_64.AppImage'), str(archive_dir/app_name))
print_message("Copy Build to {}".format(archive_dir/app_name))
shutil.copy(str(build_path), str(archive_dir/app_name))
def make_archive(project, platform):
@ -291,6 +296,8 @@ if environ['TRAVIS_EVENT_TYPE'] != 'cron' and not make_release:
TARGETS = ('kiwix-desktop', )
else:
TARGETS = ('kiwix-tools', 'zim-tools', 'zimwriterfs')
elif PLATFORM == 'flatpak':
TARGETS = ('kiwix-desktop', )
else:
TARGETS = ('kiwix-tools', )
@ -319,6 +326,8 @@ elif PLATFORM.startswith('native_'):
TARGETS = ('kiwix-desktop', )
else:
TARGETS = ('libzim', 'zimwriterfs', 'zim-tools', 'kiwix-lib', 'kiwix-tools')
elif PLATFORM == 'flatpak':
TARGETS = ('kiwix-desktop', )
else:
TARGETS = ('libzim', 'zim-tools', 'kiwix-lib', 'kiwix-tools')
@ -334,7 +343,7 @@ for target in TARGETS:
platform=PLATFORM,
make_release=make_release)
if target == 'kiwix-desktop':
create_app_image()
create_desktop_image()
if make_release and PLATFORM == 'native_dyn' and release_versions.get(target) == 0:
run_kiwix_build(target,
platform=PLATFORM,