Disable cachegen (i.e. qml bytecode compilation and lint processing) … #670
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. | |
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml | |
name: run unit tests on the desktop build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
QT_VERSION: 6.6.1 | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -yq && | |
sudo apt-get install -y g++ build-essential mesa-common-dev libssl-dev \ | |
wget lsb libgl1-mesa-dev libxkbcommon-x11-0 libpulse-dev p7zip-full \ | |
ninja-build dos2unix libegl1 libxcb-cursor0 | |
sudo snap install yq | |
- name: Install Qt ${{env.QT_VERSION}} linux desktop | |
if: steps.cached_qt_emscripten.outputs.cache-hit != 'true' | |
uses: jurplel/install-qt-action@v3 | |
with: | |
aqtversion: '==3.1.*' | |
version: "${{env.QT_VERSION}}" | |
host: 'linux' | |
target: 'desktop' | |
arch: 'gcc_64' | |
modules: 'qtwebsockets qt5compat qtshadertools' | |
dir: '/opt/hostedtoolcache' | |
- name: Install QtMQTT | |
if: steps.cached_qt_emscripten.outputs.cache-hit != 'true' | |
run: | | |
echo installing QtMQTT | |
git clone https://github.com/qt/qtmqtt.git | |
cd qtmqtt | |
git checkout $QT_VERSION | |
mkdir build-qtmqtt && cd build-qtmqtt | |
export PATH=$PATH:/opt/hostedtoolcache/Qt/Tools/CMake/bin | |
export QTDIR=/opt/hostedtoolcache/Qt/$QT_VERSION/gcc_64 | |
${QTDIR}/bin/qt-configure-module .. | |
cmake --build . | |
cmake --install . --prefix ${QTDIR} --verbose | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: | | |
export QTDIR=/opt/hostedtoolcache/Qt/$QT_VERSION/gcc_64 | |
mkdir build && cd build | |
${QTDIR}/bin/qt-cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ../tests | |
- name: Build unit tests | |
run: | | |
cd build | |
cmake --build . --config ${{env.BUILD_TYPE}} | |
- name: Run unit test | |
run: | | |
cd build | |
# The following line needs 'QT_QPA_PLATFORM=offscreen' in order to run on the headless CI server | |
QT_DEBUG_PLUGINS=1 QT_QPA_PLATFORM=offscreen ctest --rerun-failed --output-on-failure |