Skip to content

Commit

Permalink
Use our own custom Qt build for running Qt tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
martinburchell committed Jun 8, 2024
1 parent 43706c3 commit 1bea7f0
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 22 deletions.
13 changes: 4 additions & 9 deletions .github/scripts/cpp_tests.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/build-qt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
89 changes: 76 additions & 13 deletions .github/workflows/cpp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:/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

0 comments on commit 1bea7f0

Please sign in to comment.