From 4a6c4f0e524a38b6eee9c3016c73bc22a1ba1438 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 14 May 2021 15:13:14 +1000 Subject: [PATCH] Adding test stages to Linux builds * Build based on new OpenRGB docker image (Debian Stretch) * Adapting AppImage build scripts to new docker image * Changing postinstall script to avoid error + Adding test stage keyword + Adding needs keyword + Debian 10 Buster 32bit & 64bit + Debian 11 Bullseye 32bit & 64bit + Fedora 34 v34 64bit only + Ubuntu 18.04LTS Bionic 32bit & 64bit + Ubuntu 20.04LTS Focal 64bit only + Ubuntu 20.10 Groovy 64bit only + Mint 20.1 Ulyssa 32bit & 64bit Amended to leave Bullseye builds in place by Adam Honse --- .gitlab-ci.yml | 249 ++++++++++++++++++++++++++++++++++++-- debian/openrgb.postinst | 3 +- filesystem.h | 16 ++- scripts/build-appimage.sh | 17 +-- 4 files changed, 260 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08db20cd..6274bef4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,7 @@ stages: - build + - test before_script: - echo "started by ${GITLAB_USER_NAME}" @@ -23,15 +24,15 @@ before_script: #reusable templates .ccache_init: &ccache_init before_script: - - apt update - - apt install -y build-essential qtcreator qtbase5-dev libusb-1.0-0-dev libhidapi-dev pkgconf wget git file + - export QT_SELECT=qt5 + - export APPIMAGE_EXTRACT_AND_RUN=1 #-----------------------------------------------------------------------# # Linux (AppImage) 32-bit Build Target # #-----------------------------------------------------------------------# "Linux 32 AppImage": <<: *ccache_init - image: i386/debian:bullseye + image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:stretch-32 stage: build script: - export $(dpkg-architecture) @@ -50,7 +51,7 @@ before_script: #-----------------------------------------------------------------------# "Linux 64 AppImage": <<: *ccache_init - image: debian:bullseye + image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:stretch-64 stage: build script: - export $(dpkg-architecture) @@ -69,10 +70,9 @@ before_script: #-----------------------------------------------------------------------# "Linux 32 deb": <<: *ccache_init - image: i386/debian:bullseye + image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:stretch-32 stage: build script: - - apt install -y debhelper - dpkg-architecture -l - dpkg-buildpackage --target-arch i386 -us -B - rm -v ../openrgb-dbgsym*.deb @@ -91,10 +91,9 @@ before_script: #-----------------------------------------------------------------------# "Linux 64 deb": <<: *ccache_init - image: debian:bullseye + image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:stretch-64 stage: build script: - - apt install -y debhelper - dpkg-architecture -l - dpkg-buildpackage -us -B - rm -v ../openrgb-dbgsym*.deb @@ -134,7 +133,239 @@ before_script: paths: - openrgb*.rpm expire_in: 30 days - + +#-----------------------------------------------------------------------# +# Linux (.deb) Debian Bullseye 32-bit Build Target # +#-----------------------------------------------------------------------# +"Linux 32 deb Bullseye": + <<: *ccache_init + image: i386/debian:bullseye + stage: build + script: + - apt update + - apt install -y build-essential qtcreator qtbase5-dev libusb-1.0-0-dev libhidapi-dev pkgconf wget git file debhelper + - dpkg-architecture -l + - dpkg-buildpackage --target-arch i386 -us -B + - rm -v ../openrgb-dbgsym*.deb + - mv -v ../openrgb*.deb ./ + + artifacts: + name: "${CI_PROJECT_NAME}_Linux_32_deb_${CI_COMMIT_SHORT_SHA}" + paths: + - openrgb*.deb + exclude: + - openrgb-dbgsym*.deb + expire_in: 30 days + +#-----------------------------------------------------------------------# +# Linux (.deb) Debian Bullseye 64-bit Build Target # +#-----------------------------------------------------------------------# +"Linux 64 deb Bullseye": + <<: *ccache_init + image: debian:bullseye + stage: build + script: + - apt update + - apt install -y build-essential qtcreator qtbase5-dev libusb-1.0-0-dev libhidapi-dev pkgconf wget git file debhelper + - dpkg-architecture -l + - dpkg-buildpackage -us -B + - rm -v ../openrgb-dbgsym*.deb + - mv -v ../openrgb*.deb ./ + + artifacts: + name: "${CI_PROJECT_NAME}_Linux_64_deb_${CI_COMMIT_SHORT_SHA}" + paths: + - openrgb*.deb + exclude: + - openrgb-dbgsym*.deb + expire_in: 30 days + +#-----------------------------------------------------------------------# +# Debian 32 Buster test # +#-----------------------------------------------------------------------# +"Debian 32 Buster": + image: i386/debian:buster + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*i386.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 32 deb" + needs: + - "Linux 32 deb" + +#-----------------------------------------------------------------------# +# Debian 32 Bullseye test # +#-----------------------------------------------------------------------# +"Debian 32 Bullseye": + image: i386/debian:bullseye + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*i386.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 32 deb" + needs: + - "Linux 32 deb" + +#-----------------------------------------------------------------------# +# Ubuntu 32 18.04LTS test # +#-----------------------------------------------------------------------# +"Ubuntu 32 18.04LTS": + image: i386/ubuntu:bionic + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*i386.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 32 deb" + needs: + - "Linux 32 deb" + +#-----------------------------------------------------------------------# +# Mint 32 19.3 test # +#-----------------------------------------------------------------------# +"Mint 32 20.1": + image: linuxmintd/mint19.3-i386 + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*i386.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 32 deb" + needs: + - "Linux 32 deb" + +#-----------------------------------------------------------------------# +# Debian 64 Buster test # +#-----------------------------------------------------------------------# +"Debian 64 Buster": + image: debian:buster + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 64 deb" + needs: + - "Linux 64 deb" + +#-----------------------------------------------------------------------# +# Debian 64 Bullseye test # +#-----------------------------------------------------------------------# +"Debian 64 Bullseye": + image: debian:bullseye + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 64 deb" + needs: + - "Linux 64 deb" + +#-----------------------------------------------------------------------# +# Fedora 64 v34 test # +#-----------------------------------------------------------------------# +"Fedora 64 v34": + image: fedora:34 + stage: test + script: + - yum -y localinstall ./openrgb*64.rpm + - openrgb --version + - openrgb -l + - yum -y remove openrgb + dependencies: + - "Linux 64 rpm" + needs: + - "Linux 64 rpm" + +#-----------------------------------------------------------------------# +# Ubuntu 64 18.04LTS test # +#-----------------------------------------------------------------------# +"Ubuntu 64 18.04LTS": + image: ubuntu:bionic + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 64 deb" + needs: + - "Linux 64 deb" + +#-----------------------------------------------------------------------# +# Ubuntu 64 20.04LTS test # +#-----------------------------------------------------------------------# +"Ubuntu 64 20.04LTS": + image: ubuntu:focal + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 64 deb" + needs: + - "Linux 64 deb" + +#-----------------------------------------------------------------------# +# Ubuntu 64 20.10 test # +#-----------------------------------------------------------------------# +"Ubuntu 64 20.10": + image: ubuntu:groovy + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 64 deb" + needs: + - "Linux 64 deb" + +#-----------------------------------------------------------------------# +# Mint 64 20.1 test # +#-----------------------------------------------------------------------# +"Mint 64 20.1": + image: linuxmintd/mint20.1-amd64 + stage: test + script: + - apt update + - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb + - openrgb --version + - openrgb -l + - apt remove -y openrgb + dependencies: + - "Linux 64 deb" + needs: + - "Linux 64 deb" + #-----------------------------------------------------------------------# # Windows (32-bit) Build Target # #-----------------------------------------------------------------------# diff --git a/debian/openrgb.postinst b/debian/openrgb.postinst index db2037e5..9b59441f 100644 --- a/debian/openrgb.postinst +++ b/debian/openrgb.postinst @@ -5,7 +5,8 @@ set -u -o pipefail # Reload rules if [ -f /bin/udevadm ]; then - udevadm control --reload-rules && udevadm trigger; + udevadm control --reload-rules || echo "done" + udevadm trigger; else echo echo "\/-------------------------------------------------------\\" diff --git a/filesystem.h b/filesystem.h index 15e1ee98..cb296956 100644 --- a/filesystem.h +++ b/filesystem.h @@ -4,9 +4,21 @@ #if defined(__has_include) && __has_include() #include -namespace filesystem = std::filesystem; -#else +// Debian 10 provides the header, but does not enable the feature, so we additionally check for the feature test macro +// MSVC below 2017 does not provide feature test macros, so we leave an exception for them +#if defined(__cpp_lib_filesystem) || defined (_MSC_VER) +namespace filesystem = std::filesystem; +#define STD_FILESYSTEM_FOUND +#endif + +#endif + +#ifndef STD_FILESYSTEM_FOUND + +#if defined(__has_include) && !__has_include() +#error Neither nor could be found on the system! Please report an issue to OpenRGB developers providing your system info. +#endif #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #include diff --git a/scripts/build-appimage.sh b/scripts/build-appimage.sh index 4a3129cd..00a1ae6d 100755 --- a/scripts/build-appimage.sh +++ b/scripts/build-appimage.sh @@ -12,11 +12,7 @@ set -e # 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 +TEMP_BASE=/tmp BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" appimage-build-XXXXXX) #-----------------------------------------------------------------------# @@ -72,20 +68,15 @@ qmake "$REPO_ROOT" make -j$(nproc) TARGET="$TARGET" make install INSTALL_ROOT=AppDir -#-----------------------------------------------------------------------# -# Make them executable # -#-----------------------------------------------------------------------# -chmod +x "$REPO_ROOT"/scripts/tools/linuxdeploy*.AppImage - #-----------------------------------------------------------------------# # Make sure Qt plugin finds QML sources so it can deploy the imported # # files # #-----------------------------------------------------------------------# export QML_SOURCES_PATHS="$REPO_ROOT"/src -"$REPO_ROOT"/scripts/tools/linuxdeploy-"$ARCH".AppImage --appimage-extract-and-run --appdir AppDir -e "$TARGET" -i "$REPO_ROOT"/qt/OpenRGB.png -d "$REPO_ROOT"/qt/OpenRGB.desktop -"$REPO_ROOT"/scripts/tools/linuxdeploy-plugin-qt-"$ARCH".AppImage --appimage-extract-and-run --appdir AppDir -"$REPO_ROOT"/scripts/tools/linuxdeploy-"$ARCH".AppImage --appimage-extract-and-run --appdir AppDir --output appimage +linuxdeploy-"$ARCH".AppImage --appdir AppDir -e "$TARGET" -i "$REPO_ROOT"/qt/OpenRGB.png -d "$REPO_ROOT"/qt/OpenRGB.desktop +linuxdeploy-plugin-qt-"$ARCH".AppImage --appdir AppDir +linuxdeploy-"$ARCH".AppImage --appdir AppDir --output appimage #-----------------------------------------------------------------------# # Move built AppImage back into original CWD #