Skip to content

Commit

Permalink
Use ninja as build system instead of make, use ccache and fail fast o…
Browse files Browse the repository at this point in the history
…n build.
  • Loading branch information
TallFurryMan committed Sep 22, 2020
1 parent 396ab2c commit 91d0dcc
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 137 deletions.
184 changes: 49 additions & 135 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,46 @@
# This YAML recipe builds KStars with INDI support, then runs all tests
# Build dependencies are in packaged into image definition 'docker/Dockerfile'
# As of 202009, two-stage pipeline fails on propagation of artifact from stage build to stage test
# Probably because the upload uses a webdav REST API, and there are many large files in the list

stages:
- build
- test

image: tallfurryman/kstars-ci:latest

# This is from packaging/linux/debian/control build-depends - fix that first if there is an issue in the CI build
.install_build_dependencies: &install_build_dependencies
- apt update && apt -y install --no-install-recommends software-properties-common
- apt update && add-apt-repository ppa:mutlaqja/ppa
- >
apt update && apt -y install --no-install-recommends
gcc-multilib
g++-multilib
make
gettext
coreutils
cmake
extra-cmake-modules
qtbase5-dev
qtdeclarative5-dev
qtmultimedia5-dev
qtpositioning5-dev
libqt5websockets5-dev
libqt5svg5-dev
libqt5sql5-sqlite
kdoctools-dev
libkf5config-dev
libkf5guiaddons-dev
libkf5i18n-dev
libkf5newstuff-dev
libkf5notifications-dev
libkf5xmlgui-dev
libkf5plotting-dev
libkf5crash-dev
libkf5notifyconfig-dev
libeigen3-dev
zlib1g-dev
libcfitsio-dev
libnova-dev
libindi-dev
indi-bin
wcslib-dev
libraw-dev
libgsl-dev
phonon4qt5-backend-vlc
qt5keychain-dev
libsecret-1-dev
variables:
CCACHE_BASEDIR: "$CI_PROJECT_DIR"
QT_TEST_TIMEOUT_FUNCTION: "600000"
QT_QPA_PLATFORM: "eglfs"
# In order to be cached successfully, the ccache folder must reside *inside* $CI_PROJECT_DIR
CCACHE_DIR: "$CI_PROJECT_DIR/.ccache"

# This is from packaging/linux/debian/control recommends/depends - fix that first if there is an issue in the CI build
.install_test_dependencies: &install_test_dependencies
- apt update && apt -y install --no-install-recommends software-properties-common
- apt update && add-apt-repository ppa:mutlaqja/ppa && add-apt-repository ppa:pch/phd2
- >
apt update &&
apt -y --no-install-recommends install
make
cmake
extra-cmake-modules
xplanet
xplanet-images
astrometry.net
kded5
kinit
libindi1
indi-bin
breeze-icon-theme
libqt5sql5-sqlite
qml-module-qtquick-controls
phd2
xvfb
# We cache the ccache folder
cache:
key: "CCACHE-DB-$CI_PROJECT_ID"
paths:
- "${CCACHE_DIR}"
# Unfortunately, cache:when is not available in the KDE version of gitlab
# Impact: we need a first build to succeed before the cache is available on the runner for further builds
# when:
# - always

#image: ubuntu:latest
.build_recipe: &build_recipe
- mkdir -p kstars-build
- cd kstars-build
- cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. -DCCACHE_SUPPORT=ON -DBUILD_TESTING=${BUILD_TESTING:-OFF} -DBUILD_DOC=${BUILD_DOC:-OFF}
- ninja all install

build:
stage: build
interruptible: true
before_script:
- du -hs ${CCACHE_DIR}
script:
- *build_recipe
after_script:
- ccache -s

# Run the full validation in one step
# The artifacts take far too much time to propagate from one step to the other
Expand All @@ -75,94 +49,34 @@
build-and-test:
stage: test
interruptible: true
image: tallfurryman/kstars-ci
# before_script:
# - *install_build_dependencies
# - *install_test_dependencies
variables:
BUILD_TESTING: "ON"
before_script:
- *build_recipe
script:
- mkdir -p kstars-build
- cd kstars-build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make -j$(nproc) clean all install
- rm -rf Testing
- xvfb-run make test QT_TEST_TIMEOUT_FUNCTION=600000 QT_QPA_PLATFORM=eglfs ARGS='-T test -V --output-on-failure --no-compress-output' || true
- apt install -y --no-install-recommends libsaxon-java openjdk-11-jre-headless
- xvfb-run ctest -T test -V --output-on-failure --no-compress-output || true
- saxon-xslt -u $(find ./Testing -name Test.xml) https://raw.githubusercontent.com/rpavlik/jenkins-ctest-plugin/master/ctest-to-junit.xsl > ./junit_result.xml
after_script:
- ccache -s
artifacts:
reports:
junit:
kstars-build/junit_result.xml

