Commit d8d76f2f authored by Adam Honse's avatar Adam Honse

Add GitLab CI Linux build target that produces an AppImage

parent f9a7648b
Pipeline #173119006 failed with stage
in 4 minutes and 27 seconds
......@@ -25,18 +25,18 @@ before_script:
#-----------------------------------------------------------------------#
# Linux (AppImage) Build Target #
#-----------------------------------------------------------------------#
# build_linux:
# image: ubuntu:bionic
# stage: build
# script:
# - apt update
# - apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git
# - ./scripts/build-appimage.sh
# artifacts:
# paths:
# - OpenRGB-x86_64.AppImage
# expire_in: 1337 years
build_linux:
image: ubuntu:bionic
stage: build
script:
- apt update
- apt install -y build-essential qtcreator qt5-default libopenal-dev pkgconf wget git
- ./scripts/build-appimage.sh
artifacts:
paths:
- KeyboardVisualizer-x86_64.AppImage
expire_in: 1337 years
#-----------------------------------------------------------------------#
# Windows (32-bit) Build Target #
......
#!/bin/bash
#-----------------------------------------------------------------------#
# Keyboard Visualizer AppImage Build Script #
#-----------------------------------------------------------------------#
set -x
set -e
#-----------------------------------------------------------------------#
# Build in a temporary directory to keep the system clean #
# Use RAM disk if possible (if available and not building on a CI #
# system like Travis) #
#-----------------------------------------------------------------------#
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
else
TEMP_BASE=/tmp
fi
BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" appimage-build-XXXXXX)
#-----------------------------------------------------------------------#
# Make sure to clean up build dir, even if errors occur #
#-----------------------------------------------------------------------#
cleanup () {
if [ -d "$BUILD_DIR" ]; then
rm -rf "$BUILD_DIR"
fi
}
trap cleanup EXIT
#-----------------------------------------------------------------------#
# Store repo root as variable #
#-----------------------------------------------------------------------#
REPO_ROOT=$(readlink -f $(dirname $(dirname $0)))
OLD_CWD=$(readlink -f .)
#-----------------------------------------------------------------------#
# Switch to build dir #
#-----------------------------------------------------------------------#
pushd "$BUILD_DIR"
#-----------------------------------------------------------------------#
# Configure build files with qmake #
# we need to explicitly set the install prefix, as qmake's default is #
# /usr/local for some reason... #
#-----------------------------------------------------------------------#
qmake "$REPO_ROOT"
#-----------------------------------------------------------------------#
# Build project and install files into AppDir #
#-----------------------------------------------------------------------#
make -j$(nproc)
make install INSTALL_ROOT=AppDir
#-----------------------------------------------------------------------#
# Now, build AppImage using linuxdeploy and linuxdeploy-plugin-qt #
# Download linuxdeploy and its Qt plugin #
#-----------------------------------------------------------------------#
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
#-----------------------------------------------------------------------#
# Make them executable #
#-----------------------------------------------------------------------#
chmod +x linuxdeploy*.AppImage
#-----------------------------------------------------------------------#
# Make sure Qt plugin finds QML sources so it can deploy the imported #
# files #
export QML_SOURCES_PATHS="$REPO_ROOT"/src
./linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir AppDir -e KeyboardVisualizer -i "$REPO_ROOT"/KeyboardVisualizerQT/KeyboardVisualizer.png -d "$REPO_ROOT"/KeyboardVisualizerQT/KeyboardVisualizer.desktop
./linuxdeploy-plugin-qt-x86_64.AppImage --appimage-extract-and-run --appdir AppDir
./linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir AppDir --output appimage
#-----------------------------------------------------------------------#
# Move built AppImage back into original CWD #
#-----------------------------------------------------------------------#
mv KeyboardVisualizer*.AppImage "$OLD_CWD"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment