Skip to content

Commit

Permalink
Merge pull request #358 from ucam-department-of-psychiatry/use-custom…
Browse files Browse the repository at this point in the history
…-qt-build-for-running-tests

Use our own custom Qt build for running Qt tests
  • Loading branch information
martinburchell authored Jun 12, 2024
2 parents 761024a + bb44437 commit 7d36d16
Show file tree
Hide file tree
Showing 3 changed files with 112 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
31 changes: 31 additions & 0 deletions .github/workflows/build-qt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,37 @@ 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
# TODO: This seems to be ignored and instead the release gets
# called untagged-<some hash>
if: matrix.os == 'ubuntu-22.04'
id: vars
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
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
tag: ${{ steps.vars.outputs.tag }}

- name: Windows Build Qt
if: runner.os == 'Windows'
Expand Down
90 changes: 77 additions & 13 deletions .github/workflows/cpp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,97 @@ 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}
# 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
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 7d36d16

Please sign in to comment.