Files
Sunshine/.github/workflows/ci-linux.yml
T
ReenigneArcher 50c54196ef Fix udev rules for virtual gamepad nodes
Extend udev rule reloading to cover hidraw and input subsystems so permissions are applied to dynamically created libvirtualhid gamepad child nodes, not just /dev/uinput and /dev/uhid.

Also:
- Always install the udev rules file regardless of whether libudev is detected at build time
- Add Homebrew postinst support to copy rules to host-monitored directories
- Trigger udevadm reload on rule removal (AppImage, Flatpak)
- Update comments to say "gamepad emulation" instead of "DS5 emulation"
- Add docs clarifying that manual chmod/setfacl changes are lost on reconnect and how to reload rules
2026-08-29 17:46:07 -04:00

246 lines
7.9 KiB
YAML

---
name: CI-Linux
permissions: {}
on:
workflow_call:
inputs:
release_commit:
required: true
type: string
release_version:
required: true
type: string
env:
PYTHON_VERSION: '3.14'
jobs:
build_linux:
name: ${{ matrix.name }}
env:
APP_ID: dev.lizardbyte.app.Sunshine
VERSION: ${{ inputs.release_version }}
permissions:
contents: read
runs-on: ubuntu-${{ matrix.dist }}
strategy:
fail-fast: false
matrix:
include:
- name: AppImage
EXTRA_ARGS: '--appimage-build'
dist: 22.04
steps:
- name: More space
uses: LizardByte/actions/actions/more_space@d0ae7f82215a479fe2b74f4088c53ee6460513dd # v2026.728.214955
with:
analyze-space-savings: true
clean-all: true
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
- name: Setup Dependencies Linux
timeout-minutes: 5
run: |
# create the artifacts directory
mkdir -p artifacts
# allow libfuse2 for appimage on 22.04+
sudo add-apt-repository universe
sudo apt-get install -y \
libdrm-dev \
libfuse2 \
libgl-dev \
libwayland-dev \
libx11-xcb-dev \
libxcb-dri3-dev \
libxfixes-dev \
libxtst-dev
- name: Build latest libva
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
timeout-minutes: 5
run: |
gh release download --archive=tar.gz --repo=intel/libva
tar xzf libva-*.tar.gz && rm libva-*.tar.gz
cd libva-*
./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu \
--enable-drm \
--enable-x11 \
--enable-glx \
--enable-wayland \
--without-legacy
make -j "$(nproc)"
sudo make install
cd .. && rm -rf libva-*
- name: Build Linux
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ inputs.release_version }}
COMMIT: ${{ inputs.release_commit }}
run: |
chmod +x ./scripts/linux_build.sh
echo "::add-matcher::.github/matchers/gcc.json"
./scripts/linux_build.sh \
--publisher-name="${GITHUB_REPOSITORY_OWNER}" \
--publisher-website="https://app.lizardbyte.dev" \
--publisher-issue-url="https://app.lizardbyte.dev/support" \
--skip-cleanup \
--skip-package \
--ubuntu-test-repo ${{ matrix.EXTRA_ARGS }}
echo "::remove-matcher owner=gcc::"
- name: Package Linux - AppImage
if: matrix.name == 'AppImage'
working-directory: build
run: |
# install sunshine to the DESTDIR
DESTDIR=AppDir ninja install
test -f AppDir/usr/share/sunshine/udev/rules.d/60-sunshine.rules
grep -Fq 'IMPORT{parent}="HID_*"' \
AppDir/usr/share/sunshine/udev/rules.d/60-sunshine.rules
grep -Fq 'ENV{HID_PHYS}=="libvirtualhid/uhid/*"' \
AppDir/usr/share/sunshine/udev/rules.d/60-sunshine.rules
# custom AppRun file
cp -f ../packaging/linux/AppImage/AppRun ./AppDir/
chmod +x ./AppDir/AppRun
# variables
DESKTOP_FILE="${DESKTOP_FILE:-${APP_ID}.desktop}"
ICON_FILE="${ICON_FILE:-sunshine.png}"
LINUXDEPLOY_GH="https://github.com/linuxdeploy/linuxdeploy"
# AppImage
# https://docs.appimage.org/packaging-guide/index.html
wget -q "${LINUXDEPLOY_GH}/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod +x linuxdeploy-x86_64.AppImage
# https://github.com/linuxdeploy/linuxdeploy-plugin-qt
wget -q "${LINUXDEPLOY_GH}-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
chmod +x linuxdeploy-plugin-qt-x86_64.AppImage
export QMAKE=/usr/lib/qt6/bin/qmake
export EXTRA_QT_MODULES="svg;"
"$QMAKE" -query QT_INSTALL_PLUGINS
./linuxdeploy-x86_64.AppImage \
--appdir ./AppDir \
--plugin qt \
--executable ./sunshine \
--icon-file "../$ICON_FILE" \
--desktop-file "./$DESKTOP_FILE" \
--output appimage
# move
mv Sunshine*.AppImage ../artifacts/sunshine.AppImage
# permissions
chmod +x ../artifacts/sunshine.AppImage
- name: Delete CUDA
# free up space on the runner
run: |
rm -rf ./build/cuda
- name: Verify AppImage
if: matrix.name == 'AppImage'
run: |
wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage
chmod +x appimagelint-x86_64.AppImage
./appimagelint-x86_64.AppImage ./artifacts/sunshine.AppImage
- name: Install screenshot dependency
run: |
sudo apt-get update -y
sudo apt-get install -y imagemagick
# clean apt cache
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
- name: Setup virtual desktop
uses: LizardByte/actions/actions/virtual_desktop@d0ae7f82215a479fe2b74f4088c53ee6460513dd # v2026.728.214955
with:
environment: mate
- name: Setup python
id: python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
- name: Sync Python tools
run: |
uv_sync_args=(
--locked
--python "${PYTHON_VERSION}"
--no-python-downloads
--no-install-project
)
# uv.lock pins external artifacts; reviewed local build hooks are required for gcovr.
uv sync "${uv_sync_args[@]}" # NOSONAR(githubactions:S8541)
- name: Run tests
id: test
working-directory: build/tests
run: ./test_sunshine --gtest_color=yes --gtest_output=xml:test_results.xml
- name: Upload system tray screenshots
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sunshine-screenshots-${{ matrix.name }}
path: build/tests/screenshots
if-no-files-found: error
- name: Generate gcov report
id: test_report
# any except canceled or skipped
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
working-directory: build
run: |
uv run --project .. --locked --no-sync gcovr \
--gcov-executable "gcov-${GCC_VERSION}" . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
--verbose \
--xml-pretty \
-o coverage.xml
- name: Upload coverage artifact
if: >-
always() &&
(steps.test_report.outcome == 'success')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-Linux-${{ matrix.name }}
path: |
build/coverage.xml
build/tests/test_results.xml
if-no-files-found: error
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-Linux-${{ matrix.name }}
path: artifacts/
if-no-files-found: error