From 1bea7f0054c266efd1edc6dbd040fdac36b335b0 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Sat, 8 Jun 2024 11:15:15 +0100 Subject: [PATCH] Use our own custom Qt build for running Qt tests Previously we were using a third party distribution of Qt for running tests. This is fine for some tests but it is useful to have the other third party dependencies for e.g. SQL Cipher database tests. It's also more likely to flag problems with our Qt etc builds. While GitHub supports uploading and downloading of artifacts that can be shared between jobs they expire after 90 days. So instead I've (ab)used the release mechanism so that Qt is built as an artifact of a draft CamCOPS release (along with the other third party components). We'll need to clean up old builds manually. --- .github/scripts/cpp_tests.sh | 13 ++--- .github/workflows/build-qt.yml | 25 +++++++++ .github/workflows/cpp-tests.yml | 89 ++++++++++++++++++++++++++++----- 3 files changed, 105 insertions(+), 22 deletions(-) diff --git a/.github/scripts/cpp_tests.sh b/.github/scripts/cpp_tests.sh index 6facb1985..f900dbdb7 100755 --- a/.github/scripts/cpp_tests.sh +++ b/.github/scripts/cpp_tests.sh @@ -1,17 +1,12 @@ #!/bin/bash set -euxo pipefail -export CAMCOPS_QT6_BASE_DIR=${RUNNER_WORKSPACE} -cd ${CAMCOPS_QT6_BASE_DIR} -mkdir -p eigen -cd eigen -EIGEN_VERSION_FILE=${GITHUB_WORKSPACE}/tablet_qt/eigen_version.txt -EIGEN_VERSION=$(<$EIGEN_VERSION_FILE) -wget --retry-on-http-error=429 --waitretry=300 --tries=20 https://gitlab.com/libeigen/eigen/-/archive/${EIGEN_VERSION}/eigen-${EIGEN_VERSION}.tar.gz -tar xzf eigen-${EIGEN_VERSION}.tar.gz +echo "Running C++ tests..." +echo "CAMCOPS_QT6_BASE_DIR=${CAMCOPS_QT6_BASE_DIR}" cd ${GITHUB_WORKSPACE} mkdir build-qt6-tests cd build-qt6-tests -qmake ../tablet_qt/tests +${CAMCOPS_QT6_BASE_DIR}/qt_linux_x86_64_install/bin/qmake -query +${CAMCOPS_QT6_BASE_DIR}/qt_linux_x86_64_install/bin/qmake ../tablet_qt/tests make export QT_DEBUG_PLUGINS=1 diff --git a/.github/workflows/build-qt.yml b/.github/workflows/build-qt.yml index d8d51f9dc..031886389 100644 --- a/.github/workflows/build-qt.yml +++ b/.github/workflows/build-qt.yml @@ -243,6 +243,31 @@ jobs: export CAMCOPS_QT6_BASE_DIR=${HOME}/qt_local_build cd tablet_qt/tools ./build_qt.py --build_linux_x86_64 + - name: Create tarfile + if: matrix.os == 'ubuntu-22.04' + run: | + set -eux -o pipefail + echo "Free space:" + df -h + tar -czvf /tmp/qt.tgz \ + ${HOME}/qt_local_build/ffmpeg_linux_x86_64_build \ + ${HOME}/qt_local_build/openssl_linux_x86_64_build \ + ${HOME}/qt_local_build/qt_linux_x86_64_install \ + ${HOME}/qt_local_build/sqlcipher_linux_x86_64 + + - name: Work out tag + id: vars + run: echo ::set-output name=tag::qt_${GITHUB_SHA} + - name: Release Qt + if: matrix.os == 'ubuntu-22.04' + uses: ncipollo/release-action@v1 + with: + artifacts: "/tmp/qt.tgz" + token: ${{ secrets.GITHUB_TOKEN }} + prerelease: true + draft: true + body: Qt and associated libraries for building and testing the CamCOPS app + name: Qt and other libraries for CamCOPS - name: Windows Build Qt if: runner.os == 'Windows' diff --git a/.github/workflows/cpp-tests.yml b/.github/workflows/cpp-tests.yml index 8529f0a26..4999aa360 100644 --- a/.github/workflows/cpp-tests.yml +++ b/.github/workflows/cpp-tests.yml @@ -12,33 +12,96 @@ on: - .github/scripts/cpp_tests.sh - .github/workflows/cpp-tests.yml - tablet_qt/qt_version.txt + - tablet_qt/tools/build_qt.py -env: - # Keep in sync with tablet_qt/qt_version.txt. We check this further down. - QT_VERSION: 6.5.3 jobs: cpp-tests: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - name: Qt version check + - name: Install Qt run: | set -euxo pipefail - test "${{ env.QT_VERSION }}" == "$(cat ${GITHUB_WORKSPACE}/tablet_qt/qt_version.txt)" - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - version: ${{ env.QT_VERSION }} - arch: gcc_64 - modules: qtmultimedia + cd ${HOME} + wget https://github.com/ucam-department-of-psychiatry/camcops/releases/download/qtbuild/qt.tgz + # Remove home/runner from paths + tar -xvzf qt.tgz --strip-components=2 + ls + ls qt_local_build - name: Ubuntu prerequisites run: | set -eux -o pipefail ${GITHUB_WORKSPACE}/.github/scripts/change_apt_mirror.sh ${GITHUB_WORKSPACE}/.github/scripts/add_apt_sources.sh - sudo apt-get -y install libxcb-icccm4 libxcb-xkb1 libxcb-icccm4 libxcb-image0 libxcb-render-util0 libxcb-randr0 libxcb-keysyms1 libxcb-xinerama0 libxcb-xinput-dev libxcb-cursor0 - sudo apt-get -y install xvfb x11-xserver-utils + sudo apt-get -y install \ + autoconf \ + automake \ + bison \ + build-essential \ + ccache \ + cmake \ + flex \ + git \ + gperf \ + libass-dev \ + libdrm-dev \ + libegl1-mesa-dev \ + libfontconfig1-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libmp3lame-dev \ + libnss3-dev \ + libpulse-dev \ + libsdl2-dev \ + libtool \ + libva-dev \ + libvdpau-dev \ + libvorbis-dev \ + libx11-xcb-dev \ + '^libxcb.*-dev' \ + libxcomposite-dev \ + libxcursor-dev \ + libxdamage-dev \ + libxi-dev \ + libxkbcommon-dev \ + libxkbcommon-x11-dev \ + libxrandr-dev \ + libxrender-dev \ + meson \ + ninja-build \ + nodejs \ + pkg-config \ + texinfo \ + wget \ + yasm \ + zlib1g-dev \ + clang \ + libatspi2.0-dev \ + libbluetooth-dev \ + libclang-13-dev \ + libclang-14-dev \ + libclang-15-dev \ + libcups2-dev \ + libfreetype6-dev \ + libhunspell-dev \ + libopengl-dev \ + libts-dev \ + libunwind-dev \ + libx11-dev \ + libxext-dev \ + libxfixes-dev \ + libxkbfile-dev \ + libxshmfence1 \ + libxshmfence-dev \ + llvm \ + python3 + + - uses: actions/setup-python@v5 + with: + python-version: 3.8 + - name: C++ tests run: | set -eux -o pipefail + export CAMCOPS_QT6_BASE_DIR=${HOME}/qt_local_build xvfb-run --auto-servernum ${GITHUB_WORKSPACE}/.github/scripts/cpp_tests.sh