From 1bea7f0054c266efd1edc6dbd040fdac36b335b0 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Sat, 8 Jun 2024 11:15:15 +0100 Subject: [PATCH 1/5] 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 From 76e6aae370b51c73e61f18c5aba604c82eec34fd Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 12 Jun 2024 11:49:02 +0100 Subject: [PATCH 2/5] Fix setting the tag on the third party module release --- .github/workflows/build-qt.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-qt.yml b/.github/workflows/build-qt.yml index 031886389..86d42fced 100644 --- a/.github/workflows/build-qt.yml +++ b/.github/workflows/build-qt.yml @@ -257,7 +257,9 @@ jobs: - name: Work out tag id: vars - run: echo ::set-output name=tag::qt_${GITHUB_SHA} + run: | + set -eux -o pipefail + echo "tag=qt_${GITHUB_SHA}" >> "${GITHUB_OUTPUT}" - name: Release Qt if: matrix.os == 'ubuntu-22.04' uses: ncipollo/release-action@v1 @@ -268,6 +270,7 @@ jobs: draft: true body: Qt and associated libraries for building and testing the CamCOPS app name: Qt and other libraries for CamCOPS + tag: ${{ steps.vars.outputs.tag }} - name: Windows Build Qt if: runner.os == 'Windows' From 2718ecbb2c6cec4c8034e30f50ebe4f12eb0c1dd Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 12 Jun 2024 14:21:32 +0100 Subject: [PATCH 3/5] Only work out tag for the build we're using to release --- .github/workflows/build-qt.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-qt.yml b/.github/workflows/build-qt.yml index 86d42fced..c2a1975da 100644 --- a/.github/workflows/build-qt.yml +++ b/.github/workflows/build-qt.yml @@ -256,6 +256,7 @@ jobs: ${HOME}/qt_local_build/sqlcipher_linux_x86_64 - name: Work out tag + if: matrix.os == 'ubuntu-22.04' id: vars run: | set -eux -o pipefail From 47b89614c6774a5257cafb05993b414a65b73ffe Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 12 Jun 2024 16:48:36 +0100 Subject: [PATCH 4/5] Use latest Qt build when running tests --- .github/workflows/cpp-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cpp-tests.yml b/.github/workflows/cpp-tests.yml index 4999aa360..215abc4ec 100644 --- a/.github/workflows/cpp-tests.yml +++ b/.github/workflows/cpp-tests.yml @@ -23,7 +23,8 @@ jobs: run: | set -euxo pipefail cd ${HOME} - wget https://github.com/ucam-department-of-psychiatry/camcops/releases/download/qtbuild/qt.tgz + # The path is set by the build-qt.yml action + wget https://github.com/ucam-department-of-psychiatry/camcops/releases/download/untagged-6d2cba07b921fd593071/qt.tgz # Remove home/runner from paths tar -xvzf qt.tgz --strip-components=2 ls From bb444376b04ab3d6aeb7244478ecee1ee38e0746 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 12 Jun 2024 17:03:58 +0100 Subject: [PATCH 5/5] Note about release tag [no ci] --- .github/workflows/build-qt.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-qt.yml b/.github/workflows/build-qt.yml index c2a1975da..3fa05cf67 100644 --- a/.github/workflows/build-qt.yml +++ b/.github/workflows/build-qt.yml @@ -256,11 +256,13 @@ jobs: ${HOME}/qt_local_build/sqlcipher_linux_x86_64 - name: Work out tag + # TODO: This seems to be ignored and instead the release gets + # called untagged- if: matrix.os == 'ubuntu-22.04' id: vars run: | set -eux -o pipefail - echo "tag=qt_${GITHUB_SHA}" >> "${GITHUB_OUTPUT}" + echo "tag=qt_${GITHUB_SHA}" >> $GITHUB_OUTPUT - name: Release Qt if: matrix.os == 'ubuntu-22.04' uses: ncipollo/release-action@v1