Skip to content

Commit

Permalink
Add CI for CMake.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Sep 8, 2024
1 parent 163b93c commit fbda8ea
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CMake

on: [push, pull_request]

jobs:
cmake:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install xvfb
sudo apt-get install build-essential libgl1-mesa-dev libgstreamer-gl1.0-0 libpulse-dev \
libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 \
libxcb-xinerama0 libxcb1 libxkbcommon-dev libxkbcommon-x11-0 libxcb-xkb-dev cmake
sudo apt install qt6-base-dev qt6-svg-dev qtbase5-dev libqt5svg5
- name: Running our CMake flow.
run: |
scripts/cmake.sh
46 changes: 46 additions & 0 deletions scripts/cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
#
# Run custom CMake build script which auto-downloads,
# builds, and then uses the compiled code in an application.
# sudo apt-get update
# sudo apt-get install xvfb
# sudo apt-get install build-essential libgl1-mesa-dev libgstreamer-gl1.0-0 libpulse-dev \
# libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
# libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 \
# libxcb-xinerama0 libxcb1 libxkbcommon-dev libxkbcommon-x11-0 libxcb-xkb-dev cmake
# sudo apt install qt6-base-dev qt6-svg-dev qtbase5-dev libqt5svg5

set -eux pipefail

scripts_home="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
project_home="$(dirname "${scripts_home}")"
build_dir="${project_home}/dist/build"

mkdir -p "${build_dir}/"{qt5,qt6}

# we xcb installed for our headless running, so exit if we don't have it
if ! hash xvfb-run &>/dev/null; then
>&2 echo "Do not have xvfb installed..."
exit 1
fi

# first, try Qt5
# NOTE: Since we're using `-e`, we need to specially
# capture the error code immediately.
export QT_QPA_PLATFORM=offscreen
cd "${build_dir}/qt5"
cmake ../../example/cmake -D QT_VERSION=Qt5
make -j
timeout 1 xvfb-run -a ./testing || error_code=$?
if [[ "${error_code}" != 124 ]]; then
exit "${error_code}"
fi

# first, try Qt6
cd "${build_dir}/qt6"
cmake ../../example/cmake -D QT_VERSION=Qt6
make -j
timeout 1 xvfb-run -a ./testing || error_code=$?
if [[ "${error_code}" != 124 ]]; then
exit "${error_code}"
fi
10 changes: 10 additions & 0 deletions scripts/headless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
# - PySide6
# And if using Python 3.10 or earlier:
# - PySide2
#
# On Ubuntu, this requires the following install logic:
# python -m pip install --upgrade pip
# pip install PySide2 PySide6 PyQt5 PyQt6
# sudo apt-get update
# sudo apt-get install xvfb
# sudo apt-get install build-essential libgl1-mesa-dev libgstreamer-gl1.0-0 libpulse-dev \
# libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
# libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 \
# libxcb-xinerama0 libxcb1 libxkbcommon-dev libxkbcommon-x11-0 libxcb-xkb-dev

set -eux pipefail

Expand Down

0 comments on commit fbda8ea

Please sign in to comment.