Skip to content

samples/hidpi: add live mouse coordinate readout #1989

samples/hidpi: add live mouse coordinate readout

samples/hidpi: add live mouse coordinate readout #1989

Workflow file for this run

name: Build
# This workflow will work for pushes, pull requests, or a manual trigger (workflow_dispatch).
on: [push, pull_request, workflow_dispatch]
jobs:
build:
name: "${{ matrix.os }} / ${{ matrix.compiler }} / ${{ matrix.framework_static == 'ON' && 'static' || 'shared' }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 20
defaults:
run:
shell: bash
strategy:
# Don't cancel other in-progress jobs if one fails.
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2025-vs2026]
compiler: [gcc, clang, msvc]
framework_static: [ON, OFF]
exclude:
# msvc is only available on Windows
- os: ubuntu-latest
compiler: msvc
- os: macos-latest
compiler: msvc
# gcc on Windows would require MinGW — excluded for simplicity
- os: windows-2025-vs2026
compiler: gcc
# framework_static OFF only for specific combos
- os: ubuntu-latest
compiler: clang
framework_static: OFF
- os: macos-latest
compiler: gcc
framework_static: OFF
steps:
# Linux needs to install various dependencies.
- name: Install Linux Dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
libgl1-mesa-dev libudev-dev \
libx11-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxfixes-dev libxinerama-dev \
xvfb mesa-vulkan-drivers libvulkan1
if: runner.os == 'Linux'
- uses: actions/checkout@master
- uses: ./.github/actions/setup-cmake
- name: Setup CCache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-${{matrix.compiler}}-${{ matrix.framework_static }}
- name: Set up MSVC developer environment
uses: ilammy/msvc-dev-cmd@v1
if: matrix.compiler == 'msvc'
- name: Set compiler environment
shell: bash
run: |
case "${{ matrix.compiler }}" in
gcc)
echo "CC=gcc" >> "$GITHUB_ENV"
echo "CXX=g++" >> "$GITHUB_ENV"
;;
clang)
echo "CC=clang" >> "$GITHUB_ENV"
echo "CXX=clang++" >> "$GITHUB_ENV"
;;
msvc)
echo "CC=cl" >> "$GITHUB_ENV"
echo "CXX=cl" >> "$GITHUB_ENV"
;;
esac
- name: Configure
shell: bash
run: >
cmake -B build -G Ninja
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
-DCMAKE_POLICY_CMP0141=NEW
-DSDL_ALSA=OFF
-DSDL_CCACHE=ON
-DSDL_JACK=OFF
-DSDL_KMSDRM=OFF
-DSDL_OPENGL=OFF
-DSDL_OPENGLES=OFF
-DSDL_PIPEWIRE=OFF
-DSDL_PULSEAUDIO=OFF
-DSDL_RENDER=OFF
-DSDL_SNDIO=OFF
-DSDL_WAYLAND=OFF
-DSDL_X11=ON
-DSDL_X11_XSCRNSAVER=OFF
-DSDL_X11_XTEST=OFF
-DCF_FRAMEWORK_STATIC=${{ matrix.framework_static }}
- name: Build
run: cmake --build build
# Runtime smoke test: launch a shader-heavy sample and make sure it does
# not crash. This catches native shader-compilation regressions (e.g. the
# MSL backend on macOS) that a build alone cannot detect. `hrc` loads a
# suite of compute shaders from source at runtime, exercising that path.
- name: Smoke test sample (Linux, headless GPU)
if: runner.os == 'Linux'
run: xvfb-run -a -s "-screen 0 1280x720x24" ./.github/scripts/smoke_test.sh ./build/hrc 8
env:
SDL_AUDIODRIVER: dummy
LIBGL_ALWAYS_SOFTWARE: "1"
- name: Smoke test sample
if: runner.os != 'Linux'
run: ./.github/scripts/smoke_test.sh ./build/hrc 8
- name: Tests (Linux, headless GPU)
if: runner.os == 'Linux'
run: xvfb-run -a -s "-screen 0 1280x720x24" ./build/tests
env:
SDL_AUDIODRIVER: dummy
LIBGL_ALWAYS_SOFTWARE: "1"
- name: Tests
if: runner.os != 'Linux'
run: ./build/tests
env:
CF_TEST_DUMP: "1"
- name: Upload test readback dumps
if: failure() && runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: test-dumps-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.framework_static }}
path: build/dump_*.png
if-no-files-found: ignore
- name: Shader Compiler Tests
run: ./build/cute-spirv-tests
- name: Generate artifacts for Windows
shell: cmd
run: |
robocopy include dist *.h
if %errorlevel% geq 8 exit /b 1
robocopy build\lib dist cute*.lib
if %errorlevel% geq 8 exit /b 1
7z a artifact.zip .\dist\*
if: runner.os == 'Windows'
- name: Generate artifacts for MacOS
run: |
mkdir -p ./dist
cp -v ./include/*.h ./dist
cp -R -v ./build/lib/libcute* ./dist
tar -czvf artifact.tar.gz -C dist .
if: runner.os == 'macOS'
- name: Generate artifacts for Linux
run: |
mkdir -p ./dist
cp -v ./include/*.h ./dist
cp -v ./build/lib/libcute* ./dist
tar -czvf artifact.tar.gz -C dist .
if: runner.os == 'Linux'
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.framework_static == 'ON' && 'static' || 'shared' }}
if-no-files-found: error
path: |
artifact.zip
artifact.tar.gz
emscripten:
name: "emscripten / emcc / static"
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@master
- uses: ./.github/actions/setup-cmake
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@v14
with:
version: latest
actions-cache-folder: "emsdk-cache"
- name: Setup CCache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: emscripten
- name: Verify Emscripten
run: emcc -v
- name: Configure
run: >
emcmake cmake -B build -GNinja
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_SCAN_FOR_MODULES=OFF
-DCF_FRAMEWORK_STATIC=ON
- name: Build
run: cmake --build build -j
gles-tests:
name: "linux / gles3"
runs-on: ubuntu-latest
timeout-minutes: 20
# Emscripten always renders through the GLES3 backend (src/cute_app.cpp), but the `build` and
# `emscripten` jobs above never exercise it: `build` configures SDL with GL/GLES off entirely,
# and `emscripten` only compiles, it doesn't run the test suite. That gap is exactly how the
# shapes3d web sample shipped broken -- its uniforms never reached WebGL2 -- while every native
# backend stayed green. This job runs the real test suite through Mesa's GLES3 software
# rasterizer so a GLES-only regression like that one fails CI instead of only a user's browser.
steps:
- name: Install Linux Dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libudev-dev \
libx11-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxfixes-dev libxinerama-dev \
xvfb mesa-vulkan-drivers libvulkan1
- uses: actions/checkout@master
- uses: ./.github/actions/setup-cmake
- name: Setup CCache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: linux-gles3
- name: Configure
run: >
cmake -B build -G Ninja
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DSDL_ALSA=OFF
-DSDL_CCACHE=ON
-DSDL_JACK=OFF
-DSDL_KMSDRM=OFF
-DSDL_OPENGL=ON
-DSDL_OPENGLES=ON
-DSDL_PIPEWIRE=OFF
-DSDL_PULSEAUDIO=OFF
-DSDL_RENDER=OFF
-DSDL_SNDIO=OFF
-DSDL_WAYLAND=OFF
-DSDL_X11=ON
-DSDL_X11_XSCRNSAVER=OFF
-DSDL_X11_XTEST=OFF
-DCF_FRAMEWORK_STATIC=ON
- name: Build
run: cmake --build build --target tests
# Scoped to test_draw3d rather than the full suite: this is the GLES backend's first-ever
# CI run, and other suites were never written with GLES in mind (unlike test_draw3d, which
# already asserts cf_query_backend() for its GLES-specific cases here). Broadening this once
# the lane is proven stable is tracked separately -- see the PR this job landed with.
- name: Tests (GLES3, headless GPU)
run: xvfb-run -a -s "-screen 0 1280x720x24" ./build/tests test_draw3d
env:
CF_TEST_GLES: "1"
SDL_AUDIODRIVER: dummy
LIBGL_ALWAYS_SOFTWARE: "1"