mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-11-02 10:17:10 +09:00
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
249 lines
8.5 KiB
YAML
249 lines
8.5 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
|
|
M_ARCH: ${{ matrix.arch }}
|
|
VERSION: ${{ inputs.release_version }}
|
|
permissions:
|
|
contents: read
|
|
runs-on: ${{ matrix.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: AppImage-aarch64
|
|
EXTRA_ARGS: '--appimage-build'
|
|
arch: aarch64
|
|
runner: ubuntu-22.04-arm
|
|
- name: AppImage-x86_64
|
|
EXTRA_ARGS: '--appimage-build'
|
|
arch: x86_64
|
|
runner: ubuntu-22.04
|
|
steps:
|
|
- name: More space
|
|
uses: LizardByte/actions/actions/more_space@0528b495e6af82b4d698ec6c907a9b1842622068 # v2026.1029.234422
|
|
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 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: startsWith(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
|
|
url="${LINUXDEPLOY_GH}/releases/download/continuous/linuxdeploy-${M_ARCH}.AppImage"
|
|
wget --max-redirect=1 -q "$url" # NOSONAR(githubactions:S6506): GitHub release needs one redirect.
|
|
chmod +x "linuxdeploy-${M_ARCH}.AppImage"
|
|
|
|
# https://github.com/linuxdeploy/linuxdeploy-plugin-qt
|
|
url="${LINUXDEPLOY_GH}-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-${M_ARCH}.AppImage"
|
|
wget --max-redirect=1 -q "$url" # NOSONAR(githubactions:S6506): GitHub release needs one redirect.
|
|
chmod +x "linuxdeploy-plugin-qt-${M_ARCH}.AppImage"
|
|
export QMAKE=/usr/lib/qt6/bin/qmake
|
|
export EXTRA_QT_MODULES="svg;"
|
|
"$QMAKE" -query QT_INSTALL_PLUGINS
|
|
|
|
"./linuxdeploy-${M_ARCH}.AppImage" \
|
|
--appdir ./AppDir \
|
|
--plugin qt \
|
|
--executable ./sunshine \
|
|
--exclude-library 'libva.so*' \
|
|
--exclude-library 'libva-*.so*' \
|
|
--icon-file "../$ICON_FILE" \
|
|
--desktop-file "./$DESKTOP_FILE" \
|
|
--output appimage
|
|
|
|
# Keep the host's libva core, backends, and driver configuration together.
|
|
readelf -d ./sunshine | grep -F 'Shared library: [libva.so.2]'
|
|
readelf -d ./sunshine | grep -F 'Shared library: [libva-drm.so.2]'
|
|
test -z "$(find ./AppDir \( -name 'libva.so*' -o -name 'libva-*.so*' \) -print -quit)"
|
|
|
|
# print original name of AppImage file
|
|
echo "AppImage file: $(ls Sunshine*.AppImage)"
|
|
|
|
# move
|
|
mv Sunshine*.AppImage "../artifacts/Sunshine_${VERSION}_${M_ARCH}.AppImage"
|
|
|
|
# permissions
|
|
chmod +x "../artifacts/Sunshine_${VERSION}_${M_ARCH}.AppImage"
|
|
|
|
- name: Delete CUDA
|
|
# free up space on the runner
|
|
run: |
|
|
rm -rf ./build/cuda
|
|
|
|
- name: Setup python
|
|
id: python
|
|
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Verify AppImage
|
|
if: startsWith(matrix.name, 'AppImage')
|
|
run: |
|
|
# TODO: switch to upstream after
|
|
# https://github.com/TheAssassin/appimagelint/pull/50 and
|
|
# https://github.com/TheAssassin/appimagelint/pull/51
|
|
APPIMAGELINT_REPOSITORY="git+https://github.com/ReenigneArcher/appimagelint.git"
|
|
APPIMAGELINT_REF="lizardbyte"
|
|
python -m pip install -e "${APPIMAGELINT_REPOSITORY}@${APPIMAGELINT_REF}#egg=appimagelint"
|
|
appimagelint --help
|
|
|
|
appimagelint "./artifacts/Sunshine_${VERSION}_${M_ARCH}.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@0528b495e6af82b4d698ec6c907a9b1842622068 # v2026.1029.234422
|
|
|
|
- name: Setup uv
|
|
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
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@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
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@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
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@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: build-Linux-${{ matrix.name }}
|
|
path: artifacts/
|
|
if-no-files-found: error
|