# This part kept for reference, does not work on our gitlab instance
# Mainly because of the propagation of artifact from stage build to stage test
# Probably because the upload uses a webdav REST API, and there are many large files in the list
# In the meantime, following up on the many gitlab issues reporting that problem

# We build and test
#stages:
# - build
# - test

# We cache the build folder per job and per branch
# cache:
# key: "$CI_COMMIT_REF_SLUG"
# paths:
# - kstars-build/

# Consolidate runner with build packages and build
#build-kstars:
# stage: build
# interruptible: true
# before_script:
# - *install_build_dependencies
# script:
# - mkdir -p kstars-build
# - cd kstars-build
# - cmake -DCMAKE_BUILD_TYPE=Release ..
# - make -j$(nproc) clean all
# artifacts:
# expire_in: 3600 sec
# paths:
# - kstars-build/
# exclude:
# - kstars-build/**/*.o

# Consolidate runner with test packages and test
#test-kstars:
# stage: test
# interruptible: true
# needs:
# - build-kstars
# dependencies:
# - build-kstars
# before_script:
# - *install_test_dependencies
# script:
# - cd kstars-build
# - rm -rf Testing
# - xvfb-run -a make test QT_TEST_TIMEOUT_FUNCTION=600000 ARGS='-T test --no-compress-output'
# artifacts:
# reports:
# junit:
# kstars-build/Testing/**.xml

build-appimage:
image: tallfurryman/kstars-ci
stage: test
interruptible: true
before_script:
- apt-get install -y python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot wget gpg-agent
- python3 -m pip install appimage-builder

- wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /opt/appimagetool
- chmod +x /opt/appimagetool
- pushd /opt/; /opt/appimagetool --appimage-extract
- mv /opt/squashfs-root /opt/appimagetool.AppDir
- ln -s /opt/appimagetool.AppDir/AppRun /usr/local/bin/appimagetool
- popd
script:
- mkdir -p kstars-build
- cd kstars-build
- cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF -DBUILD_TESTING=OFF -DBUILD_DOC=OFF -DKDE_SKIP_TEST_SETTINGS=ON
- make -j$(nproc)
- *build_recipe
- appimage-builder --recipe ../appimage/appimage-builder.yml --skip-test
artifacts:
paths:
Expand Down
2 changes: 1 addition & 1 deletion appimage/appimage-builder.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 1
script:
- rm -rf AppDir || true
- DESTDIR=AppDir make install
- DESTDIR=AppDir ninja install
- for F in $(dpkg-query -L libraw20); do cp $F --parent -t AppDir -v; done
AppDir:
path: ./AppDir
Expand Down
27 changes: 26 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,34 @@ RUN apt update && apt -y --no-install-recommends install \
phd2 \
xvfb

# QT5 theme
ENV QT_QPA_PLATFORMTHEME=qt5ct
RUN apt update && apt -y --no-install-recommends install qt5ct
RUN d=/root/.config/qt5ct ; mkdir -p "$d" && echo '[Appearance]\nicon_theme=breeze' > "$d/qt5ct.conf"
ENV QT_QPA_PLATFORMTHEME=qt5ct

# Ninja
RUN apt update && apt -y --no-install-recommends install ninja-build

# CCache
ENV CCACHE_DIR=/var/ccache
RUN apt update && apt -y --no-install-recommends install ccache
RUN mkdir -p $CCACHE_DIR && chmod a=rwx $CCACHE_DIR && update-ccache-symlinks

# AppImage
RUN apt update && apt -y --no-install-recommends install \
python3-pip \
python3-setuptools \
patchelf \
desktop-file-utils \
libgdk-pixbuf2.0-dev \
fakeroot \
wget \
gpg-agent

# Saxon
RUN apt install -y --no-install-recommends \
libsaxon-java \
openjdk-11-jre-headless

CMD /bin/bash

0 comments on commit 91d0dcc

Please sign in to comment.