Add a flatpak travis job.

NOTE: This doesn't sign/upload/etc the output anywhere.
This commit is contained in:
pentarctagon 2019-12-25 21:14:03 -06:00 committed by Pentarctagon
parent 183408445f
commit 21d133828b
5 changed files with 46 additions and 8 deletions

View file

@ -8,6 +8,7 @@ cache:
ccache: true
directories:
- $HOME/build-cache
- $HOME/flatpak-cache
git:
depth: 5
@ -36,6 +37,8 @@ matrix:
- env: CXXSTD=14 NLS=false LTS=steamrt BRANCH=master CC=gcc-5 CXX=g++-5
- env: NLS=true LTS=flatpak BRANCH=master
- os: osx
compiler: clang
env: TOOL=scons CXXSTD=14 NLS=false OPT=-O0

View file

@ -19,6 +19,14 @@
"/share/man",
"*.la", "*.a"
],
"build-options": {
"cflags-override": true,
"cppflags-override": true,
"cxxflags-override": true,
"cflags": "",
"cppflags": "",
"cxxflags": ""
},
"modules": [
{
"name": "boost",
@ -32,7 +40,7 @@
],
"build-commands": [
"./bootstrap.sh --prefix=/app --with-libraries=filesystem,locale,iostreams,program_options,regex,random,thread",
"./b2 -j4 install cxxflags='-fPIE -fstack-protector-strong' define=_FORTIFY_SOURCE=2 link=static variant=release address-model=64 --layout=system"
"./b2 -j$FLATPAK_BUILDER_N_JOBS install cxxflags='-fPIE -fstack-protector-strong' define=_FORTIFY_SOURCE=2 link=static variant=release address-model=64 --layout=system"
]
},
{
@ -57,7 +65,7 @@
"/share/applications/wesnoth_editor.desktop"
],
"build-commands": [
"python3 /app/bin/scons -j $FLATPAK_BUILDER_N_JOBS prefix=/app ccache=true install wesnoth wesnothd"
"python3 /app/bin/scons -j $FLATPAK_BUILDER_N_JOBS prefix=/app ccache=true --debug=time install wesnoth wesnothd"
],
"sources": [
{

View file

@ -0,0 +1,11 @@
FROM wesnoth/wesnoth:1804-master
# install ppa for more recent flatpak version, otherwise "dir" source type is unrecognized
RUN apt install -y software-properties-common
RUN add-apt-repository -y ppa:alexlarsson/flatpak
RUN apt update
# install flatpak
RUN apt install -y flatpak flatpak-builder jq
RUN flatpak remote-add flathub https://flathub.org/repo/flathub.flatpakrepo
# install runtime
RUN flatpak install -y flathub org.freedesktop.Platform/x86_64/19.08 org.freedesktop.Sdk/x86_64/19.08

View file

@ -26,7 +26,7 @@ BOOST_TEST="${11}"
LTO="${12}"
SAN="${13}"
VALIDATE="${14}"
TYPE="${15}"
LTS="${15}"
if [ "$OPT" == "-O0" ]; then
STRICT="true"
@ -55,25 +55,39 @@ echo "BOOST_TEST: $BOOST_TEST"
echo "LTO: $LTO"
echo "SAN: $SAN"
echo "VALIDATE: $VALIDATE"
echo "TYPE: $TYPE"
echo "LTS: $LTS"
echo "STRICT: $STRICT"
echo "build_timeout(mins): $build_timeout"
$CXX --version
if [ "$NLS" == "true" ]; then
if [ "$NLS" == "true" ] && [ "$LTS" != "flatpak" ]; then
cmake -DENABLE_NLS=true -DENABLE_GAME=false -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=false
make VERBOSE=1 -j2 || exit 1
make clean
scons translations build=release --debug=time nls=true jobs=2
elif [ "$TYPE" == "mingw" ]; then
elif [ "$LTS" == "flatpak" ]; then
# docker's --volume means the directory is on a separate filesystem
# flatpak-builder doesn't support this
# therefore manually move stuff between where flatpak needs it and where travis' caching can see it
rm -R .flatpak-builder/*
cp -R flatpak-cache/. .flatpak-builder/
jq '.modules[2].sources[0]={"type":"dir","path":"/home/wesnoth-travis"} | ."build-options".env.FLATPAK_BUILDER_N_JOBS="2"' packaging/flatpak/org.wesnoth.Wesnoth.json > utils/dockerbuilds/travis/org.wesnoth.Wesnoth.json
flatpak-builder --ccache --force-clean --disable-rofiles-fuse wesnoth-app utils/dockerbuilds/travis/org.wesnoth.Wesnoth.json
BUILD_RET=$?
rm -R flatpak-cache/*
cp -R .flatpak-builder/. flatpak-cache/
chmod -R 777 flatpak-cache/
exit $BUILD_RET
elif [ "$LTS" == "mingw" ]; then
scons wesnoth wesnothd build=release \
cxx_std=$CXXSTD opt="$OPT" strict="$STRICT" \
nls=false enable_lto="$LTO" sanitize="$SAN" jobs=2 --debug=time \
arch=x86-64 prefix=/windows/mingw64 gtkdir=/windows/mingw64 host=x86_64-w64-mingw32
elif [ "$TYPE" == "steamrt" ]; then
elif [ "$LTS" == "steamrt" ]; then
scons ctool=$CC cxxtool=$CXX boostdir=/usr/local/include boostlibdir=/usr/local/lib extra_flags_config=-lrt \
cxx_std=$CXXSTD opt="$OPT" strict="$STRICT" nls=false enable_lto="$LTO" sanitize="$SAN" jobs=2 --debug=time \
build=release

View file

@ -40,8 +40,10 @@ if [ "$TRAVIS_OS_NAME" = "osx" ]; then
fi
fi
else
docker run --cap-add=SYS_PTRACE \
# additional permissions required due to flatpak's use of bubblewrap
docker run --cap-add=ALL --privileged \
--volume "$HOME"/build-cache:/home/wesnoth-travis/build \
--volume "$HOME"/flatpak-cache:/home/wesnoth-travis/flatpak-cache \
--volume "$HOME"/.ccache:/root/.ccache \
--tty wesnoth-repo:"$LTS"-"$BRANCH" \
unbuffer ./utils/travis/docker_run.sh "$NLS" "$TOOL" "$CC" "$CXX" "$CXXSTD" "$OPT" "$WML_TESTS" "$WML_TEST_TIME" "$PLAY_TEST" "$MP_TEST" "$BOOST_TEST" "$LTO" "$SAN" "$VALIDATE" "$LTS"